I'm using fstrings in python2 after pip install future-fstrings
like the following:
# -*- coding: future_fstrings -*-
class A(object):
def __init__(self, **kw):
self.__dict__.update(**kw)
print (f'{self.a}')
print (f'{self.b}')
print (f'{self.c}')
A(a=1,b=2,c=3)
However, when commiting such a file to my project I get:
flake8 (Python 3.6 syntax check).....................(no files to check)Skipped
flake8 (Python 2.7)......................................................Failed
hookid: flake8
file_name:0:1: E999 SyntaxError: unknown encoding: future_fstrings
Why is this happening and how can I fix it?
# noqa E999
doesn't help...
pre-commit creates isolated environments for every hook
you'll need to make future-fstrings available to that linter:
- id: flake8
additional_dependencies: [future-fstrings]
full disclosure: I'm the author of both pre-commit and future-fstrings and the maintainer of flake8, wild when they all overlap heh