Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
beem
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
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
hive
beem
Commits
a546dc36
Commit
a546dc36
authored
4 years ago
by
Mariusz Trela
Browse files
Options
Downloads
Patches
Plain Diff
Extensions fix in `update_proposal` operation
parent
4b44fa5e
No related branches found
No related tags found
1 merge request
!3
Update branch + fix regarding `update_proposal` operation
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
beembase/objects.py
+15
-14
15 additions, 14 deletions
beembase/objects.py
beemgraphenebase/types.py
+8
-3
8 additions, 3 deletions
beemgraphenebase/types.py
with
23 additions
and
17 deletions
beembase/objects.py
+
15
−
14
View file @
a546dc36
...
...
@@ -336,7 +336,7 @@ class UpdateProposalEndDate(GrapheneObject):
super
(
UpdateProposalEndDate
,
self
).
__init__
(
OrderedDict
([
(
'
end_date
'
,
PointInTime
(
kwargs
[
'
update_proposal_
end_date
'
])),
(
'
end_date
'
,
PointInTime
(
kwargs
[
'
end_date
'
])),
]))
...
...
@@ -347,25 +347,26 @@ class UpdateProposalExtensions(Static_variant):
Example::
[1,
{
'
end_date
'
:
'
2021-03-28T04:00:00
'
}
]
{
'
type
'
:
'
1
'
,
'
value
'
:
{
'
end_date
'
:
'
2021-04-05T13:39:48
'
}
}
"""
def
__init__
(
self
,
o
):
if
type
(
o
)
==
dict
and
'
type
'
in
o
and
'
value
'
in
o
:
if
o
[
'
type
'
]
==
"
end_date
"
:
type_id
=
1
else
:
type_id
=
~
0
data
=
o
[
'
value
'
]
else
:
type_id
,
data
=
o
if
isinstance
(
o
,
dict
)
and
'
type
'
in
o
and
'
value
'
in
o
:
if
o
[
'
type
'
]
==
"
update_proposal_end_date
"
:
type_id
=
1
else
:
type_id
=
~
0
if
type_id
==
1
:
data
=
(
UpdateProposalEndDate
(
data
))
data
=
(
UpdateProposalEndDate
(
o
[
'
value
'
]
))
else
:
raise
Exception
(
"
Unknown UpdateProposalExtension
"
)
super
(
UpdateProposalExtensions
,
self
).
__init__
(
data
,
type_id
)
super
(
UpdateProposalExtensions
,
self
).
__init__
(
data
,
type_id
,
False
)
This diff is collapsed.
Click to expand it.
beemgraphenebase/types.py
+
8
−
3
View file @
a546dc36
...
...
@@ -347,18 +347,23 @@ class Optional(object):
class
Static_variant
(
object
):
def
__init__
(
self
,
d
,
type_id
):
def
__init__
(
self
,
d
,
type_id
,
legacy_style
=
True
):
self
.
data
=
d
self
.
type_id
=
type_id
#`legacy_style = True` it means, that static variant is treated like an array, otherwise like an object
self
.
legacy_style
=
legacy_style
def
__bytes__
(
self
):
"""
Returns bytes representation.
"""
return
varint
(
self
.
type_id
)
+
py23_bytes
(
self
.
data
)
def
__str__
(
self
):
"""
Returns data as string.
"""
return
json
.
dumps
([
self
.
type_id
,
self
.
data
.
json
()])
if
self
.
legacy_style
:
return
json
.
dumps
([
self
.
type_id
,
self
.
data
.
json
()])
else
:
return
json
.
dumps
({
'
type
'
:
self
.
type_id
,
'
value
'
:
self
.
data
.
json
()
})
class
Map
(
object
):
def
__init__
(
self
,
data
):
...
...
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