From c7d4f02aa50fba1a9534c7faa87f05e40822eae9 Mon Sep 17 00:00:00 2001 From: brimoor Date: Mon, 18 Dec 2023 12:44:22 -0500 Subject: [PATCH 1/2] adding support for inspecting class methods --- eta/core/utils.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/eta/core/utils.py b/eta/core/utils.py index 12f06583..4ecd1d2d 100644 --- a/eta/core/utils.py +++ b/eta/core/utils.py @@ -554,6 +554,9 @@ def get_function_name(fcn): the fully-qualified function name string, such as "eta.core.utils.function_name" """ + if inspect.ismethod(fcn): + return fcn.__module__ + "." + fcn.__qualname__ + return fcn.__module__ + "." + fcn.__name__ @@ -605,7 +608,16 @@ def get_function(function_name, module_name=None): Raises: ImportError: if the function could not be imported """ - return get_class(function_name, module_name=module_name) + try: + return get_class(function_name, module_name=module_name) + except Exception as e: + try: + # try treating as a class method + class_name, function_name = function_name.rsplit(".", 1) + cls = get_class(class_name, module_name=module_name) + return getattr(cls, function_name) + except: + raise e def install_package( From 21d7c7c9d1ab7e360e880458795013c4cccfed8f Mon Sep 17 00:00:00 2001 From: brimoor Date: Mon, 18 Dec 2023 13:21:59 -0500 Subject: [PATCH 2/2] bumping version --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 2e4d42f4..96b92cab 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ from wheel.bdist_wheel import bdist_wheel -VERSION = "0.12.0" +VERSION = "0.12.1" class BdistWheelCustom(bdist_wheel):