[~] Refactor
This commit is contained in:
parent
81bf066e82
commit
eb310ceef7
@ -1,3 +1,6 @@
|
||||
import distutils.command
|
||||
from typing import (Any,)
|
||||
|
||||
def _get_build_extension() -> distutils.command.build_ext: ...
|
||||
|
||||
def load_dynamic(name: str, path: str) -> Any: ...
|
||||
|
@ -10,7 +10,7 @@ import threading
|
||||
import cython
|
||||
import datetime
|
||||
|
||||
from typing import (Any, Optional,)
|
||||
from typing import (Any, Optional, TypeVar, Type, cast)
|
||||
# from scoping import scoping as s
|
||||
|
||||
def test(
|
||||
@ -31,7 +31,9 @@ def test(
|
||||
|
||||
print(['done', started_at, elapsed(), a[_id]])
|
||||
|
||||
def build(content: str) -> Any:
|
||||
M = TypeVar('M', bound=Type[Any])
|
||||
|
||||
def build(content: str, module: M) -> M:
|
||||
import pathlib
|
||||
import tempfile
|
||||
import hashlib
|
||||
@ -58,11 +60,14 @@ def build(content: str) -> Any:
|
||||
#)
|
||||
t1.run()
|
||||
|
||||
return Cython.Build.Inline.load_dynamic(
|
||||
'_%s' % sha256sum,
|
||||
glob.glob(
|
||||
str(output_dir / ('_%s*.so' % sha256sum))
|
||||
)[0]
|
||||
return cast(
|
||||
M,
|
||||
Cython.Build.Inline.load_dynamic(
|
||||
'_%s' % sha256sum,
|
||||
glob.glob(
|
||||
str(output_dir / ('_%s*.so' % sha256sum))
|
||||
)[0]
|
||||
)
|
||||
)
|
||||
|
||||
raise NotImplementedError
|
||||
|
Loading…
Reference in New Issue
Block a user