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

Apply some Pylint fixes #1448

Draft
wants to merge 117 commits into
base: devel
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 115 commits
Commits
Show all changes
117 commits
Select commit Hold shift + click to select a range
89dc06b
[PYLINT] Unused imports
EmilyBourne Jul 17, 2023
ce1186d
[PYLINT] consider-using-f-string
EmilyBourne Jul 18, 2023
0586ea9
Correct syntax error
EmilyBourne Jul 18, 2023
d30a931
Correction
EmilyBourne Jul 18, 2023
1bf4720
Corrections
EmilyBourne Jul 18, 2023
a3ea161
Fixes
EmilyBourne Jul 18, 2023
9960773
Merge remote-tracking branch 'origin/devel' into ebourne_codacy
EmilyBourne Jul 25, 2023
583b94b
Rename fst parameter containing ast node to ast in Basic.
EmilyBourne Jul 25, 2023
976b1e1
Correct override
EmilyBourne Jul 25, 2023
e5b9870
Complete renaming
EmilyBourne Jul 25, 2023
64c691e
Merge remote-tracking branch 'origin/devel' into ebourne_codacy
EmilyBourne Aug 2, 2023
3aa362a
Correct setter syntax
EmilyBourne Aug 2, 2023
6a63f0d
Improve docstrings and pylint errors
EmilyBourne Aug 3, 2023
c5fd874
Improve docstrings
EmilyBourne Aug 3, 2023
09cdee4
Remove unnecessary dtype argument from Declare
EmilyBourne Aug 3, 2023
de5e66c
Missing import
EmilyBourne Aug 3, 2023
6269ed8
Improve some docstrings
EmilyBourne Aug 8, 2023
d0328da
Fix dtype collection
EmilyBourne Aug 8, 2023
7f23d78
Merge remote-tracking branch 'origin/devel' into ebourne_codacy
EmilyBourne Aug 8, 2023
63ffc05
More formats
EmilyBourne Aug 8, 2023
6f41e5a
Whitespace
EmilyBourne Aug 8, 2023
c2fa38d
Missing init
EmilyBourne Aug 8, 2023
cdf8f38
Unused import
EmilyBourne Aug 8, 2023
29f2108
Keep PyccelOperator for correct slots
EmilyBourne Aug 8, 2023
27c6c01
Merge branch 'devel' into ebourne_codacy
EmilyBourne Aug 14, 2023
3b262b9
Merge branch 'devel' into ebourne_codacy
EmilyBourne Aug 15, 2023
c33da54
Remove untested undocumented code
EmilyBourne Aug 8, 2023
5253c76
Improve doc strings
EmilyBourne Aug 8, 2023
b9c7d7c
Docstrings
EmilyBourne Aug 8, 2023
a1f34ee
Missing point
EmilyBourne Aug 8, 2023
98c3bc3
Merge branch 'devel' into ebourne_codacy
EmilyBourne Sep 17, 2023
170c186
Correct variable name
EmilyBourne Sep 17, 2023
61f6835
Unused import
EmilyBourne Sep 17, 2023
17ed3e0
Unused imports
EmilyBourne Sep 17, 2023
3359bce
Move to correct version
EmilyBourne Sep 17, 2023
b3fc3b3
Use f-strings
EmilyBourne Sep 17, 2023
960dc70
Remove useless 'get_statement' function
EmilyBourne Sep 17, 2023
437972e
Remove useless 'get_comment' function
EmilyBourne Sep 17, 2023
896a77e
Remove dead code. Use f-strings
EmilyBourne Sep 17, 2023
4966442
Add missing return
EmilyBourne Sep 17, 2023
b5c1b68
Correct join args
EmilyBourne Sep 17, 2023
ace93bc
Correct function
EmilyBourne Sep 17, 2023
5b054c2
Fix mistakes
EmilyBourne Sep 17, 2023
cd04741
Fix mistake
EmilyBourne Sep 17, 2023
63b434a
Removed dtype argument from Declare
EmilyBourne Sep 17, 2023
2527d2c
Use f strings
EmilyBourne Sep 17, 2023
fe67230
Capitalise Python
EmilyBourne Sep 17, 2023
e96da42
Unused import, unused variable. Mistakes
EmilyBourne Sep 17, 2023
700f670
Capitalise Python
EmilyBourne Sep 17, 2023
7a52362
Unused imports
EmilyBourne Sep 17, 2023
844bc6f
Ensure method can be parsed
EmilyBourne Sep 17, 2023
196afed
Append results
EmilyBourne Sep 17, 2023
c6bae1b
Correct docstring
EmilyBourne Sep 17, 2023
047fdf8
Remove dead code
EmilyBourne Sep 17, 2023
73deb8b
Fix bugs
EmilyBourne Sep 17, 2023
83edfc4
Missing f
EmilyBourne Sep 17, 2023
4f1bd72
Add docstrings. Remove dead code.
EmilyBourne Sep 17, 2023
3ceb347
Remove dead code
EmilyBourne Sep 17, 2023
7474881
Docstrings
EmilyBourne Sep 17, 2023
0020653
Docstrings
EmilyBourne Sep 17, 2023
6ea61bf
Docstrings
EmilyBourne Sep 17, 2023
80e0243
Merge branch 'devel' into ebourne_codacy
EmilyBourne Sep 18, 2023
5110250
Don't use arg parameter
EmilyBourne Sep 17, 2023
eb95633
Merge branch 'devel' into ebourne_codacy
EmilyBourne Oct 6, 2023
a8fafa5
Unused imports
EmilyBourne Oct 6, 2023
d638940
Unused variable
EmilyBourne Oct 6, 2023
4fae2ff
Merge branch 'devel' into ebourne_codacy
EmilyBourne Oct 23, 2023
e65a1ab
Fix merge
EmilyBourne Oct 23, 2023
4db78b2
Fix docstrings
EmilyBourne Oct 23, 2023
b1255f3
Docstrings
EmilyBourne Oct 23, 2023
b7715eb
Merge remote-tracking branch 'origin/devel' into ebourne_codacy
EmilyBourne Oct 24, 2023
d81766f
Fix docstrings
EmilyBourne Oct 24, 2023
6b7bc5a
Fix docstrings
EmilyBourne Oct 24, 2023
1f1e15e
Add basic docs
EmilyBourne Oct 24, 2023
24eb9ed
Fix docstring errors
EmilyBourne Oct 24, 2023
936e265
Fix docstring errors
EmilyBourne Oct 24, 2023
123634e
Fix docstrings
EmilyBourne Oct 24, 2023
7947328
Fix docstring
EmilyBourne Oct 24, 2023
2d795a1
Remove unused function
EmilyBourne Oct 24, 2023
3140dfd
Fix docstring
EmilyBourne Oct 24, 2023
29fa356
Add docstrings. Remove unnecessary functions
EmilyBourne Oct 24, 2023
7f28983
Fix docstrings
EmilyBourne Oct 24, 2023
120f42c
Add missing docstrings
EmilyBourne Oct 24, 2023
794c726
Merge remote-tracking branch 'origin/devel' into ebourne_codacy
EmilyBourne Oct 30, 2023
9a3ac17
Fix docstrings
EmilyBourne Oct 30, 2023
7f993a1
Correct CHANGELOG
EmilyBourne Oct 30, 2023
f0ac85d
Reorder args
EmilyBourne Oct 30, 2023
6434b38
Fix merge
EmilyBourne Oct 30, 2023
ce3e5e2
Improve CHANGELOG
EmilyBourne Oct 30, 2023
3fc7faa
Fix infinite loop
EmilyBourne Oct 30, 2023
db9eddb
Fix print
EmilyBourne Oct 30, 2023
648a0e4
Fix silly errors
EmilyBourne Oct 30, 2023
4c88024
Fix printing
EmilyBourne Oct 30, 2023
266ed41
Merge branch 'devel' into ebourne_codacy
EmilyBourne Nov 4, 2023
0dc6e8c
Merge branch 'devel' into ebourne_codacy
EmilyBourne Nov 9, 2023
f7fe483
Correct CHANGELOG
EmilyBourne Nov 9, 2023
749164a
Handle BindCClassDef separately
EmilyBourne Nov 9, 2023
4fd61c6
Merge remote-tracking branch 'origin/devel' into ebourne_codacy
EmilyBourne Jan 5, 2024
760de91
Fix stupid bugs
EmilyBourne Jan 5, 2024
3090913
Fix name
EmilyBourne Jan 5, 2024
f4be175
Fix use of FunctionDefResult
EmilyBourne Jan 5, 2024
0017b92
Merge remote-tracking branch 'origin/devel' into ebourne_codacy
EmilyBourne Apr 9, 2024
b73ffc1
Fix merge
EmilyBourne Apr 9, 2024
0c0a29d
No need to change docs
EmilyBourne Apr 9, 2024
f1f9b8c
Fix merge
EmilyBourne Apr 9, 2024
280d3ed
Merge fixes
EmilyBourne Apr 9, 2024
715b340
Clean up annotation printing
EmilyBourne Apr 9, 2024
f9e4a05
Fix merge
EmilyBourne Apr 9, 2024
5622011
Correct join usage
EmilyBourne Apr 9, 2024
dc6b3ce
Fix merge
EmilyBourne Apr 9, 2024
d0e368e
Correct print
EmilyBourne Apr 9, 2024
736e062
Fix type
EmilyBourne Apr 9, 2024
c362bef
Correct printer
EmilyBourne Apr 9, 2024
3980c35
Missing f
EmilyBourne Apr 9, 2024
b1be40a
Merge remote-tracking branch 'origin/devel' into ebourne_codacy
EmilyBourne Apr 9, 2024
f968c08
Merge branch 'devel' into ebourne_codacy
EmilyBourne Apr 11, 2024
04ae8dc
Merge remote-tracking branch 'origin/devel' into ebourne_codacy
EmilyBourne May 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ All notable changes to this project will be documented in this file.
- \[INTERNALS\] Remove `ast.basic.TypedAstNode._dtype`. The datatype can still be accessed as it is contained within the class type.
- \[INTERNALS\] Removed unused and undocumented function `get_function_from_ast`.
- \[INTERNALS\] Remove unused parameters `expr`, `status` and `like` from `pyccel.ast.core.Assign`.
- \[INTERNALS\] Remove unnecessary functions from `CodePrinter` : `_get_statement`, `_get_comment`.

