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

Blacken #247

Merged
merged 8 commits into from
Sep 16, 2023
Merged

Blacken #247

merged 8 commits into from
Sep 16, 2023

Conversation

orbeckst
Copy link
Member

fix #246

@orbeckst orbeckst self-assigned this Aug 25, 2023
@codecov
Copy link

codecov bot commented Aug 25, 2023

Codecov Report

Merging #247 (e96eae0) into main (3653164) will increase coverage by 0.00%.
The diff coverage is 65.68%.

@@           Coverage Diff           @@
##             main     #247   +/-   ##
=======================================
  Coverage   66.49%   66.49%           
=======================================
  Files          23       23           
  Lines        4325     4355   +30     
  Branches      739      757   +18     
=======================================
+ Hits         2876     2896   +20     
- Misses       1256     1261    +5     
- Partials      193      198    +5     
Files Changed Coverage Δ
gromacs/fileformats/__init__.py 100.00% <ø> (ø)
gromacs/formats.py 100.00% <ø> (ø)
setup.py 34.97% <ø> (ø)
gromacs/cbook.py 27.60% <24.82%> (ø)
gromacs/fileformats/convert.py 59.09% <27.77%> (ø)
gromacs/qsub.py 68.96% <48.14%> (ø)
gromacs/run.py 68.70% <57.14%> (ø)
gromacs/core.py 71.48% <57.69%> (ø)
gromacs/__init__.py 72.72% <58.33%> (ø)
gromacs/fileformats/blocks.py 70.96% <59.39%> (ø)
... and 13 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@orbeckst
Copy link
Member Author

The blackening broke something (the current main branch does not show this error):

gromacs/core.py:286: UnicodeDecodeError
________ test_to_unicode[\xc3\x85ngstr\xc3\xb6m-\xc3\x85ngstr\xc3\xb6m] ________

s = '\xc3\x85ngstr\xc3\xb6m', expected = '\xc3\x85ngstr\xc3\xb6m'

    @pytest.mark.parametrize(
        "s,expected",
        [
            (100, 100),
            ("Jabberwock", "Jabberwock"),
            ("Ångström", "Ångström"),
        ],
    )
    def test_to_unicode(s, expected):
>       output = convert.to_unicode(s)

tests/fileformats/test_convert.py:24: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

obj = '\xc3\x85ngstr\xc3\xb6m'

    def to_unicode(obj):
        """Convert obj to unicode (if it can be be converted).
    
        Conversion is only attempted if `obj` is a string type (as
        determined by :data:`six.string_types`).
    
        .. versionchanged:: 0.7.0
           removed *encoding* keyword argument
    
        """
        if not isinstance(obj, six.string_types):
            return obj
    
        try:
>           obj = six.text_type(obj)
E           UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 0: ordinal not in range(128)

gromacs/fileformats/convert.py:60: UnicodeDecodeError

@orbeckst
Copy link
Member Author

macOS mamba seems currently broken (see #253 ) and I made it non-mandatory status check.

@orbeckst
Copy link
Member Author

Mamba is fixed.

black only supports Python 3.x and removed unicode strings: this commit puts these essential
string prefixes back (otherwise Python 2.7 tests will not pass)
@orbeckst
Copy link
Member Author

black removed Python 2.7 essential unicode string prefixes in the tests.

- ignore files with specific Python 2.7 code to protect it from black
- ignore the black commit for git blame
@orbeckst orbeckst merged commit f2b6344 into main Sep 16, 2023
18 of 19 checks passed
@orbeckst orbeckst deleted the blacken branch September 16, 2023 02:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

use black for formatting
1 participant