Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pycfhelpers
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Show more breadcrumbs
cellframe
python-cellframe-modules
pycfhelpers
Commits
ce286edf
Commit
ce286edf
authored
1 year ago
by
Dmitry Puzyrkov
Browse files
Options
Downloads
Patches
Plain Diff
[+] added logging module, added net module.
parent
173aa38f
No related branches found
No related tags found
1 merge request
!1
[+] added logging module, added net module.
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
node/logging.py
+18
-0
18 additions, 0 deletions
node/logging.py
node/net.py
+12
-17
12 additions, 17 deletions
node/net.py
with
30 additions
and
17 deletions
node/logging.py
0 → 100644
+
18
−
0
View file @
ce286edf
from
DAP.Core
import
logIt
class
CFLog
:
@staticmethod
def
notice
(
message
:
str
):
logIt
.
notice
(
message
)
@staticmethod
def
warning
(
message
:
str
):
logIt
.
warning
(
message
)
@staticmethod
def
error
(
message
:
str
):
logIt
.
error
(
message
)
This diff is collapsed.
Click to expand it.
node/net.py
+
12
−
17
View file @
ce286edf
from
typing
import
Iterator
from
typing
import
Iterator
,
Callable
from
typing_extensions
import
Self
import
traceback
...
...
@@ -26,13 +27,20 @@ class NetFee:
class
CFNet
:
@staticmethod
def
active_nets
()
->
list
[
Self
]:
return
[
CFNet
(
n
.
getName
())
for
n
in
Net
.
getNets
()]
def
__init__
(
self
,
name
:
str
):
self
.
name
=
name
self
.
_origin_net
=
Net
.
byName
(
name
)
if
not
self
.
_origin_net
:
raise
RuntimeError
(
f
"
No such net:
{
name
}
"
)
self
.
main
=
CFChain
(
self
,
'
main
'
)
self
.
zerochain
=
CFChain
(
self
,
'
zerochain
'
)
self
.
fee_data
=
NetFee
(
self
)
@property
...
...
@@ -44,26 +52,13 @@ class CFNet:
return
[
self
.
main
,
self
.
zerochain
]
@property
#todo: use gdb_groups_prefix from net
def
group_alias
(
self
):
# net_name | group_alias
aliases
=
{
"
mileena
"
:
"
mileena
"
,
"
Backbone
"
:
"
scorpion
"
,
"
KelVPN
"
:
"
kelvpn
"
,
"
kelvpn-minkowski
"
:
"
kelvpn-minkowski
"
,
"
raiden
"
:
"
raiden
"
,
"
subzero
"
:
"
subzero
"
,
}
try
:
return
aliases
[
self
.
name
]
except
KeyError
:
ValueError
(
f
"
Unknown group alias for net
{
self
.
name
}
"
)
def
group_alias
(
self
)
->
str
:
return
self
.
_origin_net
.
gdb_group_alias
def
get_ledger
(
self
):
return
CFLedger
(
self
,
self
.
_origin_net
.
getLedger
())
def
register_gdbsync_notification_callback
(
self
,
callback
,
*
args
,
**
kwargs
):
def
register_gdbsync_notification_callback
(
self
,
callback
:
Callable
,
*
args
,
**
kwargs
):
def
callback_wrapper
(
op_code
,
group
,
key
,
value
,
*
other
):
callback
(
self
,
op_code
,
group
,
key
,
value
,
*
args
,
net
=
self
,
**
kwargs
)
...
...
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