Core | patterns | rpc | Search

pyimport

get python params

This code defines a module that provides a function called get_parameter_names, which takes a string of source code as input and returns a list of parameter names as strings. The function uses the ast module to parse the source code and extract the parameter names from the first function definition it finds.

Cell 1

The code imports necessary modules and initializes a dictionary to store module instances, and then defines several functions for manipulating URLs, importing notebook modules, and building dynamic libraries. The import_notebook function imports notebook modules based on a query string and context, and uses different methods to import code depending on the language of the notebook.

Cell 2

This code is part of a build system for dynamic libraries (.dylib) that imports necessary libraries, sanitizes URLs, and builds libraries using external functions and regular expressions. It involves interpreting code, extracting library information, compiling object files, and creating dynamic libraries using various tools and compiler flags.

questions = [re.sub(r'|\|+', '', q, flags=re.IGNORECASE).strip()

This module includes three functions: get_questions extracts questions from markdown and source code, accumulate_markdown accumulates markdown leading up to code cells in a Jupyter notebook, and cache_cells generates cache entries from a Jupyter notebook. The module also defines a dictionary __all__ that specifies which functions are importable.

Cell 4

The code imports necessary libraries and defines a schema to build a Whoosh index, which is then used to store and retrieve data. It allows for searching by ID, filename, and fuzzy search by questions, with the ability to add more strategies as needed.

Cell 5

The get_cells function imports a Jupyter Notebook file, extracts cell metadata, and formats it into a list of dictionaries with language, filename, and unique ID information. The function takes two parameters: the notebook path and a list of cell types to extract, and returns the formatted list of cells.

run python cells

The run_internal function is an asynchronous function that runs a notebook program by importing it, finding a function to execute, mapping user inputs to function parameters, converting types, and executing the function, while the run_async function runs this process asynchronously using asyncio.gather.