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
Remove unnecessary functions from CodePrinter
(50 lines)
#1864
base: devel
Are you sure you want to change the base?
Conversation
Hello again! Thank you for this new pull request 🤩. Please begin by requesting your checklist using the command |
Here is your checklist. Please tick items off when you have completed them or determined that they are not necessary for this pull request:
|
/bot run docs coverage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There seems to be lines in this PR which aren't tested. Please take a look at my comments and add tests which cover the new code.
If this is modified code which cannot be easily tested in this PR please open an issue to request that this code be either removed or tested. Once you have done that please leave a message on the relevant conversation beginning with the line /bot accept
and referencing the issue.
Similarly if the new code cannot be tested for some reason, please leave a comment beginning with the line /bot accept
on the relevant conversation explaining why the code can't be tested.
@@ -887,8 +883,8 @@ def _get_print_format_and_arg(self, var, var_code = None): | |||
|
|||
def _print_SymbolicPrint(self, expr): | |||
# for every expression we will generate a print | |||
code = '\n'.join("print *, 'sympy> {}'".format(a) for a in expr.expr) | |||
return self._get_statement(code) + '\n' | |||
code = '\n'.join(f"print *, 'sympy> {a}'" for a in expr.expr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code isn't tested. Please can you take a look
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/bot accept
Known problem with symbolic code. See #330
@@ -2247,17 +2243,17 @@ | |||
body = ''.join(self._print(i) for i in expr.body) | |||
|
|||
# ... TODO adapt get_statement to have continuation with OpenACC | |||
prolog = '!$acc parallel {clauses}\n'.format(clauses=clauses) | |||
prolog = f'!$acc parallel {clauses}\n' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code isn't tested. Please can you take a look
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/bot accept
See #1514
code = ('{prolog}' | ||
'{body}' | ||
'{epilog}').format(prolog=prolog, body=body, epilog=epilog) | ||
code = (f'{prolog}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code isn't tested. Please can you take a look
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/bot accept
See #1514
@@ -2266,17 +2262,17 @@ | |||
# ... | |||
|
|||
# ... TODO adapt get_statement to have continuation with OpenACC | |||
prolog = '!$acc loop {clauses}\n'.format(clauses=clauses) | |||
prolog = f'!$acc loop {clauses}\n' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code isn't tested. Please can you take a look
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/bot accept
See #1514
code = ('{prolog}' | ||
'{loop}' | ||
'{epilog}').format(prolog=prolog, loop=loop, epilog=epilog) | ||
code = (f'{prolog}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code isn't tested. Please can you take a look
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/bot accept
See #1514
@@ -456,9 +463,9 @@ def _print_Assign(self, expr): | |||
local_vars = [str(x) for x in local_vars] | |||
|
|||
if lhs_code in local_vars: | |||
return ("local %s = %s" % (lhs_code, rhs_code)) | |||
return f"local {lhs_code} = {rhs_code}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code isn't tested. Please can you take a look
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/bot accept
Luacode has no associated tests. Code is probably obsolete
There was a problem hiding this 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.
Hey @pyccel/pyccel-dev ! @EmilyBourne has just created this great new pull request! Check it out and let me know what you think! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks Good.
Hey @yguclu, @EmilyBourne, this PR is looking pretty good. @EmilyBourne and @mustapha-belbiad 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 😄 |
CodePrinter
CodePrinter
(50 lines)
Remove
_get_comment
and_get_statement
fromCodePrinter
._get_comment
is unused and_get_statement
returns the string that is passed to it. Additionally some docstrings and f-strings are added.