Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
ethereum-package
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
ethereum-package
Commits
fba3f128
Commit
fba3f128
authored
Nov 04, 2022
by
Gyanendra Mishra
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
this looks alright
parent
f6af4e11
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
5 deletions
+17
-5
main.star
main.star
+17
-5
No files found.
main.star
View file @
fba3f128
...
@@ -21,6 +21,7 @@ def replace_with_defaults(input_args):
...
@@ -21,6 +21,7 @@ def replace_with_defaults(input_args):
result = {}
result = {}
for attr in dir(input_args):
for attr in dir(input_args):
value = getattr(input_args, attr)
value = getattr(input_args, attr)
print(attr, value, type(value))
if type(value) == "int" and value == 0:
if type(value) == "int" and value == 0:
result[attr] = default_input[attr]
result[attr] = default_input[attr]
elif type(value) == "string" and value == "":
elif type(value) == "string" and value == "":
...
@@ -33,10 +34,14 @@ def replace_with_defaults(input_args):
...
@@ -33,10 +34,14 @@ def replace_with_defaults(input_args):
result["network_params"][attr_] = default_input["network_params"][attr_]
result["network_params"][attr_] = default_input["network_params"][attr_]
elif type(value_) == "string" and value_ == "":
elif type(value_) == "string" and value_ == "":
result["network_params"][attr_] = default_input["network_params"][attr_]
result["network_params"][attr_] = default_input["network_params"][attr_]
elif attr_ != "descriptor":
# if there are some string, int values we assign it
elif type(value_) in ("int", "string", "bool"):
result["network_params"][attr_] = value_
result["network_params"][attr_] = value_
elif attr == "participants" and value == []:
elif type(value) in "proto.EnumValueDescriptor":
result["participant"] = [default_input["participants"][0]]
result[attr] = value.name
# no participants are assigned at all
elif attr == "participants" and len(value) == 0:
result["participant"] = default_input["participants"]
elif attr == "participants":
elif attr == "participants":
participants = []
participants = []
for participant in participants:
for participant in participants:
...
@@ -47,10 +52,17 @@ def replace_with_defaults(input_args):
...
@@ -47,10 +52,17 @@ def replace_with_defaults(input_args):
participant[attr_] = getattr(default_input[participants][0], attr_, 0)
participant[attr_] = getattr(default_input[participants][0], attr_, 0)
elif type(attr_) == "str" and value_ == "":
elif type(attr_) == "str" and value_ == "":
participant[attr_] = getattr(default_input[participants][0], attr_, "")
participant[attr_] = getattr(default_input[participants][0], attr_, "")
elif type(value_) in ("int", "string", "bool"):
result["participants"][attr_] = value_
elif type(value_) in "proto.EnumValueDescriptor":
result[attr_] = value.name
participants.append(participant)
participants.append(participant)
result["participants"] = participants
result["participants"] = participants
elif attr != "descriptor":
# if there are some string, int values we assign it
result[attr] = default_input[attr]
elif type(value) in ("int", "string", "bool"):
result[attr] = value
elif type(value) in "proto.EnumValueDescriptor":
result[attr] = value.name
encoded_json = json.encode(result)
encoded_json = json.encode(result)
print(json.indent(encoded_json))
print(json.indent(encoded_json))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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