## \[1.11.2\] - 2024-03-05

Expand Down
24 changes: 15 additions & 9 deletions pyccel/ast/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,6 @@ class CodeBlock(PyccelAstNode):
__slots__ = ('_body','_unravelled')
_attribute_nodes = ('_body',)


def __init__(self, body, unravelled = False):
ls = []
for i in body:
Expand Down Expand Up @@ -716,15 +715,21 @@ def rhs(self):


class SymbolicAssign(PyccelAstNode):
"""
Represents symbolic aliasing for code generation.

"""Represents symbolic aliasing for code generation. An alias is any statement of the
Represents symbolic aliasing for code generation. An alias is any statement of the
form `lhs := rhs` where

This code needs investigating to find out if it is still useful.

Parameters
----------
lhs : PyccelSymbol
Why not a Variable? To be investigated.

rhs : Range
Apparently a range.

Examples
--------
Expand All @@ -734,7 +739,6 @@ class SymbolicAssign(PyccelAstNode):
>>> r = Range(0, 3)
>>> y = PyccelSymbol('y')
>>> SymbolicAssign(y, r)

"""
__slots__ = ('_lhs', '_rhs')
_attribute_nodes = ('_lhs', '_rhs')
Expand All @@ -745,7 +749,7 @@ def __init__(self, lhs, rhs):
super().__init__()

def __str__(self):
return '{0} := {1}'.format(str(self.lhs), str(self.rhs))
return f'{self.lhs} := {self.rhs}'

@property
def lhs(self):
Expand Down Expand Up @@ -3728,7 +3732,7 @@ def __init__(self, source, target = None, ignore_at_print = False, mod = None):

self._source = source
self._target = set()
self._source_mod = mod
self._source_mod = mod
self._ignore_at_print = ignore_at_print
if target is None:
if pyccel_stage == "syntactic":
Expand Down Expand Up @@ -3806,7 +3810,7 @@ def __str__(self):
if len(self.target) == 0:
return f'import {source}'
else:
target = ', '.join([str(i) for i in self.target])
target = ', '.join(str(i) for i in self.target)
return f'from {source} import {target}'

def define_target(self, new_target):
Expand Down Expand Up @@ -4046,13 +4050,15 @@ class Raise(PyccelAstNode):


class SymbolicPrint(PyccelAstNode):
"""
Represents a print function of symbolic expressions in the code.

