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

Remove ct validation when active validation is disabled (#269) #271

Merged
merged 5 commits into from
Nov 2, 2023

Conversation

markheik
Copy link
Collaborator

@markheik markheik commented Oct 20, 2023

Description:

To improve CommandTable creation and usage, do not validate it during as_dict().

Introduces is_valid() method compensate for optional validation.

Removed unnecessary deepcopy of schemas for speed improvement

The following script is 10x faster than with copying:

for i in range(100):
      ct.table[i].waveform.index = I

Fixes issue: #269

Checklist:

  • Add tests for the change to show correct behavior.
  • Add or update relevant docs, code and examples.
  • Update CHANGELOG.rst with relevant information and add the issue number.
  • Add .. versionchanged:: where necessary.

* Do not validate command table in as_dict() when active validation is off
* is_valid() can be used to validate the command table
@markheik markheik self-assigned this Oct 20, 2023
@markheik markheik changed the title Markush/remove ct validation when disabled Remove ct validation when active validation is disabled (#269) Oct 20, 2023
@codecov
Copy link

codecov bot commented Oct 20, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (7e7bccb) 99.60% compared to head (c610f09) 99.61%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #271   +/-   ##
=======================================
  Coverage   99.60%   99.61%           
=======================================
  Files          40       40           
  Lines        2552     2567   +15     
=======================================
+ Hits         2542     2557   +15     
  Misses         10       10           
Files Coverage Δ
src/zhinst/toolkit/command_table.py 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@markheik markheik marked this pull request as draft October 23, 2023 08:25
@markheik markheik changed the title Remove ct validation when active validation is disabled (#269) Draft: Remove ct validation when active validation is disabled (#269) Oct 23, 2023
@markheik markheik force-pushed the markush/remove_ct_validation_when_disabled branch from 08894d5 to 8207d5e Compare November 2, 2023 12:01
@markheik markheik requested a review from tobiasah November 2, 2023 12:03
@@ -442,8 +447,13 @@
)

def _table_entry(self) -> ListEntry:
schema = copy.deepcopy(self._ct_schema["definitions"]["table"])
index_schema = schema["items"]["properties"].pop("index")

Check failure

Code scanning / CodeQL

Modification of parameter with default Error

This expression mutates a
default value
.
@markheik markheik changed the title Draft: Remove ct validation when active validation is disabled (#269) Remove ct validation when active validation is disabled (#269) Nov 2, 2023
* Remove unnecessary deepcopy of table index schemas to improve performance
@markheik markheik force-pushed the markush/remove_ct_validation_when_disabled branch from 5da96b4 to c610f09 Compare November 2, 2023 12:16
@markheik markheik marked this pull request as ready for review November 2, 2023 12:32
@markheik markheik merged commit e082c54 into main Nov 2, 2023
12 of 13 checks passed
@markheik markheik deleted the markush/remove_ct_validation_when_disabled branch November 2, 2023 12:32
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.

2 participants