remove unnecessary stuff
This commit is contained in:
@@ -1,25 +1 @@
|
||||
from inspect import isclass
|
||||
from pkgutil import iter_modules
|
||||
from pathlib import Path
|
||||
from importlib import import_module
|
||||
from src.pluginbase import PluginBase
|
||||
|
||||
# iterate through the modules in the current package
|
||||
from src.pluginregistry import PluginRegistry
|
||||
|
||||
if False:
|
||||
package_dir = Path(__file__).resolve().parent
|
||||
for (_, module_name, _) in iter_modules([str(package_dir)]):
|
||||
# import the module and iterate through its attributes
|
||||
module = import_module(f"{__name__}.{module_name}")
|
||||
print("module: %s" % module)
|
||||
|
||||
for attribute_name in dir(module):
|
||||
if attribute_name == "PluginBase":
|
||||
continue
|
||||
attribute = getattr(module, attribute_name)
|
||||
|
||||
if isclass(attribute) and issubclass(attribute, PluginBase):
|
||||
globals()[attribute_name] = attribute
|
||||
PluginRegistry.register_plugin(attribute_name, attribute)
|
||||
print("%s -> %s :: %s in %s" % (attribute_name, attribute, module_name, module))
|
||||
|
||||
@@ -5,7 +5,6 @@ from pathlib import Path
|
||||
class Icon(QIcon):
|
||||
def __init__(self, file_name: str):
|
||||
super(Icon, self).__init__("%s" % Path(__file__).parent.parent.parent.joinpath(file_name).absolute())
|
||||
print("%s -> %s" % (file_name, Path(__file__).parent.parent.parent.joinpath(file_name).absolute()))
|
||||
|
||||
def fromTheme(icon_from_theme: str) -> QIcon:
|
||||
return QIcon.fromTheme(icon_from_theme)
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import unittest
|
||||
|
||||
def humanbytes(bytes: int) -> str:
|
||||
"""non-localized conversion of bytes to human readable strings"""
|
||||
powers = {0: 'bytes', 1: 'KB', 2: 'MB', 3: 'GB', 4: 'TB', 5: 'PB', 6: 'EB'}
|
||||
@@ -13,17 +11,3 @@ def humanbytes(bytes: int) -> str:
|
||||
power = power + 1
|
||||
return result
|
||||
|
||||
|
||||
class TestLogFileModel(unittest.TestCase):
|
||||
|
||||
def test_humanbytes(self):
|
||||
inputs = {
|
||||
0: "0 bytes",
|
||||
1023: "1023 bytes",
|
||||
1024: "1 KB",
|
||||
1048575: "1023.999 KB",
|
||||
1048576: "1 MB",
|
||||
}
|
||||
for input in inputs.keys():
|
||||
actual = humanbytes(input)
|
||||
self.assertEqual(inputs[input], actual)
|
||||
|
||||
Reference in New Issue
Block a user