@@ -15,7 +15,7 @@ def _choose_from_list(options, question):
1515 """Choose an item from a list."""
1616 message = ""
1717 for index , value in enumerate (options ):
18- message += "[{}] {}\n " . format ( index , value )
18+ message += f "[{ index } ] { value } \n "
1919 message += "\n " + question
2020
2121 def valid (n ):
@@ -44,7 +44,7 @@ def runserver(
4444 yes_or_no = ("debug_toolbar" , "werkzeug" , "dummy_cache" , "short_cache" , "template_warnings" , "insecure" )
4545 for s in yes_or_no :
4646 if locals ()[s ].lower () not in ("yes" , "no" ):
47- abort ("Specify 'yes' or 'no' for {} option." . format ( s ) )
47+ abort (f "Specify 'yes' or 'no' for { s } option." )
4848
4949 _log_levels = ("DEBUG" , "INFO" , "WARNING" , "ERROR" , "CRITICAL" )
5050 if log_level not in _log_levels :
@@ -120,9 +120,9 @@ def clear_sessions(venv=None):
120120 return 0
121121
122122 if count > 0 :
123- local ("{0 }| xargs redis-cli -n " "{1 } DEL". format ( keys_command , REDIS_SESSION_DB ) )
123+ local (f" { keys_command } | xargs redis-cli -n " f" { REDIS_SESSION_DB } DEL" )
124124
125- puts ("Destroyed {} session{}." . format ( count , plural ) )
125+ puts (f "Destroyed { count } session{ plural } ." )
126126
127127
128128def clear_cache (input = None ):
@@ -133,9 +133,9 @@ def clear_cache(input=None):
133133 n = _choose_from_list (["Production cache" , "Sandbox cache" ], "Which cache would you like to clear?" )
134134
135135 if n == 0 :
136- local ("redis-cli -n {} FLUSHDB" . format ( REDIS_PRODUCTION_CACHE_DB ) )
136+ local (f "redis-cli -n { REDIS_PRODUCTION_CACHE_DB } FLUSHDB" )
137137 else :
138- local ("redis-cli -n {} FLUSHDB" . format ( REDIS_SANDBOX_CACHE_DB ) )
138+ local (f "redis-cli -n { REDIS_SANDBOX_CACHE_DB } FLUSHDB" )
139139
140140
141141def contributors ():
@@ -156,7 +156,7 @@ def deploy():
156156 with lcd (PRODUCTION_DOCUMENT_ROOT ):
157157 with shell_env (PRODUCTION = "TRUE" ):
158158 local ("git pull" )
159- with open ("requirements.txt" , "r" ) as req_file :
159+ with open ("requirements.txt" ) as req_file :
160160 requirements = req_file .read ().strip ().split ()
161161 try :
162162 pkg_resources .require (requirements )
@@ -179,8 +179,8 @@ def forcemigrate(app=None):
179179 """Force migrations to apply for a given app."""
180180 if app is None :
181181 abort ("No app name given." )
182- local ("./manage.py migrate {} --fake" . format ( app ) )
183- local ("./manage.py migrate {}" . format ( app ) )
182+ local (f "./manage.py migrate { app } --fake" )
183+ local (f "./manage.py migrate { app } " )
184184
185185
186186def inspect_decorators ():
0 commit comments