cleaned up code

This commit is contained in:
Pranav Jerry 2021-09-27 11:43:50 +05:30
parent 761618aff4
commit 8ba8d6af6c
Signed by: pranav
GPG Key ID: F1DCDC4FED0A0C5B
2 changed files with 2 additions and 11 deletions

View File

@ -23,7 +23,6 @@ TODO: Add more details
"""
from pathlib import Path
from shutil import copy
from dasbus.connection import SystemMessageBus
@ -31,13 +30,6 @@ NETWORKD_BUS = "org.freedesktop.network1"
NETWORKD_PATH = "/org/freedesktop/network1"
def copy_glob(directory: str, glob: str, destination: str) -> None:
"""copy files in directory matching the glob to destination"""
match = Path(directory).glob(glob)
for i in match:
copy(i, destination)
class NetworkD:
"""control systemd-networkd"""

View File

@ -28,7 +28,6 @@ When run from the commandline, the function main() is called.
import sys
from pathlib import Path
from shutil import copy
from dasbus.error import DBusError
from systemd.daemon import notify
from naxalnet import __version__
@ -43,9 +42,9 @@ from naxalnet.network import NetworkD
def get_sorted_glob(directory: str, glob: str):
"""return sorted list of filenames matching glob"""
path = Path(directory)
g = path.glob(glob)
glob_list = path.glob(glob)
sorted_list = []
for i in g:
for i in glob_list:
# g is a list of PosixPath objects.
# So we add their absolute path as str.
sorted_list.append(str(i))