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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Black failure on Travis-ci #128

Closed
erwanp opened this issue Aug 31, 2020 · 2 comments
Closed

Black failure on Travis-ci #128

erwanp opened this issue Aug 31, 2020 · 2 comments
Labels
bug Something isn't working ci-dev continum-integration, tests, and development workflow

Comments

@erwanp
Copy link
Member

erwanp commented Aug 31, 2020

馃悰 Describe the bug

error: cannot format /home/travis/build/radis/radis/radis/levels/partfunc_cdsd.py: INTERNAL ERROR: Black produced code that is not equivalent to the source.  Please report a bug on https://github.com/psf/black/issues.  This diff might be helpful: /tmp/blk_xcyo54jw.log

Example : https://travis-ci.com/github/radis/radis/jobs/379490900#L266

But works perfectly with Local Black run (Python 3.6, Python 3.8)

馃挕 Possible solutions

No idea at this point, but we may have to run Travis locally :

https://stackoverflow.com/questions/21053657/how-to-run-travis-ci-locally

@erwanp erwanp added bug Something isn't working ci-dev continum-integration, tests, and development workflow labels Aug 31, 2020
@erwanp
Copy link
Member Author

erwanp commented Aug 31, 2020

Actually I could reproduce the bug using the Latest Black version (20.18)

psf/black#1658

