Skip to content

Commit

Permalink
Remove the use of six
Browse files Browse the repository at this point in the history
  • Loading branch information
JennToo committed Aug 3, 2021
1 parent b881152 commit 41a80e2
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 20 deletions.
20 changes: 5 additions & 15 deletions netconf_client/ncclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import logging
import inspect
from concurrent.futures import CancelledError, TimeoutError
from six.moves.queue import Empty
from lxml import etree
from queue import Empty
import time

import six
from lxml import etree

from netconf_client.error import RpcError
from netconf_client.rpc import (
Expand All @@ -26,16 +26,6 @@
delete_config,
)

if six.PY3:
from time import monotonic

_get_current_timestamp = monotonic
else:
from time import time

_get_current_timestamp = time


# Defines the scope for netconf traces
_logger = logging.getLogger("netconf_client.manager")

Expand Down Expand Up @@ -221,7 +211,7 @@ def _send_rpc(self, rpc_xml):
(raw, ele) = (None, None)
self._log_rpc_request(rpc_xml)

current_timestamp = _get_current_timestamp()
current_timestamp = time.monotonic()
end_timestamp = current_timestamp + self.timeout
try:
f = self.session.send_rpc(rpc_xml)
Expand All @@ -236,7 +226,7 @@ def _send_rpc(self, rpc_xml):
self._log_rpc_response(raw)
return (raw, ele)
except TimeoutError:
current_timestamp = _get_current_timestamp()
current_timestamp = time.monotonic()
if current_timestamp >= end_timestamp:
raise
except CancelledError:
Expand Down
2 changes: 1 addition & 1 deletion netconf_client/session.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from threading import Thread
from concurrent.futures import Future
from queue import Queue, Empty

from six.moves.queue import Queue, Empty
from lxml import etree

from netconf_client.parser import parse_messages
Expand Down
2 changes: 1 addition & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ classifiers = [

[tool.poetry.dependencies]
python = "^3.6.2"
six = "^1.16.0"
lxml = "^4.6.3"
paramiko = "^2.7.2"

Expand Down
3 changes: 2 additions & 1 deletion test/test_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
import logging
import re
from unittest.mock import patch
from queue import Empty

from lxml import etree
from six.moves.queue import Empty
import pytest

from netconf_client.ncclient import Manager, convert_filter, from_ele, to_ele
Expand Down
3 changes: 2 additions & 1 deletion test/test_session.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from six.moves.queue import Queue
from queue import Queue

import pytest

from common import RPC_ERROR_WITHOUT_MSG
Expand Down

0 comments on commit 41a80e2

Please sign in to comment.