fix windows build

This commit is contained in:
jxxghp
2024-05-27 10:11:41 +08:00
parent 5c8b843030
commit 81eed0d06d
2 changed files with 40 additions and 14 deletions

View File

@ -35,20 +35,24 @@ class ObjectUtils:
"""
检查函数是否已实现
"""
source = inspect.getsource(func)
in_comment = False
for line in source.split('\n'):
line = line.strip()
if not line:
continue
if line.startswith('"""') or line.startswith("'''"):
in_comment = not in_comment
continue
if not in_comment and not (line.startswith('#')
or line == "pass"
or line.startswith('@')
or line.startswith('def ')):
return True
try:
source = inspect.getsource(func)
in_comment = False
for line in source.split('\n'):
line = line.strip()
if not line:
continue
if line.startswith('"""') or line.startswith("'''"):
in_comment = not in_comment
continue
if not in_comment and not (line.startswith('#')
or line == "pass"
or line.startswith('@')
or line.startswith('def ')):
return True
except Exception as err:
print(str(err))
return func.__code__.co_code not in [b'd\x01S\x00', b'\x97\x00d\x00S\x00']
return False
@staticmethod