44
55It will perform the following steps:
66 * Create a new virtual environment using the built-in venv module, or the virtualenv zipapp if venv is unavailable.
7- This will be created at a platform-specific path (or `$POETRY_HOME` if `$POETRY_HOME` is set:
7+ This will be created at a platform-specific path (or `$POETRY_HOME` if set) :
88 - `~/Library/Application Support/pypoetry` on macOS
9- - `$XDG_DATA_HOME/pypoetry` on Linux/Unix (`$ XDG_DATA_HOME` is `~/.local/share` if unset )
9+ - `$XDG_DATA_HOME/pypoetry` on Linux/Unix (`XDG_DATA_HOME` is `~/.local/share` by default )
1010 - `%APPDATA%\pypoetry` on Windows
1111 * Update pip inside the virtual environment to avoid bugs in older versions.
1212 * Install the latest (or a given) version of Poetry inside this virtual environment using pip.
@@ -90,7 +90,7 @@ def style(fg, bg, options):
9090 for option in options :
9191 codes .append (OPTIONS [option ])
9292
93- return "\033 [{}m" . format ( ";" .join (map (str , codes )))
93+ return f "\033 [{ ';' .join (map (str , codes ))} m"
9494
9595
9696STYLES = {
@@ -107,8 +107,8 @@ def is_decorated():
107107 if WINDOWS :
108108 return (
109109 os .getenv ("ANSICON" ) is not None
110- or "ON" == os .getenv ("ConEmuANSI" )
111- or "xterm" == os .getenv ("Term" )
110+ or os .getenv ("ConEmuANSI" ) == "ON"
111+ or os .getenv ("Term" ) == "xterm"
112112 )
113113
114114 if not hasattr (sys .stdout , "fileno" ):
@@ -532,8 +532,9 @@ def _is_self_upgrade_supported(x):
532532 self ._write (
533533 colorize (
534534 "warning" ,
535- f"You are installing { version } . When using the current installer, this version does not support "
536- f"updating using the 'self update' command. Please use 1.1.7 or later." ,
535+ f"You are installing { version } . When using the current installer,"
536+ " this version does not support updating using the 'self update'"
537+ " command. Please use 1.1.7 or later." ,
537538 )
538539 )
539540 if not self ._accept_all :
@@ -558,9 +559,7 @@ def install(self, version):
558559 Installs Poetry in $POETRY_HOME.
559560 """
560561 self ._write (
561- "Installing {} ({})" .format (
562- colorize ("info" , "Poetry" ), colorize ("info" , version )
563- )
562+ f"Installing { colorize ('info' , 'Poetry' )} ({ colorize ('info' , version )} )"
564563 )
565564
566565 with self .make_env (version ) as env :
@@ -573,9 +572,7 @@ def install(self, version):
573572
574573 def uninstall (self ) -> int :
575574 if not self .data_dir .exists ():
576- self ._write (
577- "{} is not currently installed." .format (colorize ("info" , "Poetry" ))
578- )
575+ self ._write (f"{ colorize ('info' , 'Poetry' )} is not currently installed." )
579576
580577 return 1
581578
@@ -585,12 +582,10 @@ def uninstall(self) -> int:
585582
586583 if version :
587584 self ._write (
588- "Removing {} ({})" .format (
589- colorize ("info" , "Poetry" ), colorize ("b" , version )
590- )
585+ f"Removing { colorize ('info' , 'Poetry' )} ({ colorize ('b' , version )} )"
591586 )
592587 else :
593- self ._write ("Removing {}" . format ( colorize (" info" , " Poetry" )) )
588+ self ._write (f "Removing { colorize (' info' , ' Poetry' ) } " )
594589
595590 shutil .rmtree (str (self .data_dir ))
596591 for script in ["poetry" , "poetry.bat" , "poetry.exe" ]:
@@ -601,11 +596,8 @@ def uninstall(self) -> int:
601596
602597 def _install_comment (self , version : str , message : str ):
603598 self ._overwrite (
604- "Installing {} ({}): {}" .format (
605- colorize ("info" , "Poetry" ),
606- colorize ("b" , version ),
607- colorize ("comment" , message ),
608- )
599+ f"Installing { colorize ('info' , 'Poetry' )} ({ colorize ('b' , version )} ):"
600+ f" { colorize ('comment' , message )} "
609601 )
610602
611603 @contextmanager
@@ -708,11 +700,12 @@ def display_post_message_windows(self, version: str) -> None:
708700 def get_windows_path_var (self ) -> Optional [str ]:
709701 import winreg
710702
711- with winreg .ConnectRegistry (None , winreg .HKEY_CURRENT_USER ) as root :
712- with winreg .OpenKey (root , "Environment" , 0 , winreg .KEY_ALL_ACCESS ) as key :
713- path , _ = winreg .QueryValueEx (key , "PATH" )
703+ with winreg .ConnectRegistry (
704+ None , winreg .HKEY_CURRENT_USER
705+ ) as root , winreg .OpenKey (root , "Environment" , 0 , winreg .KEY_ALL_ACCESS ) as key :
706+ path , _ = winreg .QueryValueEx (key , "PATH" )
714707
715- return path
708+ return path
716709
717710 def display_post_message_fish (self , version : str ) -> None :
718711 fish_user_paths = subprocess .check_output (
0 commit comments