Implement automatic Enum conversion for device initialization. Add BK 9140 triple output source. Fix type hints to be compatible with python 3.8. #30
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces a generic mechanism for automatically converting string values to Enum values during device initialization. This change enhances the flexibility and maintainability of the device initialization process.
Key changes:
convert_to_enum
function that attempts to convert string values to appropriate Enum values based on the Enums defined in the device instance.initiaize_device
function to use this conversion for all string arguments, regardless of the method being called or the specific Enum involved.Benefits:
This change maintains backwards compatibility with existing JSON configurations while providing a more flexible and future-proof solution for device initialization.
Python 3.8:
Some older systems in use are on windows 7 with no upgrade path. They are therefore stuck at python 3.8.
this library doesn't benefit from newer python 3.9+ syntax in any meaningful way, therefore reverted some type hints for backwards compatibility. The discovery of the Enum issue resulted from this attempt.
Add Source: Original intent was to add BK 9140 triple output source. This source inherits from but differs from the Keithley in that channel numbers start from zero and several strings for setting the output have different syntax. Added a couple of custom commands for slew rate since it can.
Also added a remote function to the chroma 62000. Note that RWLock is being used in Keithley for remote control, this differs from just remote in that the panel is locked out until released to local. Safe to prevent device tamper, but can be an irritation in development where scripts pause.
Add Manifest.in to make sure that the build of the package always finds all of the subfolder modules when using pip install .