mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-16 09:09:52 +00:00
Handle kwargs passed to get_style_guide
This commit is contained in:
parent
a4ce229fb6
commit
1372d0dd1c
1 changed files with 10 additions and 0 deletions
|
|
@ -1,14 +1,24 @@
|
||||||
"""Module containing shims around Flake8 2.0 behaviour."""
|
"""Module containing shims around Flake8 2.0 behaviour."""
|
||||||
|
import logging
|
||||||
import os.path
|
import os.path
|
||||||
|
|
||||||
from flake8.formatting import base as formatter
|
from flake8.formatting import base as formatter
|
||||||
from flake8.main import application as app
|
from flake8.main import application as app
|
||||||
|
|
||||||
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def get_style_guide(**kwargs):
|
def get_style_guide(**kwargs):
|
||||||
"""Stub out the only function I'm aware of people using."""
|
"""Stub out the only function I'm aware of people using."""
|
||||||
application = app.Application()
|
application = app.Application()
|
||||||
application.initialize([])
|
application.initialize([])
|
||||||
|
options = application.options
|
||||||
|
for key, value in kwargs.items():
|
||||||
|
try:
|
||||||
|
getattr(options, key)
|
||||||
|
setattr(options, key, value)
|
||||||
|
except AttributeError:
|
||||||
|
LOG.error('Could not update option "%s"', key)
|
||||||
return StyleGuide(application)
|
return StyleGuide(application)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue