Ejemplo n.º 1
0
 def test_napp_id_not_found(self):
     """If NApp ID is not found, should use root logger."""
     self._set_filename('not/an/expected/NApp/path.py')
     root_logger = logging.getLogger()
     napp_logger = NAppLog()
     self.assertEqual(root_logger.name, napp_logger.name)
Ejemplo n.º 2
0
 def test_napp_id_detection(self):
     """Test NApp ID detection based on filename."""
     self._set_filename('/napps/username/name/main.py')
     expected_logger_name = 'username/name'
     napp_logger = NAppLog()
     self.assertEqual(expected_logger_name, napp_logger.name)
Ejemplo n.º 3
0
import json
import os
import re
import sys
import tarfile
import urllib
from abc import ABCMeta, abstractmethod
from pathlib import Path
from random import randint
from threading import Event, Thread

from kytos.core.logs import NAppLog

__all__ = ('KytosNApp',)

LOG = NAppLog()


class NApp:
    """Class to represent a NApp."""

    # pylint: disable=too-many-arguments
    def __init__(self, username=None, name=None, version=None,
                 repository=None, meta=False):
        self.username = username
        self.name = name
        self.version = version if version else 'latest'
        self.repository = repository
        self.meta = meta
        self.description = None
        self.tags = []
Ejemplo n.º 4
0
"""Kytos.core is the module with main classes used in Kytos."""
from kytos.core.controller import Controller
from kytos.core.events import KytosEvent
from kytos.core.logs import NAppLog
from kytos.core.napps import KytosNApp, rest

from .metadata import __version__

__all__ = ('Controller', 'KytosEvent', 'KytosNApp', 'log', 'rest',
           '__version__')

# Kept lowercase to be more user friendly.
log = NAppLog()  # pylint: disable=invalid-name
Ejemplo n.º 5
0
import json
import os
import re
import sys
import tarfile
import urllib
from abc import ABCMeta, abstractmethod
from pathlib import Path
from random import randint
from threading import Event, Thread

from kytos.core.logs import NAppLog

__all__ = ('KytosNApp', )

log = NAppLog()  # noqa - no caps to be more friendly


class NApp:
    """Class to represent a NApp."""
    def __init__(self,
                 username=None,
                 name=None,
                 version=None,
                 repository=None):
        self.username = username
        self.name = name
        self.version = version
        self.repository = repository
        self.description = None
        self.tags = []