Skip to content

Commit

Permalink
Merge 1775e25 into 32d7a63
Browse files Browse the repository at this point in the history
  • Loading branch information
DaffyTheDuck committed Jan 15, 2020
2 parents 32d7a63 + 1775e25 commit 6a9b2f4
Show file tree
Hide file tree
Showing 16 changed files with 18 additions and 33 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ language: python
cache: pip

python:
- "3.5"
- "2.7"
- "3.6"
- "3.7"

branches:
only:
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ The data which was retrieved from network/storage can be accessed via the "data"
def to_python(self, data):
try:
return super(OlsrParser, self).to_python(data)
return super().to_python(data)
except ConversionException as e:
return self._txtinfo_to_jsoninfo(e.data)
Expand Down
3 changes: 1 addition & 2 deletions netdiff/parsers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

import networkx
import requests
import six

from ..exceptions import ConversionException, TopologyRetrievalError
from ..utils import _netjson_networkgraph, diff
Expand Down Expand Up @@ -85,7 +84,7 @@ def to_python(self, data):
"""
if isinstance(data, dict):
return data
elif isinstance(data, six.string_types):
elif isinstance(data, str):
# assuming is JSON
try:
return json.loads(data)
Expand Down
2 changes: 1 addition & 1 deletion netdiff/parsers/batman.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def to_python(self, data):
Adds support for txtinfo format
"""
try:
return super(BatmanParser, self).to_python(data)
return super().to_python(data)
except ConversionException as e:
return self._txtinfo_to_python(e.data)

Expand Down
3 changes: 1 addition & 2 deletions netdiff/parsers/cnml.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import os

import libcnml
import six

from ..exceptions import ParserError
from .base import BaseParser
Expand All @@ -19,7 +18,7 @@ class CnmlParser(BaseParser):
metric = None

