Skip to content

Instantly share code, notes, and snippets.

View afonasev's full-sized avatar
🔥

Afonasev Evgeniy afonasev

🔥
View GitHub Profile
import subprocess
from pathlib import Path
import typer
def main(task_name: str):
task_dir = Path(task_name)
code_path = task_dir / 'code.py'
import collections
class NoStrIterable(collections.Iterable):
"""
'isinstance(smt, NoStrIterable)'
instead of
'isinstance(smt, collection.Iterable) and not isinstance(smt, str)'
"""
def get_obj_by_path(path):
"""
Example:
obj = get_obj_by_path('module.Object')
"""
module_path, target = path.rsplit('.', maxsplit=1)
module = __import__(name=module_path, fromlist=(target,))
return getattr(module, target)