Skip to content

Commit

Permalink
util: update suffix logic to modern calls
Browse files Browse the repository at this point in the history
Replacing use of slices for `removesuffix` calls to improve readability.

Signed-off-by: James Knight <[email protected]>
  • Loading branch information
jdknight committed Jan 18, 2025
1 parent bc87f4a commit 054f809
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sphinxcontrib/confluencebuilder/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ def normalize_base_url(url):
if url:
# removing any trailing forward slash user provided
if url.endswith('/'):
url = url[:-1]
url = url.removesuffix('/')
# check for rest api prefix; strip and return if found
if url.endswith(API_REST_V1):
url = url[:-len(API_REST_V1)]
url = url.removesuffix(API_REST_V1)
if url.endswith(API_REST_V2):
url = url[:-len(API_REST_V2)]
url = url.removesuffix(API_REST_V2)
# restore trailing forward flash
elif not url.endswith('/'):
url += '/'
Expand Down

0 comments on commit 054f809

Please sign in to comment.