Package: lib-py-parse
lib_py_parselib_py_parseis a utility library for manipulating python code.Usageimportlib_py_parse.parse.parse_skeletonasparse_skeleton# script create AutoGeneratedDocs for a python module (including imported modules from [module_dir])target_module='drivers.cache_server_driver'module_dir='/home/user/software/cache'pkgDocs=parse_skeleton.generate_api_def(target_module,module_dir,target_only=False)print(pkgDocs)Installing$python3-mpipinstalllib_py_parseAutoGeneratedDocslib_py_parse.helper.__init__lib_py_parse.helper.type_resolverdefreduce_rel_type(target_module,current_module,rel_type,reverse_imports_map)defcompute_relative_type(abs_type,current_module,reverse_imports_map)defresolve_map_type_L0_skeleton(typon_map_type,L0_skeleton)defread_tuple_types_typon_L0_skeleton(ws_removed_typon_tuple_type,L0_skeleton)defread_args_ret_from_fxn_typon_type(ws_removed_typon_fxn_type)lib_py_parse.helper.eval_servicedefresolve_func_type_from_arguments(arguments)defresolve_args_only_func_type(arguments)defresolve_func_type_from_arguments_msa(arguments,module_L0_skeleton,current_module)defresolve_args_only_func_type_msa(arguments,module_L0_skeleton,current_module)defis_valid_var_name(var_name)lib_py_parse.helper.eval_helperdefextract_id_var_tuple(S2)defread_fxn_params(arg_str)deffmt_type_module_space_aware_module_L0_skeleton(input_typon_type,current_module,module_L0_skeleton)lib_py_parse.__init__lib_py_parse.__api__lib_py_parse.parse.__init__lib_py_parse.parse.rm_commentsdeffmt_json(X)defrender_indented_stmts(stmt)defrender_fxn_repr(stmt)defrender_class_repr(stmt)defrender_instruction_repr(stmt)defrender_import_repr(stmt)defrender_L1_control(stmt)defrender_try_repr(stmt)defrender_except_repr(stmt)defrender_stmt(stmt)defrm_comment_U1(mod_skeleton_U1)defrm_comment_module(target_module,module_dir)defrm_comment_pkg(pkg_ns,pkg_base)defrm_comment_pkg_src(pkg_ns,pkg_base)defp1()defmain()lib_py_parse.parse.parserdefparse_def(code,index,scope)defparse_class(code,index,scope)defparse_try(code,index,scope)defparse_except(code,index,scope)defparse_L1_CE(code,index,scope,token)defparse_L0_statement(code,index,scope)defparse_import(code,index,scope)defparse_include(code,index,scope)defparse_abstract_statement(code,index,scope,start_token)defread_scope(code,index,scope)lib_py_parse.parse.parse_L0_skeletondefselect_modules_to_read(item_skeleton)defread_import_to_skeleton(item,module_L0_skeleton,current_module)defread_L0_skeleton(current_module,item_skeleton)deffmt_code(src_dir)defselect_code_skeletons(target_module,module_dir)lib_py_parse.parse.parse_skeletondefgen_mod_repr(mod_skeleton_U1)defgenerate_api_def(target_module,module_dir,target_only=False)defgenerate_pkg_api_def(pkg_ns,pkg_base)defread_relative_skeleton(target_module,module_dir)defp1()defmain()lib_py_parse.utils.__init__lib_py_parse.utils.constantsdefselect_item_prefix(item_name)defselect_primitives()defselect_bracket_map()lib_py_parse.utils.exceptionsdeffind_all(s,t,index)defraise_exception_msg(code,index,error_msg)defraise_exception_msgs(code,index,error_msgs)defraise_exception_raw(error_msgs)defraise_exception_ue(error_msgs)defraise_exception_ue_cm(error_msgs,current_module)defraise_exception_ST(symbol_table,errors)defformat_parse_tree(abstract_tree)defraise_inv_exception_decl(exception_decl,symbol_table)defraise_invalid_raise_exception(symbol_table)defraise_class_not_found_exception(symbol_table,class_name,target_module)defraise_inv_assertion_declaration(symbol_table,interior_assert_typon_type)defraise_exception_L0_skeleton(errors,current_module,L0_skeleton)defraise_parsing_exception(error_msg_str,current_module,src_dir)lib_py_parse.utils.fmt_utilsdefformat_indent(indent_str,multiline_str)defserialize_json(py_dict)defprint_json(py_dict)defselect_module_src_dir(module_dir,target_module)defread_module_src(module_dir,target_module)lib_py_parse.utils.graph_algdefperform_dfs(graph,i,v,cv,result_order,cyclic_flag)deftop_sort(graph)defbfs_files(base_dir,target_exts)lib_py_parse.utils.parsing_utilsdefindent_multiline_str(indent_str,multiline_str)defget_fmt_str_expr_closure(target_substr,open_index,symbol_table)defget_char_closure(s,index)defget_unescaped_quote(s,index,quote)defclose_triple_quote(s,index,trq)defget_quote_closure(s,index)defis_escaped_quote(s,index)defget_cleared_char_closure(s,index)defread_next_cleared_char(s,index,target_char)defparse_current_scope(source_code,scope_start_index)defread_init_token(source_code,index,scope)defselect_token_index(tok_stream,target_token)defget_token_stream_closure(tok_stream,i_start)defget_expr_aware_closure(tok_stream,index,symbol_table)deffind_all_expr_aware(tok_stream,index,symbol_table,target_token)defsplit_expr_aware(tok_stream,symbol_table,target_token)defsplit_arg_typle(s,index)defread_delimited_types(type_str)defparse_fxn_type(function_type,symbol_table)lib_py_parse.utils.fs_moddeffmt_mod_py(module_name,base_dir='')defiter_py_mod(pkg_ns,pkg_base)