Commit 1b95227
fix: static functions has no attr __wrapped__ (microsoft#169)
### Motivation and Context
1. Why is this change required? `pytest .` raises error
2. What problem does it solve? pass all test
3. What scenario does it contribute to? `infer_delegate_type` will not
raise error
4. If it fixes an open issue, please link to the issue here.
microsoft#168
### Description
static function has no attribute __wrapped__ and this raises error.
use __func__ for this.
I think `wrapped = getattr(value, "__wrapped__", getattr(value,
"__func__", None))` is reasonable for this issue.
```@staticmethod
def infer_delegate_type(function) -> DelegateTypes:
# Get the function signature
function_signature = signature(function)
awaitable = iscoroutinefunction(function)
for name, value in DelegateInference.__dict__.items():
if name.startswith("infer_") and hasattr(
> value.__wrapped__, "_delegate_type"
):
E AttributeError: 'staticmethod' object has no attribute '__wrapped__'
../semantic_kernel/orchestration/delegate_inference.py:240: AttributeError
======================================================================================= short test summary info =======================================================================================
FAILED test_text_skill.py::test_can_be_imported - AttributeError: 'staticmethod' object has no attribute '__wrapped__'
FAILED test_text_skill.py::test_can_be_imported_with_name - AttributeError: 'staticmethod' object has no attribute '__wrapped__'
===================================================================================== 2 failed, 9 passed in 0.23s =====================================================================================
```1 parent 3034075 commit 1b95227
1 file changed
Lines changed: 5 additions & 5 deletions
Lines changed: 5 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
236 | 236 | | |
237 | 237 | | |
238 | 238 | | |
239 | | - | |
240 | | - | |
241 | | - | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
242 | 242 | | |
243 | | - | |
244 | | - | |
| 243 | + | |
| 244 | + | |
245 | 245 | | |
246 | 246 | | |
0 commit comments