Adds a tag namespace filter parameter to LogixDriver for targeted/selective Tag parsing #312
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.
Introduces a new constructor argument tag_namespace_filter to LogixDriver class.
Similar to program/task filtering, this filter applies to all tags that start with a string of user's choice; only tags that start with the provided filter get parsed and created in LogixDriver during initialization.
This filtering can prevent byte parsing errors in applications where there are thousands of tags that may not be relevant for communicating with pycomm3 (e.g. tags that are used on the PLC for internal logic handling purposes).
Before this namespace filter, all tags need to be added to a particular program to be filtered (program attribute is not exposed to the constructor either unfortunately), whereas this PR enables filtering simply by tags' names initial common string.
For example setting tag_namespace_filter = MyFavoriteSetOfTags in an environment where MyFavoriteSetOfTags.Struct1, MyFavoriteSetOfTags.Struct2 etc. exist would enable pycomm3 to only parse Struct1 and Struct2 ignoring all other, potentially irrelevant, tags from being created and parsed during initialization.