From fd62fa6542782f5ba0fa7024bf4fd00da1519ee9 Mon Sep 17 00:00:00 2001 From: Rongxin Liu Date: Fri, 27 Oct 2023 15:59:01 -0400 Subject: [PATCH] replaced autopep8 with black as the python formatter --- setup.py | 4 ++-- style50/languages.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/setup.py b/setup.py index 85636f0..cabcc20 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ long_description_content_type="text/markdown", install_requires=[ "argparse", - "autopep8>=1.4.3", + "black>=23.10.0", "icdiff", "jsbeautifier", "pycodestyle==2.10.0", @@ -40,6 +40,6 @@ ] }, url="https://github.com/cs50/style50", - version="2.8.2", + version="2.9.0", include_package_data=True, ) diff --git a/style50/languages.py b/style50/languages.py index b7318f5..97b0c4c 100644 --- a/style50/languages.py +++ b/style50/languages.py @@ -3,7 +3,7 @@ import sys from tokenize import generate_tokens, STRING, INDENT, COMMENT, TokenError -import autopep8 +import black import jsbeautifier from . import StyleCheck, Error @@ -66,9 +66,9 @@ def count_lines(self, code): """ return len(code.splitlines()) - # TODO: Determine which options (if any) should be passed to autopep8 + # TODO: Determine which options (if any) should be passed to black def style(self, code): - return autopep8.fix_code(code, options={"max_line_length": 132, "ignore_local_config": True}) + return black.format_str(code, mode=black.FileMode()) class Js(C):