Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
src/sage/misc/replace_dot_all.py: Use endswith()
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Koeppe committed Jan 29, 2023
1 parent 29e5ddb commit 01efec0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/sage/misc/replace_dot_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,11 +469,12 @@ def print_log_messages():
os.chdir(sage.env.SAGE_SRC + '/sage') # change to sage directory
dir = os.getcwd() # Get the current working directory
walkdir_replace_dot_all(dir, fileRegex, package_regex, verbose=verbosity)
elif args.location.find('.py') == -1 and args.location.find('.pxi') == -1:
elif not (args.location.endswith('.py') or args.location.endswith('.pxi')):
# Assume directory
os.chdir(sage.env.SAGE_SRC + '/sage/' + args.location) # change to directory specified by location argument
dir = os.getcwd() # Get the current working directory
walkdir_replace_dot_all(dir, fileRegex, package_regex, verbose=verbosity)
elif args.location.find('.py') != -1 or args.location.find('.pxi') != -1:
else:
# make replacements in file specified by location argument
make_replacements_in_file(sage.env.SAGE_SRC + '/sage/' + args.location, package_regex, verbose=verbosity)
# ************************************************************************************************************************************************************************

0 comments on commit 01efec0

Please sign in to comment.