Skip to content
This repository has been archived by the owner on Apr 22, 2024. It is now read-only.

Commit

Permalink
Fix linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
rmotitsuki committed May 22, 2019
1 parent c4ae907 commit 484036a
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 7 deletions.
5 changes: 3 additions & 2 deletions kytos/core/api_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class APIServer:
_NAPP_PREFIX = "/api/{napp.username}/{napp.name}/"
_CORE_PREFIX = "/api/kytos/core/"

# pylint: disable=too-many-arguments
def __init__(self, app_name, listen='0.0.0.0', port=8181,
napps_manager=None, napps_dir=None):
"""Start a Flask+SocketIO server.
Expand Down Expand Up @@ -464,12 +465,12 @@ def _get_napp_metadata(self, username, napp_name, key):
napp_dependencies, description, version.
"""
_VALID_KEYS = ['napp_dependencies', 'description', 'version']
valid_keys = ['napp_dependencies', 'description', 'version']

if not self.napps_manager.is_installed(username, napp_name):
return "NApp is not installed.", HTTPStatus.BAD_REQUEST.value

if key not in _VALID_KEYS:
if key not in valid_keys:
return "Invalid key.", HTTPStatus.BAD_REQUEST.value

data = self.napps_manager.get_napp_metadata(username, napp_name, key)
Expand Down
2 changes: 1 addition & 1 deletion kytos/core/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import logging
from enum import Enum
from errno import EBADF, ENOTCONN
from socket import error as SocketError
from socket import SHUT_RDWR
from socket import error as SocketError

__all__ = ('Connection', 'ConnectionProtocol', 'ConnectionState')

Expand Down
4 changes: 2 additions & 2 deletions kytos/core/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
import sys
import threading
from concurrent.futures import ThreadPoolExecutor
from importlib import reload as reload_module
from importlib import import_module
from importlib import reload as reload_module
from importlib.util import module_from_spec, spec_from_file_location
from pathlib import Path

Expand Down Expand Up @@ -571,7 +571,7 @@ def set_switch_options(self, dpid):
self.log.error("Invalid vlan_pool settings: %s", err)

if vlan_pool.get(dpid):
self.log.info(f"Loading vlan_pool configuration for dpid {dpid}")
self.log.info("Loading vlan_pool configuration for dpid %s", dpid)
for intf_num, port_list in vlan_pool[dpid].items():
if not switch.interfaces.get((intf_num)):
vlan_ids = set()
Expand Down
1 change: 1 addition & 0 deletions kytos/core/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ def id(self): # pylint: disable=invalid-name
Returns:
string: Interface id.
"""
return "{}:{}".format(self.switch.dpid, self.port_number)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_core/test_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from pyof.v0x04.common.port import PortFeatures

from kytos.core.interface import Interface, TAG, TAGType
from kytos.core.interface import TAG, Interface, TAGType
from kytos.core.switch import Switch

logging.basicConfig(level=logging.CRITICAL)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_core/test_switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def tearDown(self):

def test_switch_vlan_pool_default(self):
"""Test default vlan_pool value."""
self.assertEqual(self.options.vlan_pool, {})
self.assertEqual(self.options.vlan_pool, '{}')

def test_switch_vlan_pool_options(self):
"""Test switch with the example from kytos.conf."""
Expand Down

0 comments on commit 484036a

Please sign in to comment.