diff options
author | Jon Dufresne <jon.dufresne@gmail.com> | 2019-03-17 22:49:36 +0300 |
---|---|---|
committer | Jon Dufresne <jon.dufresne@gmail.com> | 2019-03-17 22:58:03 +0300 |
commit | f210475489fe7f8f9fffbb68f7199bcd271ac0be (patch) | |
tree | cf41f36b12144b3cf614030dd047f138bf6b5a86 /sphinx/cmd | |
parent | 42c8fbd6f30d040683a56277ba59732c028623ab (diff) |
Python-3-only clean ups discovered by pyupgrade
https://github.com/asottile/pyupgrade
> A tool to automatically upgrade syntax for newer versions of the
> language.
- Drop u str prefix
- Drop base object inheritance
- Drop args to super()
- Use set literals
- Use dict comprehension
- Use set comprehension
Diffstat (limited to 'sphinx/cmd')
-rw-r--r-- | sphinx/cmd/quickstart.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/sphinx/cmd/quickstart.py b/sphinx/cmd/quickstart.py index c8b1b4fdd..dfc096de5 100644 --- a/sphinx/cmd/quickstart.py +++ b/sphinx/cmd/quickstart.py @@ -349,8 +349,7 @@ document is a custom template, you can also set this to another filename.''')) d['extensions'].append('sphinx.ext.%s' % name) # Handle conflicting options - if set(['sphinx.ext.imgmath', 'sphinx.ext.mathjax']).issubset( - d['extensions']): + if {'sphinx.ext.imgmath', 'sphinx.ext.mathjax'}.issubset(d['extensions']): print(__('Note: imgmath and mathjax cannot be enabled at the same ' 'time. imgmath has been deselected.')) d['extensions'].remove('sphinx.ext.imgmath') @@ -469,7 +468,7 @@ def valid_dir(d): if not path.isdir(dir): return False - if set(['Makefile', 'make.bat']) & set(os.listdir(dir)): + if {'Makefile', 'make.bat'} & set(os.listdir(dir)): return False if d['sep']: @@ -590,7 +589,7 @@ def main(argv=sys.argv[1:]): d = vars(args) # delete None or False value - d = dict((k, v) for k, v in d.items() if v is not None) + d = {k: v for k, v in d.items() if v is not None} # handle use of CSV-style extension values d.setdefault('extensions', []) @@ -601,12 +600,12 @@ def main(argv=sys.argv[1:]): try: if 'quiet' in d: - if not set(['project', 'author']).issubset(d): + if not {'project', 'author'}.issubset(d): print(__('''"quiet" is specified, but any of "project" or \ "author" is not specified.''')) return 1 - if set(['quiet', 'project', 'author']).issubset(d): + if {'quiet', 'project', 'author'}.issubset(d): # quiet mode with all required params satisfied, use default d.setdefault('version', '') d.setdefault('release', d['version']) |