Skip to content

Commit

Permalink
Use the builtin nullcontext
Browse files Browse the repository at this point in the history
ASIM-5273
  • Loading branch information
prusse-martin committed Oct 31, 2023
1 parent 1d8cbbf commit 03d7b91
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
12 changes: 1 addition & 11 deletions src/qmxgraph/api.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import sys
import textwrap
import weakref
from contextlib import contextmanager
from contextlib import nullcontext
from typing import Any
from typing import Generator
from typing import List
Expand Down Expand Up @@ -1020,13 +1020,3 @@ def handle_message(msg_type, context, message):
yield messages
finally:
qInstallMessageHandler(previous_handler)


if sys.version_info[:] < (3, 7):

@contextmanager
def nullcontext(enter_result=None):
yield enter_result

else:
from contextlib import nullcontext
2 changes: 1 addition & 1 deletion tests/test_qt_js_integration.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import json
import re
import textwrap
from contextlib import nullcontext
from functools import partial

import pytest
import pytestqt.exceptions
from _pytest.compat import nullcontext
from PyQt5.QtCore import QByteArray
from PyQt5.QtCore import QDataStream
from PyQt5.QtCore import QIODevice
Expand Down

0 comments on commit 03d7b91

Please sign in to comment.