mirror of
https://git.disroot.org/pranav/pybatmesh.git
synced 2025-01-14 18:52:08 +05:30
cleaned up code
This commit is contained in:
parent
761618aff4
commit
8ba8d6af6c
@ -23,7 +23,6 @@ TODO: Add more details
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from shutil import copy
|
|
||||||
from dasbus.connection import SystemMessageBus
|
from dasbus.connection import SystemMessageBus
|
||||||
|
|
||||||
|
|
||||||
@ -31,13 +30,6 @@ NETWORKD_BUS = "org.freedesktop.network1"
|
|||||||
NETWORKD_PATH = "/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:
|
class NetworkD:
|
||||||
"""control systemd-networkd"""
|
"""control systemd-networkd"""
|
||||||
|
|
||||||
|
@ -28,7 +28,6 @@ When run from the commandline, the function main() is called.
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from shutil import copy
|
|
||||||
from dasbus.error import DBusError
|
from dasbus.error import DBusError
|
||||||
from systemd.daemon import notify
|
from systemd.daemon import notify
|
||||||
from naxalnet import __version__
|
from naxalnet import __version__
|
||||||
@ -43,9 +42,9 @@ from naxalnet.network import NetworkD
|
|||||||
def get_sorted_glob(directory: str, glob: str):
|
def get_sorted_glob(directory: str, glob: str):
|
||||||
"""return sorted list of filenames matching glob"""
|
"""return sorted list of filenames matching glob"""
|
||||||
path = Path(directory)
|
path = Path(directory)
|
||||||
g = path.glob(glob)
|
glob_list = path.glob(glob)
|
||||||
sorted_list = []
|
sorted_list = []
|
||||||
for i in g:
|
for i in glob_list:
|
||||||
# g is a list of PosixPath objects.
|
# g is a list of PosixPath objects.
|
||||||
# So we add their absolute path as str.
|
# So we add their absolute path as str.
|
||||||
sorted_list.append(str(i))
|
sorted_list.append(str(i))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user