1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-06-17 00:07:37 +02:00

make IfconfigParser class private

This commit is contained in:
Kelly Brazil
2021-04-08 14:00:56 -07:00
parent a5e2203cee
commit 4290a3cbd1
2 changed files with 3 additions and 9 deletions

View File

@ -194,12 +194,6 @@ info()
``` ```
Provides parser metadata (version, author, etc.) Provides parser metadata (version, author, etc.)
## IfconfigParser
```python
IfconfigParser(console_output)
```
ifconfig parser module written by threeheadedknight@protonmail.com
## parse ## parse
```python ```python
parse(data, raw=False, quiet=False) parse(data, raw=False, quiet=False)

View File

@ -206,7 +206,7 @@ class info():
__version__ = info.version __version__ = info.version
class IfconfigParser(object): class _IfconfigParser(object):
"""ifconfig parser module written by threeheadedknight@protonmail.com""" """ifconfig parser module written by threeheadedknight@protonmail.com"""
# Author: threeheadedknight@protonmail.com # Author: threeheadedknight@protonmail.com
# Date created: 30.06.2018 17:03 # Date created: 30.06.2018 17:03
@ -411,7 +411,7 @@ class IfconfigParser(object):
@staticmethod @staticmethod
def update_interface_details(interface): def update_interface_details(interface):
for attr in IfconfigParser.attributes: for attr in _IfconfigParser.attributes:
if attr not in interface: if attr not in interface:
interface[attr] = None interface[attr] = None
return namedtuple('Interface', interface.keys())(**interface) return namedtuple('Interface', interface.keys())(**interface)
@ -488,7 +488,7 @@ def parse(data, raw=False, quiet=False):
if jc.utils.has_data(data): if jc.utils.has_data(data):
parsed = IfconfigParser(console_output=data) parsed = _IfconfigParser(console_output=data)
interfaces = parsed.get_interfaces() interfaces = parsed.get_interfaces()
# convert ifconfigparser output to a dictionary # convert ifconfigparser output to a dictionary