def to_python(self, data):
if isinstance(data, six.string_types):
if isinstance(data, str):
up = urlparse.urlparse(data)
# if it looks like a file path
if os.path.isfile(data) or up.scheme in ['http', 'https']:
Expand Down
2 changes: 1 addition & 1 deletion netdiff/parsers/olsr.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def to_python(self, data):
Adds support for txtinfo format
"""
try:
return super(OlsrParser, self).to_python(data)
return super().to_python(data)
except ConversionException as e:
return self._txtinfo_to_jsoninfo(e.data)

Expand Down
3 changes: 1 addition & 2 deletions requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
nose
coveralls
responses>0.5.0,<0.11.0
mock
openwisp-utils[qa]>=0.3.0
openwisp-utils[qa]>=0.4.0
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
requests<3.0
six
libcnml<0.10.0
openvpn-status>=0.2,<0.3
6 changes: 1 addition & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@ def get_install_requires():
continue
# add line to requirements
requirements.append(line.replace('\n', ''))
if sys.version_info.major >= 3:
requirements.append("networkx>=2.0,<2.5")
else:
requirements.append("networkx>=2.0,<2.3")
return requirements


Expand Down Expand Up @@ -71,8 +68,7 @@ def get_install_requires():
'Operating System :: OS Independent',
'Programming Language :: Python',
'Topic :: System :: Networking',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3',
],
install_requires=get_install_requires(),
test_suite='nose.collector'
Expand Down
3 changes: 1 addition & 2 deletions tests/test_batman.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import os

import networkx
import six

from netdiff import BatmanParser, diff
from netdiff.exceptions import ParserError
Expand Down Expand Up @@ -67,7 +66,7 @@ def test_json_dict(self):
def test_json_string(self):
p = BatmanParser(iulinet)
data = p.json()
self.assertIsInstance(data, six.string_types)
self.assertIsInstance(data, str)
self.assertIn('NetworkGraph', data)
self.assertIn('protocol', data)
self.assertIn('version', data)
Expand Down
3 changes: 1 addition & 2 deletions tests/test_batman_txtinfo.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import os

import networkx
import six

from netdiff import BatmanParser, diff
from netdiff.exceptions import ParserError
Expand Down Expand Up @@ -43,7 +42,7 @@ def test_json_dict(self):
def test_json_string(self):
p = BatmanParser(iulinet)
data = p.json()
self.assertIsInstance(data, six.string_types)
self.assertIsInstance(data, str)
self.assertIn('NetworkGraph', data)
self.assertIn('protocol', data)
self.assertIn('version', data)
Expand Down
3 changes: 1 addition & 2 deletions tests/test_bmx6.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import os

import networkx
import six

from netdiff import Bmx6Parser, diff
from netdiff.exceptions import ParserError
Expand Down Expand Up @@ -49,7 +48,7 @@ def test_json_dict(self):
def test_json_string(self):
p = Bmx6Parser(topo)
data = p.json()
self.assertIsInstance(data, six.string_types)
self.assertIsInstance(data, str)
self.assertIn('NetworkGraph', data)
self.assertIn('protocol', data)
self.assertIn('version', data)
Expand Down
3 changes: 1 addition & 2 deletions tests/test_cnml.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import libcnml
import networkx
import six

from netdiff import CnmlParser, diff
from netdiff.exceptions import ParserError
Expand Down Expand Up @@ -41,7 +40,7 @@ def test_json_dict(self):
def test_json_string(self):
p = CnmlParser(cnml1)
data = p.json()
self.assertIsInstance(data, six.string_types)
self.assertIsInstance(data, str)
self.assertIn('NetworkGraph', data)
self.assertIn('protocol', data)
self.assertIn('version', data)
Expand Down
7 changes: 3 additions & 4 deletions tests/test_netjson.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import os

import networkx
import six

from netdiff import NetJsonParser, diff
from netdiff.exceptions import ParserError
Expand All @@ -26,7 +25,7 @@ def test_parse(self):
# test additional properties in nodes of networkx graph
properties = list(p.graph.nodes(data=True))[0][1]
self.assertIsInstance(properties['local_addresses'], list)
self.assertIsInstance(properties['hostname'], six.string_types)
self.assertIsInstance(properties['hostname'], str)

def test_parse_directed(self):
p = NetJsonParser(links2, directed=True)
Expand All @@ -40,7 +39,7 @@ def test_parse_directed(self):
# test additional properties in nodes of networkx graph
properties = list(p.graph.nodes(data=True))[0][1]
self.assertIsInstance(properties['local_addresses'], list)
self.assertIsInstance(properties['hostname'], six.string_types)
self.assertIsInstance(properties['hostname'], str)

def test_parse_string_graph(self):
data = """{
Expand Down Expand Up @@ -229,7 +228,7 @@ def test_json_dict(self):
def test_json_string(self):
p = NetJsonParser(links2)
data = p.json()
self.assertIsInstance(data, six.string_types)
self.assertIsInstance(data, str)
self.assertIn('NetworkGraph', data)
self.assertIn('protocol', data)
self.assertIn('version', data)
Expand Down
3 changes: 1 addition & 2 deletions tests/test_olsr.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import os

import networkx
import six

from netdiff import OlsrParser, diff
from netdiff.exceptions import ParserError
Expand Down Expand Up @@ -81,7 +80,7 @@ def test_json_dict(self):
def test_json_string(self):
p = OlsrParser(links2)
data = p.json()
self.assertIsInstance(data, six.string_types)
self.assertIsInstance(data, str)
self.assertIn('NetworkGraph', data)
self.assertIn('protocol', data)
self.assertIn('version', data)
Expand Down
3 changes: 1 addition & 2 deletions tests/test_olsr_txtinfo.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import os

import networkx
import six

from netdiff import OlsrParser, diff
from netdiff.exceptions import ParserError
Expand Down Expand Up @@ -70,7 +69,7 @@ def test_json_dict(self):
def test_json_string(self):
p = OlsrParser(links2)
data = p.json()
self.assertIsInstance(data, six.string_types)
self.assertIsInstance(data, str)
self.assertIn('NetworkGraph', data)
self.assertIn('protocol', data)
self.assertIn('version', data)
Expand Down

0 comments on commit 6a9b2f4

Please sign in to comment.