pycodestyle_magic icon indicating copy to clipboard operation
pycodestyle_magic copied to clipboard

problems with if statements

Open skwde opened this issue 5 years ago • 1 comments

Hi,

I use the current version pycodestyle-magic-0.5.

At the beginning of the notebook I do

%load_ext pycodestyle_magic
%pycodestyle_on
#%flake8_on # does not work

Then the following throws a ValueError

t = True
if t1 == True:
    print('1')

i.e.

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
/usr/local/anaconda3/lib/python3.8/site-packages/pycodestyle_magic.py in auto_run_pycodestyle(self, result)
     44 
     45     def auto_run_pycodestyle(self, result):
---> 46         pycodestyle(1, result.info.raw_cell, auto=True)
     47         if result.error_before_exec:
     48             print('Error before execution: %s' % result.error_before_exec)

<decorator-gen-123> in pycodestyle(line, cell, auto)

/usr/local/anaconda3/lib/python3.8/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    218     # but it's overkill for just that one bit of state.
    219     def magic_deco(arg):
--> 220         call = lambda f, *a, **k: f(*a, **k)
    221 
    222         # Find get_ipython() in the caller's namespace

/usr/local/anaconda3/lib/python3.8/site-packages/pycodestyle_magic.py in pycodestyle(line, cell, auto)
    173         #logger.info(line)
    174         # on windows drive path also contains :
--> 175         line, col, error = line.split(':')[-4:]
    176         # do not subtract 1 for line for %%pycodestyle, inc pre py3.6 string
    177         if auto:

ValueError: too many values to unpack (expected 3)

Best, skwde

skwde avatar Jan 29 '21 09:01 skwde

Appears to be related to #20

jtweeder avatar Jan 11 '22 13:01 jtweeder