Skip to content

Conversation

notmgsk
Copy link
Contributor

@notmgsk notmgsk commented Mar 8, 2021

Description

Provide a better error message when qc.run(binary, memory_map=...) includes:

  • reference to undefined memory name; or
  • more parameter values than are expected

Checklist

  • The above description motivates these changes.
  • There is a unit test that covers these changes.
  • All new and existing tests pass locally and on Travis CI.
  • Parameters and return values have type hints with PEP 484 syntax.
  • Functions and classes have useful Sphinx-style docstrings.
  • All code follows Black style and obeys flake8 conventions.
  • (New Feature) The docs have been updated accordingly.
  • (Bugfix) The associated issue is referenced above using auto-close keywords.
  • The changelog is updated, including author and PR number (@username, gh-xxx).

if k.name not in patch_values:
raise KeyError(f"{k.name} is not one of the valid memory descriptors: {patch_values.keys()}")
if k.index >= len(patch_values[k.name]):
raise IndexError(f"{k.name} has more parameter values ({k.index}) than expected ({len(patch[k.name])})")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is len(patch[k.name]) supposed to be len(patch_values[k.name])?

On that note, it could be worth adding a simple test case. Even with 3.x in the works, 2.x will be in use for a long tail

@ameyer-rigetti
Copy link
Contributor

@notmgsk Are you still interested in having this merged?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants