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

Clean PythonCodePrinter and add dtype property #1260

Merged
merged 58 commits into from
Aug 15, 2023
Merged

Clean PythonCodePrinter and add dtype property #1260

merged 58 commits into from
Aug 15, 2023

Conversation

EmilyBourne
Copy link
Member

@EmilyBourne EmilyBourne commented Dec 14, 2022

Remove the duplicate _print_NumpyArray function from PythonCodePrinter. The original _print_NumpyArray function is more accurate as it specifies the dtype etc explicitly.
Specifying the dtype explicitly makes issue #1377 reproducible. To fix this problem support is added for a.dtype expressions (Fixes #1421) using the similar function np.result_type. The initialisation dtype is saved and used in the Python printer. This is a work-around until #1334 is resolved well enough to define a clear issue. Additionally a warning is raised if the Python code is not consistent. Fixes #1377

Additional commits

  • Simplify bot linux/windows/macosx output to reduce duplication. Change regex for C now that the test is no longer verbose.
  • Stop generating numpy.bool in code as it has been deprecated by NumPy. Instead use the default bool (with precision -1).
  • Add support for NumPy's short type names
  • Reduce duplication in the Python printer
  • Remove outdated skips on tests
  • Stop array error tests failing in developer mode

@EmilyBourne EmilyBourne added the blocked Cannot be solved/merged until something else is fixed label Dec 14, 2022
@EmilyBourne EmilyBourne changed the title Add tests for fortran ordered arrays Fix fortran ordered array wrapping Dec 16, 2022
@EmilyBourne
Copy link
Member Author

This PR doesn't need to fix #1258 as it is fixed in #1280. The tests are migrated there. The tiny change remaining in this PR is preserved

@EmilyBourne EmilyBourne changed the title Fix fortran ordered array wrapping Remove duplicate _print_NumpyArray function from PythonCodePrinter Jul 28, 2023
@EmilyBourne EmilyBourne removed the blocked Cannot be solved/merged until something else is fixed label Jul 28, 2023
@EmilyBourne EmilyBourne reopened this Jul 28, 2023
@pyccel-bot
Copy link

pyccel-bot bot commented Jul 28, 2023

Hello again! Thank you for this new pull request 🤩.

Here is your checklist. Please tick items off when you have completed them or determined that they are not necessary for this pull request:

  • Write a clear PR description
  • Add tests to check your code works as expected
  • Update documentation if necessary
  • Update Changelog
  • Ensure any relevant issues are linked
  • Ensure new tests are passing

@EmilyBourne EmilyBourne marked this pull request as ready for review July 28, 2023 11:15
@github-actions github-actions bot marked this pull request as draft July 28, 2023 11:30
@pyccel-bot
Copy link

pyccel-bot bot commented Jul 28, 2023

Unfortunately your PR is not passing the tests so it is not quite ready for review yet. Let me know when it is fixed with /bot mark as ready.

@EmilyBourne
Copy link
Member Author

/bot run linux

This was linked to issues Aug 1, 2023
@EmilyBourne
Copy link
Member Author

/bot run docs

@EmilyBourne
Copy link
Member Author

/bot run pr_tests

Copy link

@pyccel-bot pyccel-bot bot left a comment

Choose a reason for hiding this comment

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

Good job ! Your PR is using all the code it added/changed.

@pyccel-bot pyccel-bot bot added Ready_for_review Received at least one approval. Requires review from senior developer and removed Ready_for_review Received at least one approval. Requires review from senior developer labels Aug 7, 2023
@pyccel-bot
Copy link

pyccel-bot bot commented Aug 7, 2023

Hey @yguclu, @EmilyBourne, this PR is looking pretty good. @EmilyBourne and @sboof911 think it is ready to merge. Could you add your expertise to confirm that this follows all the coding conventions and fits in Pyccel's future plans? Thanks 😄

@EmilyBourne EmilyBourne changed the title Remove duplicate _print_NumpyArray function from PythonCodePrinter Clean PythonCodePrinter and add dtype property Aug 11, 2023
Copy link
Member

@yguclu yguclu left a comment

Choose a reason for hiding this comment

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

This looks good to me! I have a few comments and questions.

pyccel/codegen/printing/ccode.py Outdated Show resolved Hide resolved
pyccel/codegen/printing/ccode.py Outdated Show resolved Hide resolved
pyccel/codegen/printing/ccode.py Outdated Show resolved Hide resolved
pyccel/ast/numpyext.py Outdated Show resolved Hide resolved
pyccel/ast/numpyext.py Outdated Show resolved Hide resolved
pyccel/codegen/printing/pycode.py Outdated Show resolved Hide resolved
pyccel/codegen/printing/pycode.py Outdated Show resolved Hide resolved
pyccel/codegen/printing/pycode.py Outdated Show resolved Hide resolved
@github-actions github-actions bot marked this pull request as draft August 14, 2023 08:28
@pyccel-bot pyccel-bot bot removed the Ready_for_review Received at least one approval. Requires review from senior developer label Aug 14, 2023
@pyccel-bot
Copy link

pyccel-bot bot commented Aug 14, 2023

@EmilyBourne, @yguclu has a few questions/comments about your code. Can you go through and see if you agree with them. If not go ahead and explain why. Once you've adressed all the comments let me know with /bot mark as ready and we will see if we can get approval.

@EmilyBourne EmilyBourne marked this pull request as ready for review August 14, 2023 09:18
Copy link

@pyccel-bot pyccel-bot bot left a comment

Choose a reason for hiding this comment

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

Good job ! Your PR is using all the code it added/changed.

@pyccel-bot pyccel-bot bot added the Ready_for_review Received at least one approval. Requires review from senior developer label Aug 14, 2023
@pyccel-bot
Copy link

pyccel-bot bot commented Aug 14, 2023

@yguclu, @EmilyBourne has been working hard and thinks that they have now replied to or fixed all your comments. Could you take another look at the PR and see if you can approve now?

@pyccel-bot pyccel-bot bot requested a review from yguclu August 14, 2023 09:40
@pyccel-bot pyccel-bot bot added Ready_to_merge Approved by senior developer. Ready for final approval and merge and removed Ready_for_review Received at least one approval. Requires review from senior developer labels Aug 15, 2023
@yguclu yguclu merged commit 3964466 into devel Aug 15, 2023
13 checks passed
@yguclu yguclu deleted the devel-issue1258 branch August 15, 2023 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ready_to_merge Approved by senior developer. Ready for final approval and merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add dtype property to arrays Test not failing consistently
3 participants