How to get rid of pep8 error E266 in FEM?

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
User avatar
bernd
Posts: 8046
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

How to get rid of pep8 error E266 in FEM?

Postby bernd » Sun Jun 16, 2019 9:37 pm

I am a big fan of code formating. One pep8 style guide error seams to create a conflict with some other code documenting system. Any thoughts around how to get rid of these double ## for code documentation system?

Code: Select all

$ find src/Mod/Fem/ -name "*\.py" | grep -v InitGui.py | xargs -I [] flake8 --select=E266 []

Code: Select all

src/Mod/Fem/feminout/importZ88O2Results.py:27:1: E266 too many leading '#' for block comment
src/Mod/Fem/feminout/writeFenicsXML.py:28:1: E266 too many leading '#' for block comment
src/Mod/Fem/feminout/importYamlJsonMesh.py:27:1: E266 too many leading '#' for block comment
src/Mod/Fem/feminout/importFenicsMesh.py:27:1: E266 too many leading '#' for block comment
src/Mod/Fem/feminout/importVTKResults.py:29:1: E266 too many leading '#' for block comment
src/Mod/Fem/feminout/writeFenicsXDMF.py:38:1: E266 too many leading '#' for block comment
src/Mod/Fem/feminout/importCcxDatResults.py:27:1: E266 too many leading '#' for block comment
src/Mod/Fem/feminout/importInpMesh.py:28:1: E266 too many leading '#' for block comment
src/Mod/Fem/feminout/importToolsFem.py:27:1: E266 too many leading '#' for block comment
src/Mod/Fem/feminout/readFenicsXDMF.py:27:1: E266 too many leading '#' for block comment
src/Mod/Fem/feminout/importZ88Mesh.py:27:1: E266 too many leading '#' for block comment
src/Mod/Fem/feminout/readFenicsXML.py:28:1: E266 too many leading '#' for block comment
src/Mod/Fem/feminout/importCcxFrdResults.py:29:1: E266 too many leading '#' for block comment
src/Mod/Fem/feminout/convert2TetGen.py:35:1: E266 too many leading '#' for block comment
src/Mod/Fem/feminout/convert2TetGen.py:344:1: E266 too many leading '#' for block comment
src/Mod/Fem/ObjectsFem.py:27:1: E266 too many leading '#' for block comment
src/Mod/Fem/ObjectsFem.py:722:1: E266 too many leading '#' for block comment
src/Mod/Fem/femguiobjects/_ViewProviderFemElementFluid1D.py:29:1: E266 too many leading '#' for block comment
src/Mod/Fem/femguiobjects/_ViewProviderFemElementRotation1D.py:27:1: E266 too many leading '#' for block comment
src/Mod/Fem/femguiobjects/_ViewProviderFemConstraintInitialFlowVelocity.py:27:1: E266 too many leading '#' for block comment
src/Mod/Fem/femguiobjects/_TaskPanelFemSolverControl.py:27:1: E266 too many leading '#' for block comment
src/Mod/Fem/femguiobjects/_TaskPanelFemSolverControl.py:340:1: E266 too many leading '#' for block comment
src/Mod/Fem/femguiobjects/_ViewProviderFemMeshGmsh.py:27:1: E266 too many leading '#' for block comment
src/Mod/Fem/femguiobjects/_ViewProviderFemConstraintElectrostaticPotential.py:27:1: E266 too many leading '#' for block comment
src/Mod/Fem/femguiobjects/FemSelectionWidgets.py:28:1: E266 too many leading '#' for block comment
src/Mod/Fem/femguiobjects/_ViewProviderFemElementGeometry1D.py:27:1: E266 too many leading '#' for block comment
src/Mod/Fem/femguiobjects/ViewProviderFemConstraint.py:28:1: E266 too many leading '#' for block comment
src/Mod/Fem/femguiobjects/_ViewProviderFemMeshResult.py:27:1: E266 too many leading '#' for block comment
src/Mod/Fem/femguiobjects/_ViewProviderFemMeshGroup.py:27:1: E266 too many leading '#' for block comment
src/Mod/Fem/femguiobjects/_ViewProviderFemConstraintSelfWeight.py:27:1: E266 too many leading '#' for block comment
src/Mod/Fem/femguiobjects/_ViewProviderFemMeshRegion.py:27:1: E266 too many leading '#' for block comment
src/Mod/Fem/femguiobjects/_ViewProviderFemSolverCalculix.py:27:1: E266 too many leading '#' for block comment
src/Mod/Fem/femguiobjects/_ViewProviderFemMaterialReinforced.py:26:1: E266 too many leading '#' for block comment
src/Mod/Fem/femguiobjects/_ViewProviderFemMaterialMechanicalNonlinear.py:27:1: E266 too many leading '#' for block comment
src/Mod/Fem/femguiobjects/_ViewProviderFemMeshBoundaryLayer.py:27:1: E266 too many leading '#' for block comment
src/Mod/Fem/femguiobjects/_ViewProviderFemConstraintBodyHeatSource.py:27:1: E266 too many leading '#' for block comment
src/Mod/Fem/femguiobjects/_ViewProviderFemConstraintBodyHeatSource.py:38:1: E266 too many leading '#' for block comment
src/Mod/Fem/femguiobjects/_ViewProviderFemConstraintFlowVelocity.py:27:1: E266 too many leading '#' for block comment
src/Mod/Fem/femguiobjects/_ViewProviderFemMaterial.py:27:1: E266 too many leading '#' for block comment
src/Mod/Fem/femguiobjects/_ViewProviderFemResultMechanical.py:27:1: E266 too many leading '#' for block comment
src/Mod/Fem/femguiobjects/_ViewProviderFemElementGeometry2D.py:27:1: E266 too many leading '#' for block comment
src/Mod/Fem/femsolver/elmer/solver.py:26:1: E266 too many leading '#' for block comment
src/Mod/Fem/femsolver/elmer/solver.py:100:1: E266 too many leading '#' for block comment
src/Mod/Fem/femsolver/elmer/sifio.py:26:1: E266 too many leading '#' for block comment
src/Mod/Fem/femsolver/elmer/sifio.py:446:1: E266 too many leading '#' for block comment
src/Mod/Fem/femsolver/elmer/writer.py:26:1: E266 too many leading '#' for block comment
src/Mod/Fem/femsolver/elmer/writer.py:788:1: E266 too many leading '#' for block comment
src/Mod/Fem/femsolver/elmer/tasks.py:26:1: E266 too many leading '#' for block comment
src/Mod/Fem/femsolver/elmer/tasks.py:147:1: E266 too many leading '#' for block comment
src/Mod/Fem/femsolver/elmer/equations/flow.py:26:1: E266 too many leading '#' for block comment
src/Mod/Fem/femsolver/elmer/equations/flow.py:51:1: E266 too many leading '#' for block comment
src/Mod/Fem/femsolver/elmer/equations/nonlinear.py:26:1: E266 too many leading '#' for block comment
src/Mod/Fem/femsolver/elmer/equations/nonlinear.py:66:1: E266 too many leading '#' for block comment
src/Mod/Fem/femsolver/elmer/equations/elasticity.py:26:1: E266 too many leading '#' for block comment
src/Mod/Fem/femsolver/elmer/equations/elasticity.py:70:1: E266 too many leading '#' for block comment
src/Mod/Fem/femsolver/elmer/equations/heat.py:26:1: E266 too many leading '#' for block comment
src/Mod/Fem/femsolver/elmer/equations/heat.py:51:1: E266 too many leading '#' for block comment
src/Mod/Fem/femsolver/elmer/equations/electrostatic.py:26:1: E266 too many leading '#' for block comment
src/Mod/Fem/femsolver/elmer/equations/electrostatic.py:72:1: E266 too many leading '#' for block comment
src/Mod/Fem/femsolver/elmer/equations/fluxsolver.py:26:1: E266 too many leading '#' for block comment
src/Mod/Fem/femsolver/elmer/equations/fluxsolver.py:79:1: E266 too many leading '#' for block comment
src/Mod/Fem/femsolver/elmer/equations/linear.py:26:1: E266 too many leading '#' for block comment
src/Mod/Fem/femsolver/elmer/equations/linear.py:110:1: E266 too many leading '#' for block comment
src/Mod/Fem/femsolver/elmer/equations/equation.py:26:1: E266 too many leading '#' for block comment
src/Mod/Fem/femsolver/elmer/equations/equation.py:113:1: E266 too many leading '#' for block comment
src/Mod/Fem/femsolver/calculix/solver.py:26:1: E266 too many leading '#' for block comment
src/Mod/Fem/femsolver/calculix/writer.py:27:1: E266 too many leading '#' for block comment
src/Mod/Fem/femsolver/calculix/writer.py:1784:1: E266 too many leading '#' for block comment
src/Mod/Fem/femsolver/calculix/tasks.py:27:1: E266 too many leading '#' for block comment
src/Mod/Fem/femsolver/calculix/tasks.py:252:1: E266 too many leading '#' for block comment
src/Mod/Fem/femsolver/fenics/fenics_tools.py:26:1: E266 too many leading '#' for block comment
src/Mod/Fem/femsolver/fenics/fenics_tools.py:276:1: E266 too many leading '#' for block comment
src/Mod/Fem/femsolver/equationbase.py:26:1: E266 too many leading '#' for block comment
src/Mod/Fem/femsolver/equationbase.py:118:1: E266 too many leading '#' for block comment
src/Mod/Fem/femsolver/run.py:26:1: E266 too many leading '#' for block comment
src/Mod/Fem/femsolver/run.py:525:1: E266 too many leading '#' for block comment
src/Mod/Fem/femsolver/task.py:26:1: E266 too many leading '#' for block comment
src/Mod/Fem/femsolver/task.py:148:1: E266 too many leading '#' for block comment
src/Mod/Fem/femsolver/reportdialog.py:26:1: E266 too many leading '#' for block comment
src/Mod/Fem/femsolver/reportdialog.py:73:1: E266 too many leading '#' for block comment
src/Mod/Fem/femsolver/solverbase.py:26:1: E266 too many leading '#' for block comment
src/Mod/Fem/femsolver/solverbase.py:118:1: E266 too many leading '#' for block comment
src/Mod/Fem/femsolver/settings.py:27:1: E266 too many leading '#' for block comment
src/Mod/Fem/femsolver/settings.py:169:1: E266 too many leading '#' for block comment
src/Mod/Fem/femsolver/signal.py:26:1: E266 too many leading '#' for block comment
src/Mod/Fem/femsolver/signal.py:34:1: E266 too many leading '#' for block comment
src/Mod/Fem/femsolver/report.py:26:1: E266 too many leading '#' for block comment
src/Mod/Fem/femsolver/report.py:96:1: E266 too many leading '#' for block comment
src/Mod/Fem/femsolver/z88/solver.py:26:1: E266 too many leading '#' for block comment
src/Mod/Fem/femsolver/z88/solver.py:92:1: E266 too many leading '#' for block comment
src/Mod/Fem/femsolver/z88/writer.py:26:1: E266 too many leading '#' for block comment
src/Mod/Fem/femsolver/z88/writer.py:393:1: E266 too many leading '#' for block comment
src/Mod/Fem/femsolver/z88/tasks.py:26:1: E266 too many leading '#' for block comment
src/Mod/Fem/femsolver/z88/tasks.py:208:1: E266 too many leading '#' for block comment
src/Mod/Fem/femsolver/writerbase.py:26:1: E266 too many leading '#' for block comment
src/Mod/Fem/femsolver/writerbase.py:446:1: E266 too many leading '#' for block comment
src/Mod/Fem/femmesh/gmshtools.py:27:1: E266 too many leading '#' for block comment
src/Mod/Fem/femmesh/gmshtools.py:763:1: E266 too many leading '#' for block comment
src/Mod/Fem/femmesh/femmesh2mesh.py:27:1: E266 too many leading '#' for block comment
src/Mod/Fem/femmesh/meshtools.py:27:1: E266 too many leading '#' for block comment
src/Mod/Fem/femmesh/meshtools.py:2414:1: E266 too many leading '#' for block comment
src/Mod/Fem/femobjects/_FemMeshRegion.py:27:1: E266 too many leading '#' for block comment
src/Mod/Fem/femobjects/_FemMeshGmsh.py:27:1: E266 too many leading '#' for block comment
src/Mod/Fem/femobjects/_FemMeshResult.py:27:1: E266 too many leading '#' for block comment
src/Mod/Fem/femobjects/_FemConstraintFlowVelocity.py:27:1: E266 too many leading '#' for block comment
src/Mod/Fem/femobjects/_FemResultMechanical.py:27:1: E266 too many leading '#' for block comment
src/Mod/Fem/femobjects/_FemElementRotation1D.py:27:1: E266 too many leading '#' for block comment
src/Mod/Fem/femobjects/FemConstraint.py:27:1: E266 too many leading '#' for block comment
src/Mod/Fem/femobjects/FemConstraint.py:38:1: E266 too many leading '#' for block comment
src/Mod/Fem/femobjects/_FemMaterial.py:27:1: E266 too many leading '#' for block comment
src/Mod/Fem/femobjects/_FemConstraintBodyHeatSource.py:27:1: E266 too many leading '#' for block comment
src/Mod/Fem/femobjects/_FemMaterialMechanicalNonlinear.py:27:1: E266 too many leading '#' for block comment
src/Mod/Fem/femobjects/_FemElementGeometry2D.py:27:1: E266 too many leading '#' for block comment
src/Mod/Fem/femobjects/_FemConstraintElectrostaticPotential.py:27:1: E266 too many leading '#' for block comment
src/Mod/Fem/femobjects/_FemElementFluid1D.py:28:1: E266 too many leading '#' for block comment
src/Mod/Fem/femobjects/_FemElementGeometry1D.py:27:1: E266 too many leading '#' for block comment
src/Mod/Fem/femobjects/_FemConstraintSelfWeight.py:27:1: E266 too many leading '#' for block comment
src/Mod/Fem/femobjects/_FemMaterialReinforced.py:27:1: E266 too many leading '#' for block comment
src/Mod/Fem/femobjects/_FemConstraintInitialFlowVelocity.py:27:1: E266 too many leading '#' for block comment
src/Mod/Fem/femobjects/_FemMeshBoundaryLayer.py:27:1: E266 too many leading '#' for block comment
src/Mod/Fem/femobjects/_FemMeshGroup.py:27:1: E266 too many leading '#' for block comment
src/Mod/Fem/femobjects/_FemSolverCalculix.py:27:1: E266 too many leading '#' for block comment
src/Mod/Fem/femtools/ccxtools.py:28:1: E266 too many leading '#' for block comment
src/Mod/Fem/femtools/ccxtools.py:47:5: E266 too many leading '#' for block comment
src/Mod/Fem/femtools/ccxtools.py:58:9: E266 too many leading '#' for block comment
src/Mod/Fem/femtools/ccxtools.py:64:9: E266 too many leading '#' for block comment
src/Mod/Fem/femtools/ccxtools.py:105:13: E266 too many leading '#' for block comment
src/Mod/Fem/femtools/ccxtools.py:109:13: E266 too many leading '#' for block comment
src/Mod/Fem/femtools/ccxtools.py:125:5: E266 too many leading '#' for block comment
src/Mod/Fem/femtools/ccxtools.py:131:5: E266 too many leading '#' for block comment
src/Mod/Fem/femtools/ccxtools.py:140:5: E266 too many leading '#' for block comment
src/Mod/Fem/femtools/ccxtools.py:199:9: E266 too many leading '#' for block comment
src/Mod/Fem/femtools/ccxtools.py:224:9: E266 too many leading '#' for block comment
src/Mod/Fem/femtools/ccxtools.py:230:9: E266 too many leading '#' for block comment
src/Mod/Fem/femtools/ccxtools.py:233:9: E266 too many leading '#' for block comment
src/Mod/Fem/femtools/ccxtools.py:236:9: E266 too many leading '#' for block comment
src/Mod/Fem/femtools/ccxtools.py:239:9: E266 too many leading '#' for block comment
src/Mod/Fem/femtools/ccxtools.py:242:9: E266 too many leading '#' for block comment
src/Mod/Fem/femtools/ccxtools.py:245:9: E266 too many leading '#' for block comment
src/Mod/Fem/femtools/ccxtools.py:248:9: E266 too many leading '#' for block comment
src/Mod/Fem/femtools/ccxtools.py:251:9: E266 too many leading '#' for block comment
src/Mod/Fem/femtools/ccxtools.py:254:9: E266 too many leading '#' for block comment
src/Mod/Fem/femtools/ccxtools.py:257:9: E266 too many leading '#' for block comment
src/Mod/Fem/femtools/ccxtools.py:260:9: E266 too many leading '#' for block comment
src/Mod/Fem/femtools/ccxtools.py:263:9: E266 too many leading '#' for block comment
src/Mod/Fem/femtools/ccxtools.py:266:9: E266 too many leading '#' for block comment
src/Mod/Fem/femtools/ccxtools.py:271:9: E266 too many leading '#' for block comment
src/Mod/Fem/femtools/ccxtools.py:274:9: E266 too many leading '#' for block comment
src/Mod/Fem/femtools/ccxtools.py:277:9: E266 too many leading '#' for block comment
src/Mod/Fem/femtools/ccxtools.py:615:5: E266 too many leading '#' for block comment
src/Mod/Fem/femtools/ccxtools.py:627:5: E266 too many leading '#' for block comment
src/Mod/Fem/femtools/ccxtools.py:639:5: E266 too many leading '#' for block comment
src/Mod/Fem/femtools/ccxtools.py:741:5: E266 too many leading '#' for block comment
src/Mod/Fem/femtools/ccxtools.py:1114:5: E266 too many leading '#' for block comment
src/Mod/Fem/femtools/ccxtools.py:1138:5: E266 too many leading '#' for block comment
src/Mod/Fem/femtools/ccxtools.py:1161:1: E266 too many leading '#' for block comment
src/Mod/Fem/femcommands/manager.py:28:1: E266 too many leading '#' for block comment
src/Mod/Fem/femcommands/manager.py:265:1: E266 too many leading '#' for block comment
src/Mod/Fem/femresult/resulttools.py:27:1: E266 too many leading '#' for block comment
src/Mod/Fem/femresult/resulttools.py:35:1: E266 too many leading '#' for block comment
src/Mod/Fem/femresult/resulttools.py:56:1: E266 too many leading '#' for block comment
src/Mod/Fem/femresult/resulttools.py:64:1: E266 too many leading '#' for block comment
src/Mod/Fem/femresult/resulttools.py:86:1: E266 too many leading '#' for block comment
src/Mod/Fem/femresult/resulttools.py:113:1: E266 too many leading '#' for block comment
src/Mod/Fem/femresult/resulttools.py:136:1: E266 too many leading '#' for block comment
src/Mod/Fem/femresult/resulttools.py:149:1: E266 too many leading '#' for block comment
src/Mod/Fem/femresult/resulttools.py:782:1: E266 too many leading '#' for block comment
Jee-Bee
Posts: 1921
Joined: Tue Jun 16, 2015 10:32 am
Location: Netherlands

