Commit aee8c3d9 authored by Vincent Texier's avatar Vincent Texier

Clean up merged files

parent b39fabd7
......@@ -17,8 +17,8 @@
#
__author__ = 'Caner Candan & inso & vit'
__version__ = '0.43.5'
__nonsense__ = 'duniter'
__author__ = 'Caner Candan & inso & vit'
__version__ = '0.43.5'
__nonsense__ = 'duniter'
from . import api, documents, key
\ No newline at end of file
from . import api, documents, key
......@@ -10,13 +10,13 @@ from ...constants import WS2P_PUBLIC_PREFIX_REGEX, WS2P_PRIVATE_PREFIX_REGEX, WS
@attr.s()
class API:
private = attr.ib(type=str)
public = attr.ib(type=str)
re_inline = re.compile("WS2P({ws2p_private})?({ws2p_public})?".format(
ws2p_private=WS2P_PRIVATE_PREFIX_REGEX,
ws2p_public=WS2P_PUBLIC_PREFIX_REGEX))
private = attr.ib(type=str)
public = attr.ib(type=str)
@classmethod
def from_inline(cls, inline):
data = API.re_inline.match(inline)
......@@ -38,10 +38,10 @@ class API:
@attr.s()
class Head:
re_inline = re.compile(WS2P_HEAD_REGEX)
version = attr.ib(type=int)
re_inline = re.compile(WS2P_HEAD_REGEX)
@classmethod
def from_inline(cls, inline):
try:
......@@ -64,6 +64,11 @@ class HeadV0:
"""
A document describing a self certification.
"""
signature = attr.ib(type=str)
api = attr.ib(type=API)
head = attr.ib(type=Head)
pubkey = attr.ib(type=str)
blockstamp = attr.ib(type=BlockUID)
re_inline = re.compile("^(WS2P(?:{ws2p_private})?(?:{ws2p_public})?):({head}):({pubkey}):({blockstamp})(?::)?(.*)"
.format(ws2p_private=WS2P_PRIVATE_PREFIX_REGEX,
......@@ -75,12 +80,6 @@ class HeadV0:
re_signature = re.compile(SIGNATURE_REGEX)
signature = attr.ib(type=str)
api = attr.ib(type=API)
head = attr.ib(type=Head)
pubkey = attr.ib(type=str)
blockstamp = attr.ib(type=BlockUID)
@classmethod
def from_inline(cls, inline, signature):
try:
......@@ -102,18 +101,18 @@ class HeadV0:
@attr.s()
class HeadV1:
re_inline = re.compile("({ws2pid}):({software}):({software_version}):({pow_prefix})(?::)?(.*)".format(
ws2pid=WS2PID_REGEX,
software="[A-Za-z-_]+",
software_version="[0-9]+[.][0-9]+[.][0-9]+",
pow_prefix="[0-9]+"))
v0 = attr.ib(type=HeadV0)
ws2pid = attr.ib(type=str)
software = attr.ib(type=str)
software_version = attr.ib(type=str)
pow_prefix = attr.ib(type=int)
re_inline = re.compile("({ws2pid}):({software}):({software_version}):({pow_prefix})(?::)?(.*)".format(
ws2pid=WS2PID_REGEX,
software="[A-Za-z-_]+",
software_version="[0-9]+[.][0-9]+[.][0-9]+",
pow_prefix="[0-9]+"))
@classmethod
def from_inline(cls, inline, signature):
try:
......@@ -147,14 +146,14 @@ class HeadV1:
@attr.s
class HeadV2:
re_inline = re.compile("({free_member_room}):({free_mirror_room})(?::)?(.*)".format(
free_member_room="[0-9]+",
free_mirror_room="[0-9]+"))
v1 = attr.ib(type=HeadV1)
free_member_room = attr.ib(type=int)
free_mirror_room = attr.ib(type=int)
re_inline = re.compile("({free_member_room}):({free_mirror_room})(?::)?(.*)".format(
free_member_room="[0-9]+",
free_mirror_room="[0-9]+"))
@classmethod
def from_inline(cls, inline, signature):
try:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment