36 lines
1.2 KiB
Python
36 lines
1.2 KiB
Python
import os, sys, importlib, glob, inspect, itertools
|
|
|
|
class BasenameCombinator():
|
|
|
|
IDENTIFIER = 'basename'
|
|
|
|
BASENAME = 'media'
|
|
|
|
def __init__(self, context = None):
|
|
self._context = context
|
|
self._logger = context['logger']
|
|
self._reportLogger = context['report_logger']
|
|
|
|
def getIdentifier(self):
|
|
return BasenameCombinator.IDENTIFIER
|
|
|
|
@staticmethod
|
|
def list():
|
|
basePath = os.path.dirname(__file__)
|
|
return [os.path.basename(p)[20:-3]
|
|
for p
|
|
in glob.glob(f"{ basePath }/basename_combinator_*.py", recursive = True)
|
|
if p != __file__]
|
|
|
|
@staticmethod
|
|
def getClassReference(identifier):
|
|
importlib.import_module(f"ffx.test.basename_combinator_{ identifier }")
|
|
for name, obj in inspect.getmembers(sys.modules[f"ffx.test.basename_combinator_{ identifier }"]):
|
|
#HINT: Excluding MediaCombinator as it seems to be included by import (?)
|
|
if inspect.isclass(obj) and name != 'BasenameCombinator' and name.startswith('BasenameCombinator'):
|
|
return obj
|
|
|
|
@staticmethod
|
|
def getAllClassReferences():
|
|
return [BasenameCombinator.getClassReference(i) for i in BasenameCombinator.list()]
|