-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update get_default_modules structure to cleaner format
- Loading branch information
1 parent
8253f5e
commit d78e187
Showing
7 changed files
with
46 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from web3.exceptions import ( | ||
ValidationError, | ||
) | ||
|
||
|
||
def attach_modules(parent_module, module_definitions): | ||
for module_name, module_info in module_definitions.items(): | ||
module_class = module_info[0] | ||
module_class.attach(parent_module, module_name) | ||
|
||
if len(module_info) == 2: | ||
submodule_definitions = module_info[1] | ||
module = getattr(parent_module, module_name) | ||
attach_modules(module, submodule_definitions) | ||
elif len(module_info) != 1: | ||
raise ValidationError("Module definitions can only have 1 or 2 elements.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters