Skip to content

Annotation fixes in circuitplayground_base and bluefruit.py #118

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

Merged
merged 13 commits into from
Aug 8, 2022
Merged

Annotation fixes in circuitplayground_base and bluefruit.py #118

merged 13 commits into from
Aug 8, 2022

Conversation

tcfranks
Copy link
Contributor

@tcfranks tcfranks commented Jul 8, 2022

No description provided.

@tcfranks
Copy link
Contributor Author

tcfranks commented Jul 8, 2022

LMK how this looks....

Copy link
Member

@tekktrik tekktrik 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 submission! I added my feedback below, let me know if you have any questions!

@tcfranks
Copy link
Contributor Author

wow, that was a lot to take in. pylint is throwing complaints about line endings, but the last big one it's choking on is:
adafruit_circuitplayground\circuit_playground_base.py:149:26: E1101: Module 'os' has no 'uname' member; maybe 'name'? (no-member)
which refers to this line:
if (
"nRF52840" in os.uname().machine

Clearly uname() returns a namedtuple that includes machine, so why is pylint kicking this out? Any suggestions?

@tekktrik
Copy link
Member

tekktrik commented Jul 17, 2022

CPython uses os.name but CircuitPython uses os.uname. We could disable it at that point, but I wonder if pylint stops complaining once the typing stubs are imported (something the CI may do).

When you push code, git should be fixing the line endings for you. They are different between Linux and Windows, so my guess is that you're developing on windows where the line ending is CRLF, but git prefers LF. If you push the code, it should get automatically resolved, and then I can give it another review, as well as see whether that remaining pylint error goes away.

@Neradoc
Copy link
Contributor

Neradoc commented Jul 17, 2022

CPython uses os.name but CircuitPython uses os.uname. We could disable it at that point, but I wonder if pylint stops complaining once the typing stubs are imported (something the CI may do).

Note that os.uname is C python: https://docs.python.org/3/library/os.html#os.uname
It's a little weird though, it's not available on windows, only Unix, so that might be the issue here. Or pylint is being weird.

@tekktrik
Copy link
Member

tekktrik commented Jul 17, 2022

Oh neat, good point, and thanks for that correction! I think pylint can also lint based on your version of Python (won't flag things if it was added in a later version of Python), so it may be something similar with regards to the operating system.

It sounds like this might just be a good time to push the code to this branch and see what still remains to be done. We can even give those suggestions as comments to the lines.

Copy link
Member

@tekktrik tekktrik left a comment

Choose a reason for hiding this comment

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

Nice! A few more things and then this should be good to go!

@@ -8,13 +8,13 @@
# pylint: disable=too-many-instance-attributes, too-many-lines

"""
`adafruit_circuitplayground.circuit_playground_base`
'adafruit_circuitplayground.circuit_playground_base'
Copy link
Member

@tekktrik tekktrik Jul 18, 2022

Choose a reason for hiding this comment

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

These uses of ticks (`) are used intentionally for formatting, you should change this and the other ones below back to that so the formatting and links will show appropriately.

Copy link
Member

Choose a reason for hiding this comment

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

It looks like these should be reverted back to ticks (`)

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 thought I did? tick to the left of #1 ?

Copy link
Member

@tekktrik tekktrik Jul 25, 2022

Choose a reason for hiding this comment

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

Here it should be reverted back to:

Suggested change
'adafruit_circuitplayground.circuit_playground_base'
`adafruit_circuitplayground.circuit_playground_base`

@tekktrik tekktrik self-requested a review July 21, 2022 03:49
Copy link
Member

@tekktrik tekktrik left a comment

Choose a reason for hiding this comment

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

Few more changes but should be good after that!

@@ -33,6 +33,12 @@
import neopixel
import touchio

try:
from typing import Literal, Optional, Iterator
Copy link
Member

@tekktrik tekktrik Jul 25, 2022

Choose a reason for hiding this comment

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

I always forget that Literal wasn't added to typing until Python 3.8. Since we support Python 3.7 as the minimum version, which means for development as well, let's import it Literal from typing_extensions instead. You can remove the Literal import here and add this as a line below:

    from typing_extensions import Literal

Make sure you add typing-extensions~=4.0 as a dependency in setup.py and requirements.txt to ensure it gets downloaded as well. Let me know if you need help doing that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

clue about setup.py would be nice. All I see is setup.py.disabled. Is that because of Pycharm?

Copy link
Member

Choose a reason for hiding this comment

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

You'll need to update this branch to the latest main branch, that file has been deleted and since replaced with setup.py in a recent pull request.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, got that update now. is it added as just a simple import in setup.py? or some other way?

Copy link
Member

Choose a reason for hiding this comment

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

You add it to the list of install_requires in setup()

    install_requires=[
        "adafruit-circuitpython-lis3dh",
        "adafruit-circuitpython-thermistor",
        "adafruit-circuitpython-neopixel",
        "typing-extensions~=4.0",
    ],

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it threw a number error after adding this line, and went back to just dying when I removed "~=4.0". All pylint is showing me locally is that it does not like the uname function of os, in addition to the line ending errors.

Not sure if you can see what specifically is choking it here.....

@@ -8,13 +8,13 @@
# pylint: disable=too-many-instance-attributes, too-many-lines

"""
`adafruit_circuitplayground.circuit_playground_base`
'adafruit_circuitplayground.circuit_playground_base'
Copy link
Member

Choose a reason for hiding this comment

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

It looks like these should be reverted back to ticks (`)

@tekktrik tekktrik self-assigned this Jul 25, 2022
@tekktrik
Copy link
Member

Looks like you'll need to run pre-commit, fix setup.py, and revert to using those tick marks!

@tcfranks
Copy link
Contributor Author

tcfranks commented Aug 1, 2022

hmmm
black didn't like requirements.txt
the process didn't like the way black changed it.
I put the important bits back they way they were and re-checked it and apparently all is good. LMK

@tcfranks
Copy link
Contributor Author

tcfranks commented Aug 1, 2022

also, I run pylint and black manually. I downloaded and installed precommit but for some reason on my windows box it won't run as a unit, in spite of having looked at path, etc. any ideas, besides running linux? :)

@tcfranks
Copy link
Contributor Author

tcfranks commented Aug 1, 2022

oh duh. well - I think I just solved the pre-commit problem.....we'll see next time I need to use it.

@tekktrik tekktrik merged commit 66606f7 into adafruit:main Aug 8, 2022
@tekktrik tekktrik mentioned this pull request Aug 8, 2022
16 tasks
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Aug 9, 2022
Updating https://github.com/adafruit/Adafruit_CircuitPython_CircuitPlayground to 5.2.5 from 5.2.4:
  > Merge pull request adafruit/Adafruit_CircuitPython_CircuitPlayground#118 from tcfranks/main
  > Added Black formatting badge

Updating https://github.com/adafruit/Adafruit_CircuitPython_Seesaw to 1.11.3 from 1.11.2:
  > Switched to pyproject.toml
  > Added Black formatting badge

Updating https://github.com/adafruit/Adafruit_CircuitPython_HTTPServer to 0.4.0 from 0.3.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_HTTPServer#11 from karlfl/AddBufferSizeProperty
  > Changed .env to .venv in README.rst
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