Skip to content

Commit

Permalink
fix(export_common: ExportWrapper: __new__): suppress known gi warning…
Browse files Browse the repository at this point in the history
… to not confuse the end users
  • Loading branch information
actionless committed Jun 19, 2024
1 parent 9720e11 commit 5ad0811
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions oomox_gui/export_common.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import os
import subprocess
import sys
import tempfile
import warnings
from threading import Thread
from typing import (
TYPE_CHECKING,
Expand Down Expand Up @@ -86,9 +88,30 @@ def __new__( # type: ignore[misc]
break
new_mro.append(base)
new_mro += list(base_class.__mro__)
new_class = type(cls.__name__, tuple(new_mro), dict(cls.__dict__))
new_class: type[ExportBaseClassT]
with warnings.catch_warnings(record=True) as warn_list:
new_class = type(cls.__name__, tuple(new_mro), dict(cls.__dict__))
for warn in warn_list:
if (
(not sys.warnoptions)
and (warn.category is RuntimeWarning)
and (isinstance(warn.message, Warning))
and (warn.message.args)
and (
warn.message.args[0]
== "Interface type gobject.GInterface has no Python implementation support",
)
):
pass
else:
warnings.showwarning(
message=warn.message,
category=warn.category,
filename=warn.filename,
lineno=warn.lineno,
)
nongobject_check_class_for_gobject_metas(new_class)
result: ExportBaseClassT = super( # type: ignore[arg-type] # pylint: disable=bad-super-call
result: ExportBaseClassT = super( # type: ignore[arg-type] # pylint: disable=bad-super-call,no-value-for-parameter # noqa: E501,RUF100
base_class, new_class,
).__new__(new_class)
result.base_class = base_class # type: ignore[assignment]
Expand Down

0 comments on commit 5ad0811

Please sign in to comment.