Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ift
NIFTy
Commits
120a0998
Commit
120a0998
authored
Jun 25, 2018
by
Martin Reinecke
Browse files
more tweaks
parent
7c4c2af0
Pipeline
#31776
failed with stages
in 55 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
nifty5/domain_tuple.py
View file @
120a0998
...
...
@@ -68,8 +68,6 @@ class DomainTuple(object):
"""
if
isinstance
(
domain
,
DomainTuple
):
return
domain
if
isinstance
(
domain
,
dict
):
return
domain
domain
=
DomainTuple
.
_parse_domain
(
domain
)
obj
=
DomainTuple
.
_tupleCache
.
get
(
domain
)
if
obj
is
not
None
:
...
...
@@ -126,8 +124,9 @@ class DomainTuple(object):
return
self
.
_dom
.
__hash__
()
def
__eq__
(
self
,
x
):
if
not
isinstance
(
x
,
DomainTuple
):
x
=
DomainTuple
.
make
(
x
)
if
self
is
x
:
return
True
x
=
DomainTuple
.
make
(
x
)
return
self
is
x
def
__ne__
(
self
,
x
):
...
...
@@ -140,9 +139,10 @@ class DomainTuple(object):
return
self
.
__eq__
(
x
)
def
unitedWith
(
self
,
x
):
if
not
isinstance
(
x
,
DomainTuple
):
x
=
DomainTuple
.
make
(
x
)
if
self
!=
x
:
if
self
is
x
:
return
self
x
=
DomainTuple
.
make
(
x
)
if
self
is
not
x
:
raise
ValueError
(
"domain mismatch"
)
return
self
...
...
nifty5/multi/multi_domain.py
View file @
120a0998
...
...
@@ -75,8 +75,9 @@ class MultiDomain(frozendict):
return
obj
def
__eq__
(
self
,
x
):
if
not
isinstance
(
x
,
MultiDomain
):
x
=
MultiDomain
.
make
(
x
)
if
self
is
x
:
return
True
x
=
MultiDomain
.
make
(
x
)
return
self
is
x
def
__ne__
(
self
,
x
):
...
...
@@ -86,21 +87,23 @@ class MultiDomain(frozendict):
return
super
(
MultiDomain
,
self
).
__hash__
()
def
compatibleTo
(
self
,
x
):
if
not
isinstance
(
x
,
MultiDomain
):
x
=
MultiDomain
.
make
(
x
)
if
self
is
x
:
return
True
x
=
MultiDomain
.
make
(
x
)
if
(
self
,
x
)
in
MultiDomain
.
_compatCache
:
return
True
commonKeys
=
set
(
self
.
keys
())
&
set
(
x
.
keys
())
for
key
in
commonKeys
:
if
self
[
key
]
!=
x
[
key
]:
if
self
[
key
]
is
not
x
[
key
]:
return
False
MultiDomain
.
_compatCache
.
add
((
self
,
x
))
MultiDomain
.
_compatCache
.
add
((
x
,
self
))
return
True
def
subsetOf
(
self
,
x
):
if
not
isinstance
(
x
,
MultiDomain
):
x
=
MultiDomain
.
make
(
x
)
if
self
is
x
:
return
True
x
=
MultiDomain
.
make
(
x
)
if
(
self
,
x
)
in
MultiDomain
.
_subsetCache
:
return
True
if
len
(
x
)
==
0
:
...
...
@@ -109,15 +112,16 @@ class MultiDomain(frozendict):
for
key
in
self
.
keys
():
if
key
not
in
x
:
return
False
if
self
[
key
]
!=
x
[
key
]:
if
self
[
key
]
is
not
x
[
key
]:
return
False
MultiDomain
.
_subsetCache
.
add
((
self
,
x
))
return
True
def
unitedWith
(
self
,
x
):
if
not
isinstance
(
x
,
MultiDomain
):
x
=
MultiDomain
.
make
(
x
)
if
self
==
x
:
if
self
is
x
:
return
self
x
=
MultiDomain
.
make
(
x
)
if
self
is
x
:
return
self
if
not
self
.
compatibleTo
(
x
):
raise
ValueError
(
"domain mismatch"
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment