Skip to content

Commit cad8483

Browse files
authored
Replace list()/dict() with literals (#2380)
Literals are always faster and conventional in modern Python style.
1 parent 62bd5ce commit cad8483

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

codespell_lib/_codespell.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ class NewlineHelpFormatter(argparse.HelpFormatter):
230230

231231
def _split_lines(self, text, width):
232232
parts = text.split('\n')
233-
out = list()
233+
out = []
234234
for part in parts:
235235
# Eventually we could allow others...
236236
indent_start = '- '
@@ -400,7 +400,7 @@ def parse_options(args):
400400
config = configparser.ConfigParser(interpolation=None)
401401

402402
# Read toml before other config files.
403-
toml_files_errors = list()
403+
toml_files_errors = []
404404
if os.path.isfile('pyproject.toml'):
405405
toml_files_errors.append(('pyproject.toml', False))
406406
if options.toml:
@@ -834,7 +834,7 @@ def main(*args):
834834
dictionaries = options.dictionary
835835
else:
836836
dictionaries = ['-']
837-
use_dictionaries = list()
837+
use_dictionaries = []
838838
for dictionary in dictionaries:
839839
if dictionary == "-":
840840
# figure out which builtin dictionaries to use
@@ -858,7 +858,7 @@ def main(*args):
858858
parser.print_help()
859859
return EX_USAGE
860860
use_dictionaries.append(dictionary)
861-
misspellings = dict()
861+
misspellings = {}
862862
for dictionary in use_dictionaries:
863863
build_dict(dictionary, misspellings, ignore_words)
864864
colors = TermColors()

0 commit comments

Comments
 (0)