Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
sakia
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
clients
python
sakia
Commits
f3c1f1ae
Commit
f3c1f1ae
authored
9 years ago
by
inso
Browse files
Options
Downloads
Patches
Plain Diff
Fix bug in wot parsing
parent
fc4b58f0
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/cutecoin/core/graph.py
+15
-9
15 additions, 9 deletions
src/cutecoin/core/graph.py
with
15 additions
and
9 deletions
src/cutecoin/core/graph.py
+
15
−
9
View file @
f3c1f1ae
...
@@ -58,17 +58,19 @@ class Graph(object):
...
@@ -58,17 +58,19 @@ class Graph(object):
self
.
add_identity
(
from_identity
)
self
.
add_identity
(
from_identity
)
certifier_list
=
yield
from
from_identity
.
certifiers_of
(
self
.
app
.
identities_registry
,
certifier_list
=
yield
from
from_identity
.
certifiers_of
(
self
.
app
.
identities_registry
,
self
.
community
)
self
.
community
)
self
.
add_certifier_list
(
certifier_list
,
from_identity
,
to_identity
)
yield
from
self
.
add_certifier_list
(
certifier_list
,
from_identity
,
to_identity
)
certified_list
=
yield
from
from_identity
.
certified_by
(
self
.
app
.
identities_registry
,
certified_list
=
yield
from
from_identity
.
certified_by
(
self
.
app
.
identities_registry
,
self
.
community
)
self
.
community
)
self
.
add_certified_list
(
certified_list
,
from_identity
,
to_identity
)
yield
from
self
.
add_certified_list
(
certified_list
,
from_identity
,
to_identity
)
if
to_identity
.
pubkey
not
in
self
.
_graph
.
keys
():
if
to_identity
.
pubkey
not
in
self
.
_graph
.
keys
():
# recursively feed graph searching for account node...
# recursively feed graph searching for account node...
yield
from
self
.
explore_to_find_member
(
to_identity
,
self
.
_graph
[
from_identity
.
pubkey
][
'
connected
'
],
list
())
yield
from
self
.
explore_to_find_member
(
to_identity
,
self
.
_graph
[
from_identity
.
pubkey
][
'
connected
'
],
list
())
if
len
(
self
.
_graph
[
from_identity
.
pubkey
][
'
connected
'
])
>
0
:
if
len
(
self
.
_graph
[
from_identity
.
pubkey
][
'
connected
'
])
>
0
:
# calculate path of nodes between identity and to_identity
# calculate path of nodes between identity and to_identity
path
=
yield
from
self
.
find_shortest_path
(
self
.
_graph
[
from_identity
.
pubkey
],
self
.
_graph
[
to_identity
.
pubkey
])
path
=
yield
from
self
.
find_shortest_path
(
self
.
_graph
[
from_identity
.
pubkey
],
self
.
_graph
[
to_identity
.
pubkey
])
if
path
:
if
path
:
logging
.
debug
([
node
[
'
text
'
]
for
node
in
path
])
logging
.
debug
([
node
[
'
text
'
]
for
node
in
path
])
...
@@ -101,19 +103,21 @@ class Graph(object):
...
@@ -101,19 +103,21 @@ class Graph(object):
identity_selected
=
identity
.
from_handled_data
(
node
[
'
text
'
],
node
[
'
id
'
],
BlockchainState
.
VALIDATED
)
identity_selected
=
identity
.
from_handled_data
(
node
[
'
text
'
],
node
[
'
id
'
],
BlockchainState
.
VALIDATED
)
certifier_list
=
yield
from
identity_selected
.
unique_valid_certifiers_of
(
self
.
app
.
identities_registry
,
certifier_list
=
yield
from
identity_selected
.
unique_valid_certifiers_of
(
self
.
app
.
identities_registry
,
self
.
community
)
self
.
community
)
self
.
add_certifier_list
(
certifier_list
,
identity_selected
,
identity
)
yield
from
self
.
add_certifier_list
(
certifier_list
,
identity_selected
,
identity
)
if
identity
.
pubkey
in
tuple
(
self
.
_graph
.
keys
()):
if
identity
.
pubkey
in
tuple
(
self
.
_graph
.
keys
()):
return
False
return
False
certified_list
=
yield
from
identity_selected
.
unique_valid_certified_by
(
self
.
app
.
identities_registry
,
certified_list
=
yield
from
identity_selected
.
unique_valid_certified_by
(
self
.
app
.
identities_registry
,
self
.
community
)
self
.
community
)
self
.
add_certified_list
(
certified_list
,
identity_selected
,
identity
)
yield
from
self
.
add_certified_list
(
certified_list
,
identity_selected
,
identity
)
if
identity
.
pubkey
in
tuple
(
self
.
_graph
.
keys
()):
if
identity
.
pubkey
in
tuple
(
self
.
_graph
.
keys
()):
return
False
return
False
if
node
[
'
id
'
]
not
in
tuple
(
done
):
if
node
[
'
id
'
]
not
in
tuple
(
done
):
done
.
append
(
node
[
'
id
'
])
done
.
append
(
node
[
'
id
'
])
if
len
(
done
)
>=
len
(
self
.
_graph
):
if
len
(
done
)
>=
len
(
self
.
_graph
):
return
True
return
True
result
=
self
.
explore_to_find_member
(
identity
,
self
.
_graph
[
identity_selected
.
pubkey
][
'
connected
'
],
done
)
result
=
yield
from
self
.
explore_to_find_member
(
identity
,
self
.
_graph
[
identity_selected
.
pubkey
][
'
connected
'
],
done
)
if
not
result
:
if
not
result
:
return
False
return
False
...
@@ -162,9 +166,10 @@ class Graph(object):
...
@@ -162,9 +166,10 @@ class Graph(object):
# new node
# new node
if
certifier
[
'
identity
'
].
pubkey
not
in
self
.
_graph
.
keys
():
if
certifier
[
'
identity
'
].
pubkey
not
in
self
.
_graph
.
keys
():
node_status
=
0
node_status
=
0
is_member
=
yield
from
certifier
[
'
identity
'
].
is_member
(
self
.
community
)
if
certifier
[
'
identity
'
].
pubkey
==
identity_account
.
pubkey
:
if
certifier
[
'
identity
'
].
pubkey
==
identity_account
.
pubkey
:
node_status
+=
NODE_STATUS_HIGHLIGHTED
node_status
+=
NODE_STATUS_HIGHLIGHTED
if
certifier
[
'
identity
'
].
is_member
(
self
.
community
)
is
False
:
if
is_member
is
False
:
node_status
+=
NODE_STATUS_OUT
node_status
+=
NODE_STATUS_OUT
self
.
_graph
[
certifier
[
'
identity
'
].
pubkey
]
=
{
self
.
_graph
[
certifier
[
'
identity
'
].
pubkey
]
=
{
'
id
'
:
certifier
[
'
identity
'
].
pubkey
,
'
id
'
:
certifier
[
'
identity
'
].
pubkey
,
...
@@ -239,9 +244,10 @@ class Graph(object):
...
@@ -239,9 +244,10 @@ class Graph(object):
continue
continue
if
certified
[
'
identity
'
].
pubkey
not
in
self
.
_graph
.
keys
():
if
certified
[
'
identity
'
].
pubkey
not
in
self
.
_graph
.
keys
():
node_status
=
0
node_status
=
0
is_member
=
yield
from
certified
[
'
identity
'
].
is_member
(
self
.
community
)
if
certified
[
'
identity
'
].
pubkey
==
identity_account
.
pubkey
:
if
certified
[
'
identity
'
].
pubkey
==
identity_account
.
pubkey
:
node_status
+=
NODE_STATUS_HIGHLIGHTED
node_status
+=
NODE_STATUS_HIGHLIGHTED
if
certified
[
'
identity
'
].
is_member
(
self
.
community
)
is
False
:
if
is_member
is
False
:
node_status
+=
NODE_STATUS_OUT
node_status
+=
NODE_STATUS_OUT
self
.
_graph
[
certified
[
'
identity
'
].
pubkey
]
=
{
self
.
_graph
[
certified
[
'
identity
'
].
pubkey
]
=
{
'
id
'
:
certified
[
'
identity
'
].
pubkey
,
'
id
'
:
certified
[
'
identity
'
].
pubkey
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment