Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_supported_fixes(self):
self.assertIn('E121', [f[0] for f in autopep8.supported_fixes()])
signal.signal(signal.SIGPIPE, signal.SIG_DFL)
except AttributeError: # pragma: no cover
# SIGPIPE is not available on Windows.
pass
if args is None:
args = parse_args(sys.argv[1:])
try:
# main
if args.version:
print(version)
sys.exit(0)
if args.list_fixes:
for code, description in sorted(autopep8.supported_fixes()):
print('{code} - {description}'.format(
code=code, description=description))
sys.exit(0)
try:
r = Radius.new(rev=args.rev, options=args, vc=vc)
except NotImplementedError as e: # pragma: no cover
print(e)
sys.exit(1)
except CalledProcessError as c: # pragma: no cover
# cut off usage and exit
output = c.output.splitlines()[0]
print(output)
sys.exit(c.returncode)
r.pep8radius()
Created on Sat Jan 19 14:57:57 2013
"""
# Standard library imports
from __future__ import (absolute_import, division, print_function,
unicode_literals)
# Third party imports
ERR_MSG = ''
try:
import autopep8
try:
FIX_LIST = [(code.strip(), description.strip())
for code, description in autopep8.supported_fixes()]
DEFAULT_IGNORE = ["E711", "E712", "W6"]
except AttributeError:
ERR_MSG = "Please install autopep8 >= 1.0, and pep8 >= 1.4.2."
except ImportError:
ERR_MSG = "Please install autopep8 >= 1.0, and pep8 >= 1.4.2."
from qtpy.QtWidgets import (QWidget, QVBoxLayout, QGroupBox,
QScrollArea, QLabel, QCheckBox)
from qtpy.QtGui import QTextCursor
from spyder.config.base import get_translation
from spyder.config.gui import fixed_shortcut
from spyder.plugins import SpyderPluginMixin
from spyder.plugins.configdialog import PluginConfigPage
from spyder.utils.qthelpers import get_icon, create_action
from spyder.utils import icon_manager as ima
try:
if args is None:
args = []
try:
# Note: argparse on py 2.6 you can't pass a set
# TODO neater solution for this!
args_set = set(args)
except TypeError:
args_set = args # args is a Namespace
if '--version' in args_set or getattr(args_set, 'version', 0):
print(version)
return 0
if '--list-fixes' in args_set or getattr(args_set, 'list_fixes', 0):
from autopep8 import supported_fixes
for code, description in sorted(supported_fixes()):
print('{code} - {description}'.format(
code=code, description=description))
return 0
try:
try:
args = parse_args(args, apply_config=apply_config)
except TypeError:
pass # args is already a Namespace (testing)
if args.from_diff: # pragma: no cover
r = Radius.from_diff(args.from_diff.read(),
options=args, cwd=cwd)
else:
r = Radius(rev=args.rev, options=args, vc=vc, cwd=cwd)
except NotImplementedError as e: # pragma: no cover
print(e)