Re: How to get rid of pep8 error E266 in FEM?

Postby Jee-Bee » Mon Jun 17, 2019 5:13 am

It are the ##

I guess you make double hashtags for some reason
User avatar
Kunda1
Posts: 4812
Joined: Thu Jan 05, 2017 9:03 pm

Re: How to get rid of pep8 error E266 in FEM?

Postby Kunda1 » Mon Jun 17, 2019 7:16 am

Does the --ignore flag not work?

Code: Select all

pep8 --ignore=E223 <file>
https://stackoverflow.com/a/34411993/1033779

You can also try using flake8 with https://github.com/jayvdb/flake8-putty
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
User avatar
bernd
Posts: 8046
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: How to get rid of pep8 error E266 in FEM?

Postby bernd » Mon Jun 17, 2019 7:27 pm

Sure the ignore flag works, but that is what the topic is about. I do not want o use the ignore flag, because all really wrong ones are not found. I would like to get rid of the ## but they seam to be needed for something not related with Pyhon. AFAIK some automatic documentation stuff.
UR_
Posts: 869
Joined: Tue Jan 03, 2017 8:42 pm

Re: How to get rid of pep8 error E266 in FEM?

Postby UR_ » Mon Jun 17, 2019 7:59 pm

bernd wrote:
Mon Jun 17, 2019 7:27 pm
AFAIK some automatic documentation stuff.
## looks like doxygen markers :roll:

http://www.doxygen.nl/manual/docblocks. ... thonblocks
https://stackoverflow.com/questions/586 ... th-doxygen
User avatar
bernd
Posts: 8046
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: How to get rid of pep8 error E266 in FEM?

Postby bernd » Fri Jun 21, 2019 5:18 am

Ahh yes that is what they are used for.

OK, the question should be. How do we get rid of this doxygen markers? Is there another possibility to use other doxygen markers instead the ## ? Yes there ist. One of the links _UR posted has a different versions inside Python ''' I will have a look at this.
vocx
Posts: 736
Joined: Thu Oct 18, 2018 9:18 pm

Re: How to get rid of pep8 error E266 in FEM?

Postby vocx » Thu Aug 15, 2019 11:51 pm

bernd wrote:
Fri Jun 21, 2019 5:18 am
Ahh yes that is what they are used for.

OK, the question should be. How do we get rid of this doxygen markers? Is there another possibility to use other doxygen markers instead the ## ? Yes there ist. One of the links _UR posted has a different versions inside Python ''' I will have a look at this.
HI Bernd, I don't know if you are still looking into this but please read the Doxygen wiki page. I rewrote most of it, explaining a lot of details about Doxygen.

In essence, you can use two styles to document Python code, with ##double pound signs, and with Python raw strings """inside triple quotes""". If you use double ## symbols, Doxygen \special commands starting with \backslash or @atsymbol will work, but if you use """triple quotes""" the special commands will not work. Doxygen will still extract the docstring, but it will be processed verbatim.

