Skip to content

Commit 3d118ce

Browse files
authored
Simplify make_filename_from_project (#12540)
1 parent 81832c2 commit 3d118ce

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

sphinx/util/osutil.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,16 +108,15 @@ def copyfile(source: str | os.PathLike[str], dest: str | os.PathLike[str]) -> No
108108
copytimes(source, dest)
109109

110110

111-
no_fn_re = re.compile(r'[^a-zA-Z0-9_-]')
112-
project_suffix_re = re.compile(' Documentation$')
111+
_no_fn_re = re.compile(r'[^a-zA-Z0-9_-]')
113112

114113

115114
def make_filename(string: str) -> str:
116-
return no_fn_re.sub('', string) or 'sphinx'
115+
return _no_fn_re.sub('', string) or 'sphinx'
117116

118117

119118
def make_filename_from_project(project: str) -> str:
120-
return make_filename(project_suffix_re.sub('', project)).lower()
119+
return make_filename(project.removesuffix(' Documentation')).lower()
121120

122121

123122
def relpath(path: str | os.PathLike[str],

0 commit comments

Comments
 (0)