projects
/
zonemaker.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
81b4573
)
experiment with mypy type annotations
author
Ralf Jung
<post@ralfj.de>
Sat, 8 Nov 2014 22:20:34 +0000
(23:20 +0100)
committer
Ralf Jung
<post@ralfj.de>
Sat, 8 Nov 2014 22:20:34 +0000
(23:20 +0100)
zonemaker/zone.py
patch
|
blob
|
history
diff --git
a/zonemaker/zone.py
b/zonemaker/zone.py
index 435b0392669fcaea56b6039c5c4a45f80becf705..f5db2a8cfd9df7990823003ec65a1a3017362a6c 100644
(file)
--- a/
zonemaker/zone.py
+++ b/
zonemaker/zone.py
@@
-1,3
+1,4
@@
+from typing import List, Dict, Any
import ipaddress, re
second = 1
import ipaddress, re
second = 1
@@
-5,7
+6,7
@@
minute = 60*second
hour = 60*minute
day = 24*hour
hour = 60*minute
day = 24*hour
-def hostname(name
)
:
+def hostname(name
: str) -> str
:
# check hostname for validity
label = r'[a-zA-Z90-9]([a-zA-Z90-9-]{0,61}[a-zA-Z90-9])?' # must not start or end with hyphen
pattern = r'^{0}(\.{0})*\.?'.format(label)
# check hostname for validity
label = r'[a-zA-Z90-9]([a-zA-Z90-9-]{0,61}[a-zA-Z90-9])?' # must not start or end with hyphen
pattern = r'^{0}(\.{0})*\.?'.format(label)
@@
-43,10
+44,10
@@
class Delegation():
pass
class Zone:
pass
class Zone:
- def __init__(self, name
, mail, NS
,
- secondary_refresh
, secondary_retry, secondary_discard
,
- NX_TTL
= None, A_TTL = None, other_TTL
= None,
- domains
= [])
:
+ def __init__(self, name
: str, mail: str, NS: List[str]
,
+ secondary_refresh
: int, secondary_retry: int, secondary_discard: int
,
+ NX_TTL
: int = None, A_TTL: int = None, other_TTL: int
= None,
+ domains
: Dict[str, Any] = {}) -> None
:
self._name = hostname(name)
if not mail.endswith('.'): raise Exception("Mail must be absolute, end with a dot")
atpos = mail.find('@')
self._name = hostname(name)
if not mail.endswith('.'): raise Exception("Mail must be absolute, end with a dot")
atpos = mail.find('@')