"""Represents a print function of symbolic expressions in the code.
Represents a print function of symbolic expressions in the code.

Parameters
----------
expr : TypedAstNode
The expression to print
The expression to print.

Examples
--------
Expand All @@ -4072,7 +4078,7 @@ def __init__(self, expr):
for i in expr:
if not isinstance(i, (Lambda, SymbolicAssign,
SympyFunction)):
raise TypeError('Expecting Lambda, SymbolicAssign, SympyFunction for {}'.format(i))
raise TypeError(f'Expecting Lambda, SymbolicAssign, SympyFunction for {i}')

self._expr = expr

Expand Down
8 changes: 4 additions & 4 deletions pyccel/codegen/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def execute_pyccel(fname, *,
# Unified way to handle errors: print formatted error message, then move
# to original working directory. Caller should then raise exception.
def handle_error(stage):
print('\nERROR at {} stage'.format(stage))
print(f'\nERROR at {stage} stage')
errors.check()
os.chdir(base_dirpath)

Expand Down Expand Up @@ -283,7 +283,7 @@ def handle_error(stage):
output_file = (output_name + '.py') if output_name else os.path.basename(fname)
new_location = os.path.join(folder, output_file)
if verbose:
print("cp {} {}".format(fname, new_location))
print(f"cp {fname} {new_location}")
shutil.copyfile(fname, new_location)

# Change working directory back to starting point
Expand Down Expand Up @@ -432,7 +432,7 @@ def get_module_dependencies(parser, deps):
shutil.move(generated_filepath, target)
generated_filepath = target
if verbose:
print( '> Shared library has been created: {}'.format(generated_filepath))
print( '> Shared library has been created:', generated_filepath)

if codegen.is_program:
generated_program_filename = os.path.basename(generated_program_filepath)
Expand All @@ -441,7 +441,7 @@ def get_module_dependencies(parser, deps):
generated_program_filepath = target

if verbose:
print( '> Executable has been created: {}'.format(generated_program_filepath))
print( '> Executable has been created:', generated_program_filepath)

# Print all warnings now
if errors.has_warnings():
Expand Down
Loading
Loading