ESCOMP / CISM

Community Ice Sheet Model
GNU Lesser General Public License v3.0
6 stars 11 forks source link

Some python files have python2 type style statements #49

Open ekluzek opened 2 years ago

ekluzek commented 2 years ago

I found this running the python reformatter "black" on all of CTSM telling it to target python-3.7 and it pointed out the following files have python 2 type print statements so wouldn't work with python-3. Fixing it would be simple just changing lines with

print "thing"

to

print( "thing" )

so the fix is straight-forward.

components/cism/source_cism/tests/dome/netCDF.py: components/cism/source_cism/tests/halfar/halfar_results.py: components/cism/source_cism/tests/halfar/netCDF.py: components/cism/source_cism/tests/ismip-hom/netCDF.py: components/cism/source_cism/tests/ismip-hom/plotISMIP_HOM.py: components/cism/source_cism/tests/MISMIP3d/mismip3d.code/mismip3dRun.py: components/cism/source_cism/tests/MISMIP3d/mismip3d.code/mismip3dSetup.py: components/cism/source_cism/tests/MISMIP3d/mismip3d.code/mismip3dWriteGL.py: components/cism/source_cism/tests/MISMIP/mismip.code/mismipPlotGL.py: components/cism/source_cism/tests/MISMIP/mismip.code/mismipRun.py: components/cism/source_cism/tests/MISMIP/mismip.code/mismipSetup.py: components/cism/source_cism/tests/MISMIP/mismip.code/mismipWriteGL.py: components/cism/source_cism/tests/MISOMIP/mismip+/mismip+Run.py: components/cism/source_cism/tests/MISOMIP/mismip+/mismip+Setup.py: components/cism/source_cism/tests/MISOMIP/mismip+/mismip+WriteGL.py: components/cism/source_cism/tests/netCDF.py: components/cism/source_cism/tests/new/netCDF.py: components/cism/source_cism/tests/ross/netCDF.py: components/cism/source_cism/tests/ross/plotRoss.py: components/cism/source_cism/tests/shelf/netCDF.py: components/cism/source_cism/tests/slab/netCDF.py: components/cism/source_cism/tests/slab/plotSlab.py: components/cism/source_cism/tests/stream/netCDF.py: components/cism/source_cism/tests/unsupported/exact-isothermal/scripts/create_test.py: components/cism/source_cism/tests/unsupported/exact-isothermal/scripts/plot_verif.py: components/cism/source_cism/tests/unsupported/exact-isothermal/scripts/run_verif.py: components/cism/source_cism/tests/viewNetCDF.py: components/cism/source_cism/utils/f90_dependency_tool/f90_dependencies.py:

gunterl commented 2 years ago

Hi Erik,

Yes we are aware of this and we will take care of this soon. The print statements are not the only ones, there are some config parser calls as well that need to be checked. Is this a pressing issue? If so I can take care of it next week. Please assign this issue to me.

Thanks

Gunter

On Sat, Dec 11, 2021 at 3:02 PM Erik Kluzek @.***> wrote:

I found this running the python reformatter on all of CTSM telling it to target python-3.7 and it pointed out the following files have python 2 type print statements so wouldn't work with python-3. Fixing it would be simple just changing lines with

print "thing"

to

print( "thing" )

so the fix is straight-forward.

components/cism/source_cism/tests/dome/netCDF.py: components/cism/source_cism/tests/halfar/halfar_results.py: components/cism/source_cism/tests/halfar/netCDF.py: components/cism/source_cism/tests/ismip-hom/netCDF.py: components/cism/source_cism/tests/ismip-hom/plotISMIP_HOM.py: components/cism/source_cism/tests/MISMIP3d/mismip3d.code/mismip3dRun.py: components/cism/source_cism/tests/MISMIP3d/mismip3d.code/mismip3dSetup.py:

components/cism/source_cism/tests/MISMIP3d/mismip3d.code/mismip3dWriteGL.py: components/cism/source_cism/tests/MISMIP/mismip.code/mismipPlotGL.py: components/cism/source_cism/tests/MISMIP/mismip.code/mismipRun.py: components/cism/source_cism/tests/MISMIP/mismip.code/mismipSetup.py: components/cism/source_cism/tests/MISMIP/mismip.code/mismipWriteGL.py: components/cism/source_cism/tests/MISOMIP/mismip+/mismip+Run.py: components/cism/source_cism/tests/MISOMIP/mismip+/mismip+Setup.py: components/cism/source_cism/tests/MISOMIP/mismip+/mismip+WriteGL.py: components/cism/source_cism/tests/netCDF.py: components/cism/source_cism/tests/new/netCDF.py: components/cism/source_cism/tests/ross/netCDF.py: components/cism/source_cism/tests/ross/plotRoss.py: components/cism/source_cism/tests/shelf/netCDF.py: components/cism/source_cism/tests/slab/netCDF.py: components/cism/source_cism/tests/slab/plotSlab.py: components/cism/source_cism/tests/stream/netCDF.py:

components/cism/source_cism/tests/unsupported/exact-isothermal/scripts/create_test.py:

components/cism/source_cism/tests/unsupported/exact-isothermal/scripts/plot_verif.py:

components/cism/source_cism/tests/unsupported/exact-isothermal/scripts/run_verif.py: components/cism/source_cism/tests/viewNetCDF.py: components/cism/source_cism/utils/f90_dependency_tool/f90_dependencies.py:

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ESCOMP/CISM/issues/49, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB6QV6CLR6RYYKPPUSVNWS3UQPDAFANCNFSM5J3PAIGQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

-- Gunter Leguy, Ph.D (he/him) Project Scientist National Center for Atmospheric Research cell: (575) 418 1021 desk: (303) 497 1790

ekluzek commented 2 years ago

@gunterl OK I assigned it to you as asked. From my perspective this isn't a pressing issue as I know of no problems with this. If any of this python code is run with python3 it will fail, so it could be important for that reason. It looks like most of these are for tests so might not be regularly run. python2 is no longer supported, it's still around on some machines however, so you can sometimes work around that.

Being able to easily catch this does make me want to recommend the use of the black python formatter though. I will add that.

So bottom line -- no not pressing.