From 0b825e3abf6438753eda0823de4dbc0eb7f668ad Mon Sep 17 00:00:00 2001 From: dee077 Date: Fri, 30 Oct 2026 16:41:39 +0530 Subject: [PATCH] [deps] Dropped support for Python 3.10 #182 - Built the PyPI package with Python 3.11 since Python 3.10 reached end of life. - Removed the Python 2 urlparse and mock import fallbacks. - Removed the Python 2 coding declaration from runtests.py. Closes #182 --- .github/workflows/pypi.yml | 2 +- netdiff/parsers/base.py | 6 +----- netdiff/parsers/cnml.py | 6 +----- runtests.py | 1 - tests/test_base.py | 6 +----- 5 files changed, 4 insertions(+), 17 deletions(-) diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index 3d877f9..537e6eb 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -29,7 +29,7 @@ jobs: - name: Set up Python uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7 with: - python-version: "3.10" + python-version: "3.11" - name: Install dependencies run: | pip install -U pip diff --git a/netdiff/parsers/base.py b/netdiff/parsers/base.py index 033306f..512ca27 100644 --- a/netdiff/parsers/base.py +++ b/netdiff/parsers/base.py @@ -1,4 +1,5 @@ import json +from urllib import parse as urlparse import networkx import requests @@ -7,11 +8,6 @@ from ..exceptions import ConversionException, TopologyRetrievalError from ..utils import _netjson_networkgraph, diff -try: - import urlparse -except ImportError: # pragma: no cover - from urllib import parse as urlparse # pragma: no cover - class BaseParser(object): """ diff --git a/netdiff/parsers/cnml.py b/netdiff/parsers/cnml.py index 52d81f4..657419f 100644 --- a/netdiff/parsers/cnml.py +++ b/netdiff/parsers/cnml.py @@ -1,15 +1,11 @@ import os +from urllib import parse as urlparse import libcnml from ..exceptions import ParserError from .base import BaseParser -try: - import urlparse -except ImportError: - from urllib import parse as urlparse - class CnmlParser(BaseParser): """CNML 0.1 parser""" diff --git a/runtests.py b/runtests.py index 696a716..ef5d562 100755 --- a/runtests.py +++ b/runtests.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- try: import nose2 diff --git a/tests/test_base.py b/tests/test_base.py index 19176d4..f3afce6 100644 --- a/tests/test_base.py +++ b/tests/test_base.py @@ -1,5 +1,6 @@ import os import unittest +from unittest import mock import responses from requests.exceptions import ConnectionError @@ -11,11 +12,6 @@ from netdiff.parsers.base import BaseParser from netdiff.utils import _netjson_networkgraph -try: - from unittest import mock -except ImportError: - import mock - class TestBaseParser(unittest.TestCase): """BaseParser tests"""