Skip to content

Commit

Permalink
Removed unnecessary Unicode "u"
Browse files Browse the repository at this point in the history
  • Loading branch information
OzzieIsaacs committed Jan 21, 2023
1 parent 8022b1b commit 43ee85f
Show file tree
Hide file tree
Showing 21 changed files with 122 additions and 122 deletions.
12 changes: 6 additions & 6 deletions cps/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,20 +145,20 @@ def shutdown():
ub.dispose()

if task == 0:
show_text['text'] = _(u'Server restarted, please reload page.')
show_text['text'] = _('Server restarted, please reload page.')
else:
show_text['text'] = _(u'Performing Server shutdown, please close window.')
show_text['text'] = _('Performing Server shutdown, please close window.')
# stop gevent/tornado server
web_server.stop(task == 0)
return json.dumps(show_text)

if task == 2:
log.warning("reconnecting to calibre database")
calibre_db.reconnect_db(config, ub.app_DB_path)
show_text['text'] = _(u'Success! Database Reconnected')
show_text['text'] = _('Success! Database Reconnected')
return json.dumps(show_text)

show_text['text'] = _(u'Unknown command')
show_text['text'] = _('Unknown command')
return json.dumps(show_text), 400


Expand All @@ -169,7 +169,7 @@ def queue_metadata_backup():
show_text = {}
log.warning("Queuing all books for metadata backup")
helper.set_all_metadata_dirty()
show_text['text'] = _(u'Success! Books queued for Metadata Backup')
show_text['text'] = _('Success! Books queued for Metadata Backup')
return json.dumps(show_text)


