Skip to content

Commit

Permalink
replace percent formatters with f-strings
Browse files Browse the repository at this point in the history
  • Loading branch information
bretello committed Apr 29, 2024
1 parent a5bf686 commit 6adab06
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions fancycompleter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,9 +428,9 @@ def __init__(self, basepath, force):
def check(self):
PYTHONSTARTUP = os.environ.get("PYTHONSTARTUP")
if PYTHONSTARTUP:
return "PYTHONSTARTUP already defined: %s" % PYTHONSTARTUP
return f"PYTHONSTARTUP already defined: {PYTHONSTARTUP}"
if os.path.exists(self.filename):
return "%s already exists" % self.filename
return f"{self.filename} already exists"

def install(self):
import textwrap
Expand All @@ -454,12 +454,12 @@ def install(self):

def set_env_var(self):
if sys.platform == "win32":
os.system('SETX PYTHONSTARTUP "%s"' % self.filename)
print("%PYTHONSTARTUP% set to", self.filename)
os.system(f'SETX PYTHONSTARTUP "{self.filename}"')
print(f"%PYTHONSTARTUP% set to {self.filename}")
else:
print("startup file written to", self.filename)
print(f"startup file written to {self.filename}")
print("Append this line to your ~/.bashrc:")
print(" export PYTHONSTARTUP=%s" % self.filename)
print(f" export PYTHONSTARTUP={self.filename}")


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion tests/test_configurableclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class MyCfg(ConfigurableClass):
out, err = capsys.readouterr()
assert out == ""
assert err == (
"** error when setting up Config from ~/.mycfg: my_exc (%s:1) **\n" % p
f"** error when setting up Config from ~/.mycfg: my_exc ({p}:1) **\n"
)

# Error during execfile.
Expand Down

0 comments on commit 6adab06

Please sign in to comment.