Skip to content

Commit

Permalink
🚨 fix linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
techouse committed Jun 8, 2024
1 parent 5c5b248 commit cfdf2af
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions src/sqlite3_to_mysql/transporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,29 +69,29 @@ def __init__(self, **kwargs: tx.Unpack[SQLite3toMySQLParams]):

self._mysql_password = str(kwargs.get("mysql_password")) or None

self._mysql_host = kwargs.get("mysql_host", "localhost")
self._mysql_host = str(kwargs.get("mysql_host", "localhost"))

self._mysql_port = kwargs.get("mysql_port", 3306)
self._mysql_port = kwargs.get("mysql_port", 3306) or 3306

self._sqlite_tables = kwargs.get("sqlite_tables", tuple())
self._sqlite_tables = kwargs.get("sqlite_tables") or tuple()

self._without_foreign_keys = len(self._sqlite_tables) > 0 or kwargs.get("without_foreign_keys", False)
self._without_foreign_keys = bool(self._sqlite_tables) or bool(kwargs.get("without_foreign_keys", False))

self._mysql_ssl_disabled = kwargs.get("mysql_ssl_disabled", False)
self._mysql_ssl_disabled = bool(kwargs.get("mysql_ssl_disabled", False))

self._chunk_size = kwargs.get("chunk", None)
self._chunk_size = bool(kwargs.get("chunk"))

self._quiet = kwargs.get("quiet", False)
self._quiet = bool(kwargs.get("quiet", False))

self._logger = self._setup_logger(log_file=kwargs.get("log_file", None), quiet=self._quiet)

self._mysql_database = kwargs.get("mysql_database", "transfer")
self._mysql_database = kwargs.get("mysql_database", "transfer") or "transfer"

self._mysql_insert_method = str(kwargs.get("mysql_integer_type", "IGNORE")).upper()
if self._mysql_insert_method not in MYSQL_INSERT_METHOD:
self._mysql_insert_method = "IGNORE"

self._mysql_truncate_tables = kwargs.get("mysql_truncate_tables", False)
self._mysql_truncate_tables = bool(kwargs.get("mysql_truncate_tables", False))

self._mysql_integer_type = str(kwargs.get("mysql_integer_type", "INT(11)")).upper()

Expand All @@ -101,19 +101,19 @@ def __init__(self, **kwargs: tx.Unpack[SQLite3toMySQLParams]):
if self._mysql_text_type not in MYSQL_TEXT_COLUMN_TYPES:
self._mysql_text_type = "TEXT"

self._mysql_charset = kwargs.get("mysql_charset", "utf8mb4")
self._mysql_charset = kwargs.get("mysql_charset", "utf8mb4") or "utf8mb4"

self._mysql_collation = (
kwargs.get("mysql_collation") or CharacterSet().get_default_collation(self._mysql_charset.lower())[0]
)
if not kwargs.get("mysql_collation") and self._mysql_collation == "utf8mb4_0900_ai_ci":
self._mysql_collation = "utf8mb4_general_ci"

self._ignore_duplicate_keys = kwargs.get("ignore_duplicate_keys", False)
self._ignore_duplicate_keys = kwargs.get("ignore_duplicate_keys", False) or False

self._use_fulltext = kwargs.get("use_fulltext", False)
self._use_fulltext = kwargs.get("use_fulltext", False) or False

self._with_rowid = kwargs.get("with_rowid", False)
self._with_rowid = kwargs.get("with_rowid", False) or False

sqlite3.register_adapter(Decimal, adapt_decimal)
sqlite3.register_converter("DECIMAL", convert_decimal)
Expand All @@ -130,8 +130,8 @@ def __init__(self, **kwargs: tx.Unpack[SQLite3toMySQLParams]):
self._sqlite_version = self._get_sqlite_version()
self._sqlite_table_xinfo_support = check_sqlite_table_xinfo_support(self._sqlite_version)

self._mysql_create_tables = kwargs.get("mysql_create_tables", True)
self._mysql_transfer_data = kwargs.get("mysql_transfer_data", True)
self._mysql_create_tables = bool(kwargs.get("mysql_create_tables", True))
self._mysql_transfer_data = bool(kwargs.get("mysql_transfer_data", True))

if not self._mysql_transfer_data and not self._mysql_create_tables:
raise ValueError("Unable to continue without transferring data or creating tables!")
Expand Down

0 comments on commit cfdf2af

Please sign in to comment.