mirror of
https://github.com/kovidgoyal/calibre.git
synced 2026-01-31 08:03:29 -05:00
manual from import (auto-fix)
ruff 'PLR0402'
This commit is contained in:
parent
3d5883a162
commit
a2e4515353
@ -114,6 +114,7 @@ select = [
|
||||
'E', 'F', 'I', 'W', 'INT',
|
||||
'Q', 'UP', 'YTT', 'TID', 'C4', 'COM818', 'PIE', 'RET501', 'ISC',
|
||||
'PLE', 'PLW', 'PLC',
|
||||
'PLR0402',
|
||||
'RUF', # note: RUF can flag many unsolicited errors
|
||||
# preview rules
|
||||
'RUF051', 'RUF056', # useless dict operation
|
||||
|
||||
3
setup.py
3
setup.py
@ -33,8 +33,7 @@ check_version_info()
|
||||
|
||||
sys.path.insert(0, src_base)
|
||||
|
||||
import setup.commands as commands
|
||||
from setup import get_warnings, prints
|
||||
from setup import commands, get_warnings, prints
|
||||
|
||||
|
||||
def option_parser():
|
||||
|
||||
@ -250,7 +250,7 @@ class Command:
|
||||
self.run_cmd(self, opts)
|
||||
|
||||
def add_command_options(self, command, parser):
|
||||
import setup.commands as commands
|
||||
from setup import commands
|
||||
command.sub_commands = [getattr(commands, cmd) for cmd in
|
||||
command.sub_commands]
|
||||
for cmd in command.sub_commands:
|
||||
|
||||
@ -2215,7 +2215,7 @@ class DB:
|
||||
os.makedirs(os.path.join(tdir, 'b'), exist_ok=True)
|
||||
os.makedirs(os.path.join(tdir, 'f'), exist_ok=True)
|
||||
if iswindows:
|
||||
import calibre_extensions.winutil as winutil
|
||||
from calibre_extensions import winutil
|
||||
winutil.set_file_attributes(tdir, winutil.FILE_ATTRIBUTE_HIDDEN | winutil.FILE_ATTRIBUTE_NOT_CONTENT_INDEXED)
|
||||
if time.time() - self.last_expired_trash_at >= 3600:
|
||||
self.expire_old_trash(during_init=during_init)
|
||||
|
||||
@ -9,10 +9,9 @@ Device driver for Bookeen's Cybook Gen 3 and Opus and Orizon
|
||||
import os
|
||||
import re
|
||||
|
||||
import calibre.devices.cybook.t2b as t2b
|
||||
import calibre.devices.cybook.t4b as t4b
|
||||
from calibre import fsync
|
||||
from calibre.constants import isunix
|
||||
from calibre.devices.cybook import t2b, t4b
|
||||
from calibre.devices.usbms.driver import USBMS
|
||||
|
||||
|
||||
|
||||
@ -14,9 +14,8 @@ import struct
|
||||
|
||||
from lxml import etree
|
||||
|
||||
import calibre.ebooks.lit.mssha1 as mssha1
|
||||
from calibre.ebooks import DRMError
|
||||
from calibre.ebooks.lit import LitError
|
||||
from calibre.ebooks.lit import LitError, mssha1
|
||||
from calibre.ebooks.lit.maps import HTML_MAP, OPF_MAP
|
||||
from calibre.ebooks.oeb.base import urlnormalize, xpath
|
||||
from calibre.ebooks.oeb.reader import OEBReader
|
||||
|
||||
@ -20,8 +20,7 @@ from struct import pack
|
||||
from lxml import etree
|
||||
|
||||
import calibre
|
||||
import calibre.ebooks.lit.maps as maps
|
||||
import calibre.ebooks.lit.mssha1 as mssha1
|
||||
from calibre.ebooks.lit import maps, mssha1
|
||||
from calibre.ebooks.lit.lzx import Compressor
|
||||
from calibre.ebooks.lit.reader import DirectoryEntry
|
||||
from calibre.ebooks.oeb.base import CSS_MIME, OEB_DOCS, OEB_STYLES, OPF_MIME, XHTML_MIME, XML, XML_NS, prefixname, urlnormalize
|
||||
|
||||
@ -137,7 +137,7 @@ def initialize_calibre():
|
||||
|
||||
#
|
||||
# Setup resources
|
||||
import calibre.utils.resources as resources
|
||||
from calibre.utils import resources
|
||||
resources
|
||||
|
||||
#
|
||||
|
||||
@ -8,7 +8,7 @@ import sys
|
||||
import unittest
|
||||
from contextlib import contextmanager
|
||||
|
||||
import calibre.utils.icu as icu
|
||||
from calibre.utils import icu
|
||||
from polyglot.builtins import cmp, iteritems
|
||||
|
||||
|
||||
|
||||
@ -8,11 +8,11 @@ This module implements a simple commandline SMTP client that supports:
|
||||
* Background delivery with failures being saved in a maildir mailbox
|
||||
'''
|
||||
|
||||
import encodings.idna as idna
|
||||
import os
|
||||
import socket
|
||||
import sys
|
||||
import traceback
|
||||
from encodings import idna
|
||||
|
||||
from calibre import isbytestring
|
||||
from calibre.constants import iswindows
|
||||
@ -123,7 +123,7 @@ def sendmail_direct(from_, to, msg, timeout, localhost, verbose,
|
||||
debug_output=None):
|
||||
from email.message import Message
|
||||
|
||||
import polyglot.smtplib as smtplib
|
||||
from polyglot import smtplib
|
||||
hosts = get_mx(to.split('@')[-1].strip(), verbose)
|
||||
timeout=None # Non blocking sockets sometimes don't work
|
||||
kwargs = dict(timeout=timeout, local_hostname=sanitize_hostname(localhost or safe_localhost()))
|
||||
@ -154,7 +154,7 @@ def get_smtp_class(use_ssl=False, debuglevel=0):
|
||||
# in the constructor, because of https://bugs.python.org/issue36094
|
||||
# which means the constructor calls connect(),
|
||||
# but there is no way to set debuglevel before connect() is called
|
||||
import polyglot.smtplib as smtplib
|
||||
from polyglot import smtplib
|
||||
cls = smtplib.SMTP_SSL if use_ssl else smtplib.SMTP
|
||||
bases = (cls,)
|
||||
return type(native_string_type('SMTP'), bases, {native_string_type('debuglevel'): debuglevel})
|
||||
|
||||
@ -11,8 +11,8 @@ from queue import Queue
|
||||
from threading import Lock, Thread
|
||||
from typing import Any, NamedTuple
|
||||
|
||||
import calibre_extensions.piper as piper
|
||||
from calibre.constants import ismacos, iswindows
|
||||
from calibre_extensions import piper
|
||||
|
||||
DEFAULT_LENGTH_SCALE = 1.0
|
||||
DEFAULT_NOISE_SCALE = 0.667
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user