@@ -295,7 +295,7 @@ def get_ebook_info(self):
295295 d ['borrowed' ] = doc .get ("borrowed" ) == "true"
296296 d ['daisy_only' ] = False
297297 elif 'printdisabled' not in collections :
298- d ['read_url' ] = "https://archive.org/stream/%s" % self .ocaid
298+ d ['read_url' ] = f "https://archive.org/stream/{ self .ocaid } "
299299 d ['daisy_only' ] = False
300300 return d
301301
@@ -415,7 +415,7 @@ def from_isbn(
415415 if book_id == asin :
416416 query = {"type" : "/type/edition" , 'identifiers' : {'amazon' : asin }}
417417 else :
418- query = {"type" : "/type/edition" , 'isbn_%s' % len (book_id ): book_id }
418+ query = {"type" : "/type/edition" , f 'isbn_{ len (book_id )} ' : book_id }
419419
420420 if matches := web .ctx .site .things (query ):
421421 return web .ctx .site .get (matches [0 ])
@@ -841,12 +841,12 @@ def get_username(self):
841841 return self .key .split ("/" )[- 1 ]
842842
843843 def preferences (self ):
844- key = "%s/preferences" % self .key
844+ key = f" { self .key } /preferences"
845845 prefs = web .ctx .site .get (key )
846846 return (prefs and prefs .dict ().get ('notifications' )) or self .DEFAULT_PREFERENCES
847847
848848 def save_preferences (self , new_prefs , msg = 'updating user preferences' ):
849- key = '%s/preferences' % self .key
849+ key = f' { self .key } /preferences'
850850 old_prefs = web .ctx .site .get (key )
851851 prefs = (old_prefs and old_prefs .dict ()) or {
852852 'key' : key ,
@@ -859,7 +859,7 @@ def save_preferences(self, new_prefs, msg='updating user preferences'):
859859
860860 def is_usergroup_member (self , usergroup ):
861861 if not usergroup .startswith ('/usergroup/' ):
862- usergroup = '/usergroup/%s' % usergroup
862+ usergroup = f '/usergroup/{ usergroup } '
863863 return usergroup in [g .key for g in self .usergroups ]
864864
865865 def is_subscribed_user (self , username ):
@@ -914,7 +914,7 @@ def get_lists(self, seed=None, limit=100, offset=0, sort=True):
914914 # @cache.memoize(engine="memcache", key="user-avatar")
915915 def get_avatar_url (cls , username ):
916916 username = username .split ('/people/' )[- 1 ]
917- user = web .ctx .site .get ('/people/%s' % username )
917+ user = web .ctx .site .get (f '/people/{ username } ' )
918918 itemname = user .get_account ().get ('internetarchive_itemname' )
919919
920920 return f'https://archive.org/services/img/{ itemname } '
@@ -1041,7 +1041,7 @@ def render_link(self, cls=None):
10411041 """
10421042 extra_attrs = ''
10431043 if cls :
1044- extra_attrs += 'class="%s " ' % cls
1044+ extra_attrs += f 'class="{ cls } " '
10451045 # Why nofollow?
10461046 return f'<a rel="nofollow" href="{ self .key } " { extra_attrs } >{ web .net .htmlquote (self .displayname )} </a>'
10471047
@@ -1058,7 +1058,7 @@ def from_key(cls, key: str):
10581058 :rtype: UserGroup | None
10591059 """
10601060 if not key .startswith ('/usergroup/' ):
1061- key = "/usergroup/%s" % key
1061+ key = f "/usergroup/{ key } "
10621062 return web .ctx .site .get (key )
10631063
10641064 def add_user (self , userkey : str ) -> None :
0 commit comments