(*args, **kwargs)
| 248 | |
| 249 | @wraps(func) |
| 250 | def inner(*args, **kwargs): |
| 251 | curr_impl = get_session_implement() |
| 252 | |
| 253 | # Check if 'now_impl' is a derived from session_type or is the same class |
| 254 | if not issubclass(curr_impl, session_type): |
| 255 | func_name = getattr(func, '__name__', str(func)) |
| 256 | require = getattr(session_type, '__name__', str(session_type)) |
| 257 | curr = getattr(curr_impl, '__name__', str(curr_impl)) |
| 258 | |
| 259 | raise RuntimeError("Only can invoke `{func_name:s}` in {require:s} context." |
| 260 | " You are now in {curr:s} context".format(func_name=func_name, require=require, |
| 261 | curr=curr)) |
| 262 | return func(*args, **kwargs) |
| 263 | |
| 264 | return inner |
| 265 |
nothing calls this directly
no test coverage detected
searching dependent graphs…