Skip to content

Commit d4d6b84

Browse files
committed
Revert "Use default double quotes"
This reverts commit a8c6acc.
1 parent a8c6acc commit d4d6b84

23 files changed

Lines changed: 489 additions & 488 deletions

‎pyproject.toml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ build.hooks.vcs.version-file = "src/blurb/_version.py"
4747
[tool.ruff]
4848
fix = true
4949
format.preview = true
50+
format.quote-style = "single"
5051
format.docstring-code-format = true
5152
lint.select = [
5253
"I", # isort

‎src/blurb/__main__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44

55
from blurb._cli import main
66

7-
if __name__ == "__main__":
7+
if __name__ == '__main__':
88
main()

‎src/blurb/_add.py‎

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
if TYPE_CHECKING:
1818
from collections.abc import Sequence
1919

20-
if sys.platform == "win32":
21-
FALLBACK_EDITORS = ("notepad.exe",)
20+
if sys.platform == 'win32':
21+
FALLBACK_EDITORS = ('notepad.exe',)
2222
else:
23-
FALLBACK_EDITORS = ("/etc/alternatives/editor", "nano")
23+
FALLBACK_EDITORS = ('/etc/alternatives/editor', 'nano')
2424

2525

2626
def add(*, issue: str | None = None, section: str | None = None):
@@ -44,12 +44,12 @@ def add(*, issue: str | None = None, section: str | None = None):
4444
{sections}
4545
""" # fmt: skip
4646

47-
handle, tmp_path = tempfile.mkstemp(".rst")
47+
handle, tmp_path = tempfile.mkstemp('.rst')
4848
os.close(handle)
4949
atexit.register(lambda: os.unlink(tmp_path))
5050

5151
text = _blurb_template_text(issue=issue, section=section)
52-
with open(tmp_path, "w", encoding="utf-8") as file:
52+
with open(tmp_path, 'w', encoding='utf-8') as file:
5353
file.write(text)
5454

5555
args = _editor_args()
@@ -59,7 +59,7 @@ def add(*, issue: str | None = None, section: str | None = None):
5959
blurb = _add_blurb_from_template(args, tmp_path)
6060
if blurb is None:
6161
try:
62-
prompt("Hit return to retry (or Ctrl-C to abort)")
62+
prompt('Hit return to retry (or Ctrl-C to abort)')
6363
except KeyboardInterrupt:
6464
print()
6565
return
@@ -70,10 +70,10 @@ def add(*, issue: str | None = None, section: str | None = None):
7070
path = blurb.save_next()
7171
git_add_files.append(path)
7272
flush_git_add_files()
73-
print("Ready for commit.")
73+
print('Ready for commit.')
7474

7575

76-
add.__doc__ = add.__doc__.format(sections="\n".join(f"* {s}" for s in sections))
76+
add.__doc__ = add.__doc__.format(sections='\n'.join(f'* {s}' for s in sections))
7777

7878

7979
def _editor_args() -> list[str]:
@@ -89,12 +89,12 @@ def _editor_args() -> list[str]:
8989
else:
9090
args = list(shlex.split(editor))
9191
if not shutil.which(args[0]):
92-
raise SystemExit(f"Invalid GIT_EDITOR / EDITOR value: {editor}")
92+
raise SystemExit(f'Invalid GIT_EDITOR / EDITOR value: {editor}')
9393
return args
9494

9595

9696
def _find_editor() -> str:
97-
for var in "GIT_EDITOR", "EDITOR":
97+
for var in 'GIT_EDITOR', 'EDITOR':
9898
editor = os.environ.get(var)
9999
if editor is not None:
100100
return editor
@@ -105,7 +105,7 @@ def _find_editor() -> str:
105105
found_path = shutil.which(fallback)
106106
if found_path and os.path.exists(found_path):
107107
return found_path
108-
error("Could not find an editor! Set the EDITOR environment variable.")
108+
error('Could not find an editor! Set the EDITOR environment variable.')
109109

110110

111111
def _blurb_template_text(*, issue: str | None, section: str | None) -> str:
@@ -117,21 +117,21 @@ def _blurb_template_text(*, issue: str | None, section: str | None) -> str:
117117
# Ensure that there is a trailing space after '.. gh-issue:' to make
118118
# filling in the template easier, unless an issue number was given
119119
# through the --issue command-line flag.
120-
issue_line = ".. gh-issue:"
121-
without_space = f"\n{issue_line}\n"
120+
issue_line = '.. gh-issue:'
121+
without_space = f'\n{issue_line}\n'
122122
if without_space not in text:
123123
raise SystemExit("Can't find gh-issue line in the template!")
124124
if issue_number is None:
125-
with_space = f"\n{issue_line} \n"
125+
with_space = f'\n{issue_line} \n'
126126
text = text.replace(without_space, with_space)
127127
else:
128-
with_issue_number = f"\n{issue_line} {issue_number}\n"
128+
with_issue_number = f'\n{issue_line} {issue_number}\n'
129129
text = text.replace(without_space, with_issue_number)
130130

131131
# Uncomment the section if needed.
132132
if section_name is not None:
133-
pattern = f".. section: {section_name}"
134-
text = text.replace(f"#{pattern}", pattern)
133+
pattern = f'.. section: {section_name}'
134+
text = text.replace(f'#{pattern}', pattern)
135135

136136
return text
137137

@@ -141,26 +141,26 @@ def _extract_issue_number(issue: str | None, /) -> int | None:
141141
return None
142142
issue = issue.strip()
143143

144-
if issue.startswith(("GH-", "gh-")):
144+
if issue.startswith(('GH-', 'gh-')):
145145
stripped = issue[3:]
146146
else:
147-
stripped = issue.removeprefix("#")
147+
stripped = issue.removeprefix('#')
148148
try:
149149
if stripped.isdecimal():
150150
return int(stripped)
151151
except ValueError:
152152
pass
153153

154154
# Allow GitHub URL with or without the scheme
155-
stripped = issue.removeprefix("https://")
156-
stripped = stripped.removeprefix("github.com/python/cpython/issues/")
155+
stripped = issue.removeprefix('https://')
156+
stripped = stripped.removeprefix('github.com/python/cpython/issues/')
157157
try:
158158
if stripped.isdecimal():
159159
return int(stripped)
160160
except ValueError:
161161
pass
162162

163-
raise SystemExit(f"Invalid GitHub issue number: {issue}")
163+
raise SystemExit(f'Invalid GitHub issue number: {issue}')
164164

165165

166166
def _extract_section_name(section: str | None, /) -> str | None:
@@ -169,7 +169,7 @@ def _extract_section_name(section: str | None, /) -> str | None:
169169

170170
section = section.strip()
171171
if not section:
172-
raise SystemExit("Empty section name!")
172+
raise SystemExit('Empty section name!')
173173

174174
matches = []
175175
# Try an exact or lowercase match
@@ -178,22 +178,22 @@ def _extract_section_name(section: str | None, /) -> str | None:
178178
matches.append(section_name)
179179

180180
if not matches:
181-
section_list = "\n".join(f"* {s}" for s in sections)
181+
section_list = '\n'.join(f'* {s}' for s in sections)
182182
raise SystemExit(
183-
f"Invalid section name: {section!r}\n\nValid names are:\n\n{section_list}"
183+
f'Invalid section name: {section!r}\n\nValid names are:\n\n{section_list}'
184184
)
185185

186186
if len(matches) > 1:
187-
multiple_matches = ", ".join(f"* {m}" for m in sorted(matches))
188-
raise SystemExit(f"More than one match for {section!r}:\n\n{multiple_matches}")
187+
multiple_matches = ', '.join(f'* {m}' for m in sorted(matches))
188+
raise SystemExit(f'More than one match for {section!r}:\n\n{multiple_matches}')
189189

190190
return matches[0]
191191

192192

193193
def _add_blurb_from_template(args: Sequence[str], tmp_path: str) -> Blurbs | None:
194194
subprocess.run(args)
195195

196-
failure = ""
196+
failure = ''
197197
blurb = Blurbs()
198198
try:
199199
blurb.load(tmp_path)
@@ -207,7 +207,7 @@ def _add_blurb_from_template(args: Sequence[str], tmp_path: str) -> Blurbs | Non
207207

208208
if failure:
209209
print()
210-
print(f"Error: {failure}")
210+
print(f'Error: {failure}')
211211
print()
212212
return None
213213
return blurb

0 commit comments

Comments
 (0)