Expand Down Expand Up @@ -202,7 +202,7 @@ def update_thumbnails():
def admin():
version = updater_thread.get_current_version_info()
if version is False:
commit = _(u'Unknown')
commit = _('Unknown')
else:
if 'datetime' in version:
commit = version['datetime']
Expand Down
2 changes: 1 addition & 1 deletion cps/comic.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def get_comic_info(tmp_file_path, original_file_name, original_file_extension, r
file_path=tmp_file_path,
extension=original_file_extension,
title=original_file_name,
author=u'Unknown',
author='Unknown',
cover=_extract_cover(tmp_file_path, original_file_extension, rar_executable),
description="",
tags="",
Expand Down
2 changes: 1 addition & 1 deletion cps/config_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class _Settings(_Base):
config_certfile = Column(String)
config_keyfile = Column(String)
config_trustedhosts = Column(String, default='')
config_calibre_web_title = Column(String, default=u'Calibre-Web')
config_calibre_web_title = Column(String, default='Calibre-Web')
config_books_per_page = Column(Integer, default=60)
config_random_books = Column(Integer, default=4)
config_authors_max = Column(Integer, default=0)
Expand Down
18 changes: 9 additions & 9 deletions cps/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def get(self):
return self.text

def __repr__(self):
return u"<Comments({0})>".format(self.text)
return "<Comments({0})>".format(self.text)


class Tags(Base):
Expand All @@ -208,7 +208,7 @@ def get(self):
return self.name

def __repr__(self):
return u"<Tags('{0})>".format(self.name)
return "<Tags('{0})>".format(self.name)


class Authors(Base):
Expand All @@ -228,7 +228,7 @@ def get(self):
return self.name

def __repr__(self):
return u"<Authors('{0},{1}{2}')>".format(self.name, self.sort, self.link)
return "<Authors('{0},{1}{2}')>".format(self.name, self.sort, self.link)


class Series(Base):
Expand All @@ -246,7 +246,7 @@ def get(self):
return self.name

def __repr__(self):
return u"<Series('{0},{1}')>".format(self.name, self.sort)
return "<Series('{0},{1}')>".format(self.name, self.sort)


class Ratings(Base):
Expand All @@ -262,7 +262,7 @@ def get(self):
return self.rating

def __repr__(self):
return u"<Ratings('{0}')>".format(self.rating)
return "<Ratings('{0}')>".format(self.rating)


class Languages(Base):
Expand All @@ -281,7 +281,7 @@ def get(self):
return self.lang_code

def __repr__(self):
return u"<Languages('{0}')>".format(self.lang_code)
return "<Languages('{0}')>".format(self.lang_code)


class Publishers(Base):
Expand All @@ -299,7 +299,7 @@ def get(self):
return self.name

def __repr__(self):
return u"<Publishers('{0},{1}')>".format(self.name, self.sort)
return "<Publishers('{0},{1}')>".format(self.name, self.sort)


class Data(Base):
Expand All @@ -323,7 +323,7 @@ def get(self):
return self.name

def __repr__(self):
return u"<Data('{0},{1}{2}{3}')>".format(self.book, self.format, self.uncompressed_size, self.name)
return "<Data('{0},{1}{2}{3}')>".format(self.book, self.format, self.uncompressed_size, self.name)


class Metadata_Dirtied(Base):
Expand Down Expand Up @@ -377,7 +377,7 @@ def __init__(self, title, sort, author_sort, timestamp, pubdate, series_index, l
self.has_cover = (has_cover != None)

def __repr__(self):
return u"<Books('{0},{1}{2}{3}{4}{5}{6}{7}{8}')>".format(self.title, self.sort, self.author_sort,
return "<Books('{0},{1}{2}{3}{4}{5}{6}{7}{8}')>".format(self.title, self.sort, self.author_sort,
self.timestamp, self.pubdate, self.series_index,
self.last_modified, self.path, self.has_cover)

Expand Down
10 changes: 5 additions & 5 deletions cps/editbooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -573,9 +573,9 @@ def table_xchange_author_title():


def merge_metadata(to_save, meta):
if to_save.get('author_name', "") == _(u'Unknown'):
if to_save.get('author_name', "") == _('Unknown'):
to_save['author_name'] = ''
if to_save.get('book_title', "") == _(u'Unknown'):
if to_save.get('book_title', "") == _('Unknown'):
to_save['book_title'] = ''
for s_field, m_field in [
('tags', 'tags'), ('author_name', 'author'), ('series', 'series'),
Expand Down Expand Up @@ -611,7 +611,7 @@ def prepare_authors(authr):

# we have all author names now
if input_authors == ['']:
input_authors = [_(u'Unknown')] # prevent empty Author
input_authors = [_('Unknown')] # prevent empty Author

renamed = list()
for in_aut in input_authors:
Expand All @@ -628,7 +628,7 @@ def prepare_authors(authr):


def prepare_authors_on_upload(title, authr):
if title != _(u'Unknown') and authr != _(u'Unknown'):
if title != _('Unknown') and authr != _('Unknown'):
entry = calibre_db.check_exists_book(authr, title)
if entry:
log.info("Uploaded book probably exists in library")
Expand Down Expand Up @@ -771,7 +771,7 @@ def delete_whole_book(book_id, book):

# check if only this book links to:
# author, language, series, tags, custom columns
modify_database_object([u''], book.authors, db.Authors, calibre_db.session, 'author')
modify_database_object([''], book.authors, db.Authors, calibre_db.session, 'author')
modify_database_object([u''], book.tags, db.Tags, calibre_db.session, 'tags')
modify_database_object([u''], book.series, db.Series, calibre_db.session, 'series')
modify_database_object([u''], book.languages, db.Languages, calibre_db.session, 'languages')
Expand Down
6 changes: 3 additions & 3 deletions cps/epub.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@ def get_epub_info(tmp_file_path, original_file_name, original_file_extension):
if epub_metadata['subject'] == 'Unknown':
epub_metadata['subject'] = ''

if epub_metadata['publisher'] == u'Unknown':
if epub_metadata['publisher'] == 'Unknown':
epub_metadata['publisher'] = ''

if epub_metadata['date'] == u'Unknown':
if epub_metadata['date'] == 'Unknown':
epub_metadata['date'] = ''

if epub_metadata['description'] == u'Unknown':
if epub_metadata['description'] == 'Unknown':
description = tree.xpath("//*[local-name() = 'description']/text()")
if len(description) > 0:
epub_metadata['description'] = description
Expand Down
14 changes: 7 additions & 7 deletions cps/fb2.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,19 @@ def get_author(element):
if len(last_name):
last_name = last_name[0]
else:
last_name = u''
last_name = ''
middle_name = element.xpath('fb:middle-name/text()', namespaces=ns)
if len(middle_name):
middle_name = middle_name[0]
else:
middle_name = u''
middle_name = ''
first_name = element.xpath('fb:first-name/text()', namespaces=ns)
if len(first_name):
first_name = first_name[0]
else:
first_name = u''
return (first_name + u' '
+ middle_name + u' '
first_name = ''
return (first_name + ' '
+ middle_name + ' '
+ last_name)

author = str(", ".join(map(get_author, authors)))
Expand All @@ -59,12 +59,12 @@ def get_author(element):
if len(title):
title = str(title[0])
else:
title = u''
title = ''
description = tree.xpath('/fb:FictionBook/fb:description/fb:publish-info/fb:book-name/text()', namespaces=ns)
if len(description):
description = str(description[0])
else:
description = u''
description = ''

return BookMeta(
file_path=tmp_file_path,
Expand Down
8 changes: 4 additions & 4 deletions cps/gdrive.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def authenticate_google_drive():
try:
authUrl = gdriveutils.Gauth.Instance().auth.GetAuthUrl()
except gdriveutils.InvalidConfigError:
flash(_(u'Google Drive setup not completed, try to deactivate and activate Google Drive again'),
flash(_('Google Drive setup not completed, try to deactivate and activate Google Drive again'),
category="error")
return redirect(url_for('web.index'))
return redirect(authUrl)
Expand Down Expand Up @@ -91,9 +91,9 @@ def watch_gdrive():
config.save()
except HttpError as e:
reason=json.loads(e.content)['error']['errors'][0]
if reason['reason'] == u'push.webhookUrlUnauthorized':
flash(_(u'Callback domain is not verified, '
u'please follow steps to verify domain in google developer console'), category="error")
if reason['reason'] == 'push.webhookUrlUnauthorized':
flash(_('Callback domain is not verified, '
'please follow steps to verify domain in google developer console'), category="error")
else:
flash(reason['message'], category="error")

Expand Down
2 changes: 1 addition & 1 deletion cps/gdriveutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ def updateGdriveCalibreFromLocal():

# update gdrive.db on edit of books title
def updateDatabaseOnEdit(ID,newPath):
sqlCheckPath = newPath if newPath[-1] == '/' else newPath + u'/'
sqlCheckPath = newPath if newPath[-1] == '/' else newPath + '/'
storedPathName = session.query(GdriveId).filter(GdriveId.gdrive_id == ID).first()
if storedPathName:
storedPathName.path = sqlCheckPath
Expand Down
Loading

0 comments on commit 43ee85f

Please sign in to comment.