diff --git a/multiview_platform/mono_multi_view_classifiers/monoview_classifiers/adaboost_graalpy.py b/multiview_platform/mono_multi_view_classifiers/monoview_classifiers/adaboost_graal.py similarity index 100% rename from multiview_platform/mono_multi_view_classifiers/monoview_classifiers/adaboost_graalpy.py rename to multiview_platform/mono_multi_view_classifiers/monoview_classifiers/adaboost_graal.py diff --git a/multiview_platform/mono_multi_view_classifiers/utils/make_file_config.py b/multiview_platform/mono_multi_view_classifiers/utils/make_file_config.py index 9c24cff6b94af2fbf7baf6d10dd5691e03d05586..bb7c78a8fcc61be472304ebfa709f9afc888fdda 100644 --- a/multiview_platform/mono_multi_view_classifiers/utils/make_file_config.py +++ b/multiview_platform/mono_multi_view_classifiers/utils/make_file_config.py @@ -2,90 +2,120 @@ import os, sys, inspect from multiview_platform.mono_multi_view_classifiers.monoview_classifiers.adaboost import Adaboost - -class ConfigurationMaker(): - """ - - """ - - def __init__(self): - classifier_dict = {"0": [Adaboost, - multiview_platform.mono_multi_view_classifiers.monoview_classifiers.adaboost]} - for key, val in classifier_dict.items(): - - __import__(val[1], locals(), globals(), [], 1) - sig = inspect.signature(val[1]+"."+val[0]+".__init__") - print(sig) - for arg_idx, name in enumerate(sig.parameters): - print(arg_idx) - print(name) - - -def make(dir='.', output=None): - """ - Generate file config from classifier files - :param dir: (default'.' - :dir type: str or list of str - :return: - """ - - currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) - parentdir = os.path.dirname(currentdir) - sys.path.insert(0, parentdir) - - import mymodule - calling_module = inspect.getmodule(stack_frame[0]) - - - - -import os - -path = os.getcwd() + '/multiview_platform/' -files = [] -# r=root, d=directories, f = files -for r, d, f in os.walk(path): - print('dir', d) - print('root', r) - for file in f: - if '.py' in file and not file.startswith('__init__'): - print("file", file) - files.append(os.path.join(r, file)) - -for f in files: - print(f) - -for module in os.listdir(os.path.dirname(os.path.realpath(__file__))): - if module == '__init__.py' or module[-3:] != '.py': - continue - __import__(module[:-3], locals(), globals(), [], 1) - -import glob - -path = 'c:\\projects\\hc2\\' - -files = [f for f in glob.glob(path + "**/*.txt", recursive=True)] - -for f in files: - print(f) - -import inspect - - -# Import this to other module and call it -def print_caller_info(): - # Get the full stack - stack = inspect.stack() - - # Get one level up from current - previous_stack_frame = stack[1] - print(previous_stack_frame.filename) # Filename where caller lives - - # Get the module object of the caller - calling_module = inspect.getmodule(stack_frame[0]) - print(calling_module) - print(calling_module.__file__) - - -if __name__ == '__main__': - print_caller_info() \ No newline at end of file +import importlib + +classifier_dict = {"0": ['mono', Adaboost, + 'multiview_platform.mono_multi_view_classifiers.monoview_classifiers.adaboost']} +val = classifier_dict["0"] +mymodule = importlib.import_module(val[2]) +parameter = {"0":[]} +parameter +instring = "multiview_platform/mono_multi_view_classifiers/monoview_classifiers/" + +if instring in mymodule.__file__: + sig = inspect.signature(val[1].__init__) + for arg_idx, name in enumerate(sig.parameters): + param= sig.parameters[name] + if not name.startswith('self'): + parameter{"0"}.append(name) + + if param.default is not inspect.Parameter.empty: + value_default = param.default + else: + value_default = 'None' + print() + + +dir(mymodule) +if val[1] in dir(mymodule): + +# class ConfigurationMaker(): +# """ +# +# """ +# _path_classifier_mono = 'multiview_platform/mono_multi_view_classifier/monoview_classifiers' +# _path_classifier_multi = 'multiview_platform/mono_multi_view_classifier/multiview_classifier' +# +# def __init__(self ): +# classifier_dict = {"0": ['mono', Adaboost, +# 'multiview_platform.mono_multi_view_classifiers.monoview_classifiers.']} +# +# for key, val in classifier_dict.items(): +# mymodule = importlib.import_module(val[2]) +# module_file = mymodule.__file__ +# getattr(self._path_classifier_mono, module_file[:-3]) +# +# #__import__(val[1], locals(), globals(), [], 1) +# sig = inspect.signature(val[1]+"."+val[0]) +# print(sig) +# for arg_idx, name in enumerate(sig.parameters): +# print(arg_idx) +# print(name) +# +# +# def make(dir='.', output=None): +# """ +# Generate file config from classifier files +# :param dir: (default'.' +# :dir type: str or list of str +# :return: +# """ +# +# currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) +# parentdir = os.path.dirname(currentdir) +# sys.path.insert(0, parentdir) +# +# +# # calling_module = inspect.getmodule(stack_frame[0]) +# +# +# +# path = os.getcwd() + '/multiview_platform/' +# files = [] +# # r=root, d=directories, f = files +# for r, d, f in os.walk(path): +# print('dir', d) +# print('root', r) +# for file in f: +# if '.py' in file and not file.startswith('__init__'): +# print("file", file) +# files.append(os.path.join(r, file)) +# +# for f in files: +# print(f) +# +# for module in os.listdir(os.path.dirname(os.path.realpath(__file__))): +# if module == '__init__.py' or module[-3:] != '.py': +# continue +# print(module) +# __import__(module[:-3], locals(), globals(), [], 1) +# +# import glob +# +# path = 'c:\\projects\\hc2\\' +# +# files = [f for f in glob.glob(path + "**/*.txt", recursive=True)] +# +# for f in files: +# print(f) +# +# import inspect +# +# +# # Import this to other module and call it +# def print_caller_info(): +# # Get the full stack +# stack = inspect.stack() +# +# # Get one level up from current +# previous_stack_frame = stack[1] +# print(previous_stack_frame.filename) # Filename where caller lives +# +# # Get the module object of the caller +# calling_module = inspect.getmodule(stack_frame[0]) +# print(calling_module) +# print(calling_module.__file__) +# +# +# if __name__ == '__main__': +# print_caller_info() \ No newline at end of file diff --git a/setup.py b/setup.py index c92aa05939321d4f459cfc5ba2cce082d853333f..08366b42e43f861ff8aac02b9eed65ec7b0b5ecf 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,8 @@ import multiview_platform # Ceci n'est qu'un appel de fonction. Mais il est trèèèèèèèèèèès long # et il comporte beaucoup de paramètres -setup( +def setup_package(): + setup( # le nom de votre bibliothèque, tel qu'il apparaitre sur pypi name='multiview_platform', @@ -92,3 +93,6 @@ setup( # ext_modules=cythonize( # "multiview_platform/mono_multi_view_classifiers/monoview/additions/_custom_criterion.pyx"), ) + +if __name__ == "__main__": + setup_package()