I suggest using the second style with """triple quotes""" because that is the proper, standardized way to document Python sources. And if in the future we move to a system like Sphinx+Breathe, everything will already be set.

More information Python codeformating Draft, Arch in the regard of pep8 etc
Syres
Posts: 297
Joined: Thu Aug 09, 2018 11:14 am

Re: How to get rid of pep8 error E266 in FEM?

Postby Syres » Fri Aug 16, 2019 8:38 am

vocx wrote:
Thu Aug 15, 2019 11:51 pm
##double pound signs
I thought this was just a slip up in the topic but I notice the Wiki page also contains what I've always known to be a hash sign - # being called a pound sign. As someone who carries the real thing around to pay for goods and services it's always been displayed as a £
vocx
Posts: 736
Joined: Thu Oct 18, 2018 9:18 pm

Re: How to get rid of pep8 error E266 in FEM?

Postby vocx » Fri Aug 16, 2019 3:42 pm

Syres wrote:
Fri Aug 16, 2019 8:38 am
I thought this was just a slip up in the topic but I notice the Wiki page also contains what I've always known to be a hash sign - # being called a pound sign.
I guess I tried to be "correct", so I used a formal term. https://en.wikipedia.org/wiki/Number_sign

However, given that this is about documenting computer code, maybe I should use the more colloquial term "hash".
User avatar
bernd
Posts: 8046
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: How to get rid of pep8 error E266 in FEM?

Postby bernd » Sat Aug 17, 2019 6:06 pm

@vocx

sure I am still interested, since FEM is pep8 compatible except e few still missing errors.

Would it be possible to show how you would make it, on an example def in this file https://github.com/FreeCAD/FreeCAD/blob ... cxtools.py ?

bernd