Skip to content

CircuitPython API Compatibility and Bugfixes #1

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 4 commits into from
Jan 29, 2021

Conversation

brentru
Copy link
Member

@brentru brentru commented Jan 27, 2021

This pull request:

  • Removes methods which rely on a native call to time.strftime.

    • CircuitPython's time module does not implement strftime
    • ctime() added to datetime so users can still do string-format-y things.
  • Fix an OverflowError within timestamps on ESP32-S2

  • gmtime() not implemented within CircuitPython time API (add gmtime() to time module circuitpython#1663) - raise error where appropriate.

  • Examples and tests modified to reflect the changes above.

  • Fix broken tzinfo.__new__ call.

  • Tested on Adafruit CircuitPython 6.1.0-beta.2 on 2020-12-03; MagTag with ESP32S2

@brentru brentru requested a review from a team January 27, 2021 22:37
Copy link

@askpatrickw askpatrickw left a comment

Choose a reason for hiding this comment

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

I used this PR in a project and it worked.

offset_adjusted_dt = datetime.fromtimestamp(timestamp) - timedelta(hours=abs(offset_hours))
            return offset_adjusted_dt.isoformat()

I ran the examples and they worked.
I ran the tests and there were 44 skips. If that's expected, it looks good to me.

python -m unittest test_datetime.py 
..s.ss...s..ssss..s.s...ss..s.sssssssssss...sssss..ss..ssssssss..s.s..s.ss.
----------------------------------------------------------------------
Ran 75 tests in 0.014s

OK (skipped=44)

@brentru
Copy link
Member Author

brentru commented Jan 29, 2021

@askpatrickw Thanks! Could you mark this as "Approved" ?

@askpatrickw
Copy link

@brentru Are the skips all valid and OK?

@brentru
Copy link
Member Author

brentru commented Jan 29, 2021

@askpatrickw Yep. This library implements a subset of datetime, and some portions of datetime aren't possible yet (i.e: CircuitPython time API doesn't support gmtime, strftime)

Copy link

@askpatrickw askpatrickw left a comment

Choose a reason for hiding this comment

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

Skips explained by Brent. Thanks!

@brentru brentru merged commit ffa0ec0 into adafruit:master Jan 29, 2021
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