Skip to content
This repository has been archived by the owner on Jun 14, 2021. It is now read-only.

Commit

Permalink
Merge branch 'dev' into feature/#151/represent-local-env
Browse files Browse the repository at this point in the history
  • Loading branch information
benoit-dubreuil committed Apr 18, 2021
2 parents ee276d4 + e990885 commit c700524
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions conf/script/src/utils/meta_prog/encapsulation/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .export import *
22 changes: 22 additions & 0 deletions conf/script/src/utils/meta_prog/encapsulation/export.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import inspect
import typing

__all__ = ['export']


def export(func: typing.Callable):
attribute_name_all: typing.Final[str] = '__all__'
module_api: list[str]

module = inspect.getmodule(func)
func_api = func.__qualname__

if not hasattr(module, attribute_name_all):
module_api = []
setattr(module, attribute_name_all, module_api)
else:
module_api = getattr(module, attribute_name_all)

module_api.append(func_api)

return func

0 comments on commit c700524

Please sign in to comment.