Commit 09f21701 authored by Jean Rebiffe's avatar Jean Rebiffe
Browse files

mypy on lncc.py

parent 69ae15a2
Loading
Loading
Loading
Loading
+12 −11
Original line number Diff line number Diff line
@@ -69,12 +69,12 @@ class NetworkElement:
    name: str
    params: Dict[str, str] = field(compare=False)
    conn: Optional[manager.Manager] = field(default=None, compare=False)
    replies: Optional[Dict[str,
                           ncclient.operations.retrieve.GetReply]] = field(
    replies: Dict[str,
                           ncclient.operations.retrieve.GetReply] = field(
                               default_factory=dict, compare=False)
    tables: Optional[Dict[str, pandas.DataFrame]] = field(default_factory=dict,
    tables: Dict[str, pandas.DataFrame] = field(default_factory=dict,
                                                          compare=False)
    configs: Optional[Dict[str, str]] = field(default_factory=dict,
    configs: Dict[str, str] = field(default_factory=dict,
                                              compare=False)
    mappings: Dict[str, Dict[str, str]] = field(default_factory=dict,
                                                compare=False)
@@ -179,8 +179,8 @@ class NetworkElement:
class NetworkElementGroup(collections.UserDict):
    """Represent a Group of Network Element"""

    tables: Dict[str, pandas.DataFrame] = dict()
    mappings: Dict[str, Dict[str, str]] = dict()
    tables: Dict[str, pandas.DataFrame] = {}
    mappings: Dict[str, Dict[str, str]] = {}

    @staticmethod
    def from_dict(dic: dict) -> "NetworkElementGroup":
@@ -248,7 +248,7 @@ class NetworkElementGroup(collections.UserDict):

    def table_concat(self, table: str = "get") -> pandas.DataFrame:
        # TODO(Jean): Refactoring needed?
        tables = list()
        tables = []
        for name, state in self.items():
            # print(state)
            tmp_tb = state.tables[table].copy()
@@ -607,10 +607,11 @@ class LnccCli(cmd2.Cmd):
            self.do_help("netconf")
            return

        items = vars(args).items()
        items = filter(lambda item: not item[0].startswith("cmd2_"), items)
        items = filter(lambda item: item[1] is not None, items)
        kwargs = dict(items)
        items1 = vars(args).items()
        items2 = filter(lambda item: not item[0].startswith("cmd2_"), items1)
        items3 = filter(lambda item: item[1] is not None, items2)
        kwargs = dict(items3)


        if "reply" not in kwargs:
            kwargs["reply"] = kwargs["operation"]