Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update python generate_addresses to be more Pythonic #26

Merged
merged 8 commits into from
Apr 3, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Improve implementation
  • Loading branch information
Dr-Electron committed Mar 31, 2023
commit e39d0008ecaf65434bf1c4301514c49da8222c1a
16 changes: 6 additions & 10 deletions sdk/src/client/bindings/python/iota_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,9 @@ def generate_addresses(self,
-------
Addresses as array of strings.
"""
options = locals()
options = dict(locals())
del options['self']
del options['secret_manager']

options = {k:v for k,v in options.items() if v != self.__default}

Expand All @@ -218,17 +220,11 @@ def generate_addresses(self,
if is_start_set or is_end_set:
options['range'] = {}
if is_start_set:
options['range']['start'] = options['start']
del options['start']
options['range']['start'] = options.pop('start')
if is_end_set:
options['range']['end'] = options['end']
del options['end']
options['range']['end'] = options.pop('end')
if 'ledger_nano_prompt' in options:
options['options'] = { 'ledger_nano_prompt': options['ledger_nano_prompt']}
del options['ledger_nano_prompt']

del options['self']
del options['secret_manager']
options['options'] = { 'ledger_nano_prompt': options.pop('ledger_nano_prompt')}

options = humps.camelize(options)

Expand Down