mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-07 13:41:15 -07:00
Bump dnspython from 2.2.1 to 2.3.0 (#1975)
* Bump dnspython from 2.2.1 to 2.3.0 Bumps [dnspython](https://github.com/rthalley/dnspython) from 2.2.1 to 2.3.0. - [Release notes](https://github.com/rthalley/dnspython/releases) - [Changelog](https://github.com/rthalley/dnspython/blob/master/doc/whatsnew.rst) - [Commits](https://github.com/rthalley/dnspython/compare/v2.2.1...v2.3.0) --- updated-dependencies: - dependency-name: dnspython dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Update dnspython==2.3.0 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> [skip ci]
This commit is contained in:
parent
6910079330
commit
32c06a8b72
137 changed files with 7699 additions and 4277 deletions
|
@ -17,6 +17,8 @@
|
|||
|
||||
"""DNS TTL conversion."""
|
||||
|
||||
from typing import Union
|
||||
|
||||
import dns.exception
|
||||
|
||||
# Technically TTLs are supposed to be between 0 and 2**31 - 1, with values
|
||||
|
@ -31,7 +33,7 @@ class BadTTL(dns.exception.SyntaxError):
|
|||
"""DNS TTL value is not well-formed."""
|
||||
|
||||
|
||||
def from_text(text):
|
||||
def from_text(text: str) -> int:
|
||||
"""Convert the text form of a TTL to an integer.
|
||||
|
||||
The BIND 8 units syntax for TTLs (e.g. '1w6d4h3m10s') is supported.
|
||||
|
@ -60,15 +62,15 @@ def from_text(text):
|
|||
if need_digit:
|
||||
raise BadTTL
|
||||
c = c.lower()
|
||||
if c == 'w':
|
||||
if c == "w":
|
||||
total += current * 604800
|
||||
elif c == 'd':
|
||||
elif c == "d":
|
||||
total += current * 86400
|
||||
elif c == 'h':
|
||||
elif c == "h":
|
||||
total += current * 3600
|
||||
elif c == 'm':
|
||||
elif c == "m":
|
||||
total += current * 60
|
||||
elif c == 's':
|
||||
elif c == "s":
|
||||
total += current
|
||||
else:
|
||||
raise BadTTL("unknown unit '%s'" % c)
|
||||
|
@ -81,10 +83,10 @@ def from_text(text):
|
|||
return total
|
||||
|
||||
|
||||
def make(value):
|
||||
def make(value: Union[int, str]) -> int:
|
||||
if isinstance(value, int):
|
||||
return value
|
||||
elif isinstance(value, str):
|
||||
return dns.ttl.from_text(value)
|
||||
else:
|
||||
raise ValueError('cannot convert value to TTL')
|
||||
raise ValueError("cannot convert value to TTL")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue