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

ENH: py2js support for additional functions #5713

Merged
merged 5 commits into from Jul 20, 2023

Conversation

roelofsaj
Copy link
Contributor

Refactoring to remove duplicate code and adding translation support for:

  • math.ceil
  • math.floor
  • core.Clock
  • 'delimiter'.join(array)
  • array.pop(): correctly translate with input arguments
  • array.split(): use the correct defaults when no arguments included
  • array.insert()
  • array.sort(reverse=True): correctly translate the 'reverse' keyword parameter

Also add tests for the above translations.

@peircej
Copy link
Member

peircej commented Jul 18, 2023

Thanks @roelofsaj
Looks like the test suite is detecting an issue with this one:
https://github.com/psychopy/psychopy/actions/runs/5545193357/jobs/10123755138?pr=5713

self = <astunparse.unparser.Unparser object at 0x14d4def40>
t = <_ast.Constant object at 0x14d4d9490>

    def _Constant(self, t):
        value = t.value
        if isinstance(value, tuple):
            self.write("(")
            if len(value) == 1:
                self._write_constant(value[0])
                self.write(",")
            else:
                interleave(lambda: self.write(", "), self._write_constant, value)
            self.write(")")
        elif value is Ellipsis: # instead of `...` for Py2 compatibility
            self.write("...")
        else:
>           if t.kind == "u":
E           AttributeError: 'Constant' object has no attribute 'kind'

@roelofsaj
Copy link
Contributor Author

Sorry about that! I was using a newer version of python (3.9), and the tests were passing there. I've installed 3.8, and now I'm seeing the error. I'll try to track it down and fix it today.

@codecov
Copy link

codecov bot commented Jul 18, 2023

Codecov Report

Merging #5713 (dec2527) into dev (d6aec91) will decrease coverage by 52.03%.
The diff coverage is n/a.

❗ Current head dec2527 differs from pull request most recent head 8e936b0. Consider uploading reports for the commit 8e936b0 to get more accurate results

@@            Coverage Diff             @@
##              dev   #5713       +/-   ##
==========================================
- Coverage   52.02%       0   -52.03%     
==========================================
  Files         313       0      -313     
  Lines       58582       0    -58582     
==========================================
- Hits        30480       0    -30480     
+ Misses      28102       0    -28102     
Components Coverage Δ
app ∅ <ø> (∅)
boilerplate ∅ <ø> (∅)
library ∅ <ø> (∅)
vm-safe library ∅ <ø> (∅)

@roelofsaj
Copy link
Contributor Author

I think this fixed it (unless the ubuntu test usually passes?).

@TEParsons
Copy link
Contributor

Don't worry about the Ubuntu tests, they're failing for unrelated reasons... This looks great, happy to pull in :)

@TEParsons TEParsons merged commit 6b36d62 into psychopy:dev Jul 20, 2023
1 of 2 checks passed
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.

None yet

3 participants