1
0
mirror of https://github.com/checktheroads/hyperglass synced 2024-05-11 05:55:08 +00:00

Restructure utilities, add tests

This commit is contained in:
thatmattlove
2021-12-15 00:50:20 -07:00
parent 44a1b0aa78
commit b7b681f3d3
11 changed files with 548 additions and 402 deletions

View File

@@ -13,7 +13,7 @@ import httpx
# Project
from hyperglass.log import log
from hyperglass.util import make_repr, parse_exception
from hyperglass.util import parse_exception, repr_from_attrs
from hyperglass.constants import __version__
from hyperglass.models.fields import JsonValue, HttpMethod, Primitives
from hyperglass.exceptions.private import ExternalError
@@ -124,7 +124,7 @@ class BaseExternal:
def __repr__(self: "BaseExternal") -> str:
"""Return user friendly representation of instance."""
return make_repr(self)
return repr_from_attrs(self, ("name", "base_url", "config", "parse"))
def _exception(
self: "BaseExternal",

View File

@@ -1,5 +1,6 @@
"""Session handler for Microsoft Teams API."""
# Standard Library
import typing as t
# Project
@@ -8,6 +9,7 @@ from hyperglass.external._base import BaseExternal
from hyperglass.models.webhook import Webhook
if t.TYPE_CHECKING:
# Project
from hyperglass.models.config.logging import Http