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

Add get_all_symbols function #155

Merged
merged 12 commits into from
Oct 1, 2020
Merged

Conversation

chrisjbremner
Copy link
Contributor

I was looking for a way to retrieve all symbol information and came across #124, indicating this was not a feature. I searched the ADS repo for AdsReadSymbolInfo which #124 implies exists, but I could not find it.

The ability to read symbols was a feature I had used before in the counsyl-pyads package, so I decided to port over the logic. There's also logic in that package that allows you to read a symbol by name, but I decided against adding that for now unless there's a request to do so.

Here's a sample when tested with a PLC running TC3:

>>> symbols=plc.get_all_symbols()
>>> print('\n'.join("%s: %s" % item for item in vars(symbols[0]).items()))
index_group: 16448
index_offset: 384800
name: Constants.bFPUSupport
symtype: BOOL
comment: Does the target support multiple cores?

You may also notice that the import ordering was slightly modified to be in alphabetical order by isort. If this is not a desired change, I can revert it.

@coveralls
Copy link

coveralls commented Sep 19, 2020

Pull Request Test Coverage Report for Build 462

  • 41 of 41 (100.0%) changed or added relevant lines in 4 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.3%) to 92.549%

Totals Coverage Status
Change from base Build 449: 0.3%
Covered Lines: 795
Relevant Lines: 859

💛 - Coveralls

@coveralls
Copy link

Pull Request Test Coverage Report for Build 453

  • 17 of 47 (36.17%) changed or added relevant lines in 4 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-3.1%) to 89.057%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pyads/utils.py 2 3 66.67%
pyads/structs.py 3 8 37.5%
pyads/ads.py 8 32 25.0%
Totals Coverage Status
Change from base Build 449: -3.1%
Covered Lines: 765
Relevant Lines: 859

💛 - Coveralls

Copy link
Owner

@stlehmann stlehmann left a comment

Choose a reason for hiding this comment

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

Thanks for the PR. I find this to be a useful feature. So far it looks good for me. Please have a look at my review for minor change requests. Of course there also need to be some tests and documentation for the new feature. Would you like to take care of these, too?

pyads/ads.py Outdated Show resolved Hide resolved
pyads/constants.py Outdated Show resolved Hide resolved
pyads/utils.py Outdated Show resolved Hide resolved
@@ -32,6 +32,7 @@
PLCTYPE_DT,
PLCTYPE_DWORD,
PLCTYPE_INT,
PLCTYPE_LINT,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I noticed that this was missing from the imports. Not strictly needed for this PR, so I can remove it from here if you'd prefer it in a separate PR.

Copy link
Owner

Choose a reason for hiding this comment

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

Never mind. This is just a small import. No need to make a separate PR for it.

@chrisjbremner
Copy link
Contributor Author

Thanks for taking a look, I've addressed your comments and added some tests and some documentation to the quickstart guide.

Regarding the import re-ordering, let me know if you'd prefer me to open a separate PR for reordering imports or if you'd like to leave it as is.

Copy link
Owner

@stlehmann stlehmann left a comment

Choose a reason for hiding this comment

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

Looks great. Would you mind adding an entry to the Changelog. Then the PR is ready to merge.

pyads/utils.py Show resolved Hide resolved
@chrisjbremner
Copy link
Contributor Author

Thanks for taking a look. I'm not able to merge, so feel free to do so yourself when you get a chance.

@stlehmann stlehmann merged commit 6561c53 into stlehmann:master Oct 1, 2020
@stlehmann
Copy link
Owner

Thanks @chrisjbremner for the great work 👍

@chrisbeardy
Copy link
Collaborator

this is a great contribution!!!!

@chrisjbremner
Copy link
Contributor Author

@stlehmann could I request a new release that incorporates this addition?

@stlehmann
Copy link
Owner

@chrisjbremner Yes, I think now is a good time for a new major release. I will get to it.

@stlehmann
Copy link
Owner

Release 3.3.0 is out.

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.

4 participants