--- src
+++ dst
@@ -1299,11 +1299,11 @@
       body=
         Expr(
           value=
             Constant(
               value=
-                'Calculate Partition Function from energy levels (and maybe export\na tabulated database).\n\nwarning::\nZPE (zero point energy) must be the same in the Line Database and the\nEnergy levels database. See the\n:ref:`Configuration file <label_lbl_config_file>`.\n\nParameters\n----------\n\nenergy_levels: filename\npath to energy levels (to calculate Partition Function) for ``isotope``\n\nisotope: int\nwhich isotope we\'re dealing with. Default ``1``. In the current implementation\nonly isotope 1 and 2 are defined.\n\nlevelsfmt: ``\'cdsd-p\'``, ``\'cdsd-pc\'``, ``\'cdsd-pcN\'``, ``\'cdsd-hamil\'``, or ``None``\nthe format of the Energy Database, and in particular how ``Evib`` and ``Erot``\nhave been calculated. A vibrational level in the CDSD (p,c,J,N) nomenclature\ncan be defined for levels that share a same (p), (p,c) or (p,c,N), where\n``p`` is the polyad number, ``c`` is the Wang symmetry number, and ``N``\nis the ranking index of a (p,c,J) group. Default ``\'cdsd-pc\'``.\n\nIf ``None``, dont label the levels. Wont be able to use the EnergyDatabase to fetch\nvibrational energies for lines, however it can still be used to\ncalculate Partition functions independently from a Spectrum calculation\n\nOther Parameters\n----------------\n\nuse_cached: ``True``, ``False``, or ``\'regen\'``, ``\'force\'``\nif ``True``, use (and generate if doesnt exist) a ``.h5`` file.\nIf ``\'regen\'``, regenerate cache file. If ``\'force\'``, raise an error\nif file doesnt exist. Default ``True``\n\nuse_json: boolean\ndeprecated. Better use h5 now.\n\nNotes\n-----\n\nDatabase format:\n\nTaskhkun database updated with ranking number (n) & total rank (N) of\nblock, Evib and Erot (cm-1)  and jref\n\nFor nonequilibrium, different strategies exist so as how to assign rotational and vibrational\nenergies in a CDSD database. See the E. Pannier "Limits on CO2 Nonequilibrium\nmodel" article for a discussion on that.\n\nExample of table format::\n\n# calculated rovibrational energy levels of 12C16O2\n# =================================================\n# S.Tashkun, Zuev Institute of Atmospheric Optics, Tomsk, Russia\n# date: 17.03.2017\n#\n# zero point energy ZPE (cm-1) =  2531.828\n#\n# p = 2v1 + v2 + 3v3 - polyad number\n# j - rotational quantum number\n# c - Wang symmetry (1-\'e\'; 2-\'f\')\n# N - ranking number of energy levels of (p,j,c) blocks\n# n - total rank of (p,j,c) blocks\n#\n# Calculation limitations:\n# pmax = 40\n# jmax = 300\n# Ecut = 44600 cm-1\n# ---------------\np\tc\tj\tN\tn\tE\tEvib\tErot\tjref\n0\t1\t0\t1\t1\t0.000\t0.000\t0.000\t0\n0\t1\t2\t1\t1\t2.341\t0.000\t2.341\t0\n0\t1\t4\t1\t1\t7.804\t0.000\t7.804\t0\n0\t1\t6\t1\t1\t16.389\t0.000\t16.389\t0\n0\t1\t8\t1\t1\t28.095\t0.000\t28.095\t0\n\nSee an example in `test/files/co2_cdsd_hamiltonian_fragment.levels <https://github.com/radis/radis/blob/develop/radis/test/files/cdsd_hitemp_09_fragment.txt>`\n\nSee Also\n--------\n\n:py:class:`~radis.levels.partfunc_cdsd.PartFuncCO2_CDSDtab`',  # str
+                'Calculate Partition Function from energy levels (and maybe export\na tabulated database).\n\nwarning::\nZPE (zero point energy) must be the same in the Line Database and the\nEnergy levels database. See the\n:ref:`Configuration file <label_lbl_config_file>`.\n\nParameters\n----------\n\nenergy_levels: filename\npath to energy levels (to calculate Partition Function) for ``isotope``\n\nisotope: int\nwhich isotope we\'re dealing with. Default ``1``. In the current implementation\nonly isotope 1 and 2 are defined.\n\nlevelsfmt: ``\'cdsd-p\'``, ``\'cdsd-pc\'``, ``\'cdsd-pcN\'``, ``\'cdsd-hamil\'``, or ``None``\nthe format of the Energy Database, and in particular how ``Evib`` and ``Erot``\nhave been calculated. A vibrational level in the CDSD (p,c,J,N) nomenclature\ncan be defined for levels that share a same (p), (p,c) or (p,c,N), where\n``p`` is the polyad number, ``c`` is the Wang symmetry number, and ``N``\nis the ranking index of a (p,c,J) group. Default ``\'cdsd-pc\'``.\n\nIf ``None``, dont label the levels. Wont be able to use the EnergyDatabase to fetch\nvibrational energies for lines, however it can still be used to\ncalculate Partition functions independently from a Spectrum calculation\n\nOther Parameters\n----------------\n\nuse_cached: ``True``, ``False``, or ``\'regen\'``, ``\'force\'``\nif ``True``, use (and generate if doesnt exist) a ``.h5`` file.\nIf ``\'regen\'``, regenerate cache file. If ``\'force\'``, raise an error\nif file doesnt exist. Default ``True``\n\nuse_json: boolean\ndeprecated. Better use h5 now.\n\nNotes\n-----\n\nDatabase format:\n\nTaskhkun database updated with ranking number (n) & total rank (N) of\nblock, Evib and Erot (cm-1)  and jref\n\nFor nonequilibrium, different strategies exist so as how to assign rotational and vibrational\nenergies in a CDSD database. See the E. Pannier "Limits on CO2 Nonequilibrium\nmodel" article for a discussion on that.\n\nExample of table format::\n\n# calculated rovibrational energy levels of 12C16O2\n# =================================================\n# S.Tashkun, Zuev Institute of Atmospheric Optics, Tomsk, Russia\n# date: 17.03.2017\n#\n# zero point energy ZPE (cm-1) =  2531.828\n#\n# p = 2v1 + v2 + 3v3 - polyad number\n# j - rotational quantum number\n# c - Wang symmetry (1-\'e\'; 2-\'f\')\n# N - ranking number of energy levels of (p,j,c) blocks\n# n - total rank of (p,j,c) blocks\n#\n# Calculation limitations:\n# pmax = 40\n# jmax = 300\n# Ecut = 44600 cm-1\n# ---------------\np       c       j       N       n       E       Evib    Erot    jref\n0       1       0       1       1       0.000   0.000   0.000   0\n0       1       2       1       1       2.341   0.000   2.341   0\n0       1       4       1       1       7.804   0.000   7.804   0\n0       1       6       1       1       16.389  0.000   16.389  0\n0       1       8       1       1       28.095  0.000   28.095  0\n\nSee an example in `test/files/co2_cdsd_hamiltonian_fragment.levels <https://github.com/radis/radis/blob/develop/radis/test/files/cdsd_hitemp_09_fragment.txt>`\n\nSee Also\n--------\n\n:py:class:`~radis.levels.partfunc_cdsd.PartFuncCO2_CDSDtab`',  # str
             )  # /Constant
         )  # /Expr
         FunctionDef(
           args=
             arguments(

@erwanp
Copy link
Member Author

erwanp commented Sep 1, 2020

Error was due to this change in Black : psf/black#1288

trailing commas are handled diffrently in 20.18 and 19.10. Different black version were used on the server and locally. Finally fixed in 7fcc0a7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ci-dev continum-integration, tests, and development workflow
Projects
None yet
Development

No branches or pull requests

1 participant