Avoid x.__preserve__(), preferring preserve(x)
This commit is contained in:
parent
ed518a9c71
commit
f348701169
|
@ -297,7 +297,7 @@ def encode(p, v):
|
||||||
if p.key == DICTOF:
|
if p.key == DICTOF:
|
||||||
return dict((encode(p[0], k), encode(p[1], w)) for (k, w) in v.items())
|
return dict((encode(p[0], k), encode(p[1], w)) for (k, w) in v.items())
|
||||||
if p.key == REF:
|
if p.key == REF:
|
||||||
return v.__preserve__()
|
return preserve(v)
|
||||||
if p.key == REC:
|
if p.key == REC:
|
||||||
return Record(encode(p[0], v), encode(p[1], v))
|
return Record(encode(p[0], v), encode(p[1], v))
|
||||||
if p.key == TUPLE:
|
if p.key == TUPLE:
|
||||||
|
@ -433,8 +433,8 @@ if __name__ == '__main__':
|
||||||
with open(__metaschema_filename, 'rb') as f:
|
with open(__metaschema_filename, 'rb') as f:
|
||||||
x = Decoder(f.read()).next()
|
x = Decoder(f.read()).next()
|
||||||
print(meta.Schema.decode(x))
|
print(meta.Schema.decode(x))
|
||||||
print(meta.Schema.decode(x).__preserve__())
|
print(preserve(meta.Schema.decode(x)))
|
||||||
assert meta.Schema.decode(x).__preserve__() == x
|
assert preserve(meta.Schema.decode(x)) == x
|
||||||
|
|
||||||
@extend(meta.Schema)
|
@extend(meta.Schema)
|
||||||
def f(self, x):
|
def f(self, x):
|
||||||
|
@ -450,7 +450,7 @@ if __name__ == '__main__':
|
||||||
x = Decoder(f.read()).next()
|
x = Decoder(f.read()).next()
|
||||||
print(meta.Schema.decode(x))
|
print(meta.Schema.decode(x))
|
||||||
assert meta.Schema.decode(x) == meta.Schema.decode(x)
|
assert meta.Schema.decode(x) == meta.Schema.decode(x)
|
||||||
assert meta.Schema.decode(x).__preserve__() == x
|
assert preserve(meta.Schema.decode(x)) == x
|
||||||
|
|
||||||
print()
|
print()
|
||||||
print(path)
|
print(path)
|
||||||
|
|
|
@ -5,7 +5,7 @@ except ImportError:
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="preserves",
|
name="preserves",
|
||||||
version="0.10.0",
|
version="0.10.1",
|
||||||
author="Tony Garnock-Jones",
|
author="Tony Garnock-Jones",
|
||||||
author_email="tonyg@leastfixedpoint.com",
|
author_email="tonyg@leastfixedpoint.com",
|
||||||
license="Apache Software License",
|
license="Apache Software License",
|
||||||
|
|
Loading…
Reference in New Issue