Skip to content

Commit

Permalink
put into package
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-davee committed Oct 26, 2023
1 parent 98ce826 commit d069777
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 42 deletions.
30 changes: 0 additions & 30 deletions magic_toolbox.py

This file was deleted.

27 changes: 15 additions & 12 deletions magic_toolbox/magic_toolbox.py
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
from inspect import currentframe, getframeinfo
from pathlib import Path
import plac


mwd = Path(__file__).parent.absolute()
from plac import Interpreter
from typing import Callable
from importlib import import_module
from inspect import getmembers, isfunction


def get_tools() -> list[tuple[str,Callable]]:
tools = import_module('toolbox.tools')
return [ (n,tool)
for n,tool in getmembers(tools)
if isfunction(tool)]

class MagicToolBox(object):

"""
Expand All @@ -17,11 +21,10 @@ class MagicToolBox(object):



commands = 'create',

def create_project(name:('The name of project','positional')):
...

commands = tuple(n for n,_ in get_tools())

for name,tool in get_tools():
setattr(MagicToolBox,name,tool)

if __name__ == '__main__':
plac.Interpreter.call(MagicToolBox)
Interpreter.call(MagicToolBox)
File renamed without changes.
File renamed without changes.

0 comments on commit d069777

Please sign in to comment.