# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: testspace-colab
#     language: python
#     name: testspace-colab
# ---

# # Trove Example
# This illustrates how to load results from the trove. 
#
# For practically, we are using 
# the [https://lbrack.testspace.com/](https://lbrack.testspace.com/) organization which doesn't have 
# any read restrictions.
#

# + tags=["outputPrepend"]
from IPython.display import display # Pretty display in Python
import testspace_colab
testspace_colab.use_test_config()      # Comment this line if you want to use you own config.
# testspace_colab.use_samples_config() # uncomment this line to use the testspace samples
# -

# The following cell is optional but you can use this 
# to capture some results on your local file system. By default it will use the test config. Simply comment out 
# the first two lines to use yours.

# !ts-colab crawl -o ~/testspace-colab

import testspace_colab
trove = testspace_colab.Trove() # Create the trove instance. defaults to ~/testspace-colab

# We load all the results from the trove and display them in data frames

from IPython.display import display
import jsonpath_ng
import pandas as pd
max_load=3
for result in trove.load(): # this is a generator - we only want 2
    print(f"NAME={result['name']} ID={result['id']}")
    df = pd.DataFrame([match.value for match in jsonpath_ng.parse('$..[cases][:]').find(result)])
    display(df)
    max_load-=1
    if max_load==0:
        break



StarcoderdataJupyterScriptsDedupFiltered