or run

tessl search
Log in

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/gcloud@0.7.x
tile.json

tessl/pypi-gcloud

tessl install tessl/pypi-gcloud@0.7.0

Python client library for Google Cloud Platform services including Datastore, Storage, and Pub/Sub

Agent Success

Agent success rate when using this tile

93%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.19x

Baseline

Agent success rate without this tile

78%

task.mdevals/scenario-3/

Entity Relationship Manager

Build a simple entity relationship manager that creates and validates hierarchical entity identifiers for a blog platform.

Requirements

Your system should provide functions to:

  1. Create a root-level identifier for a blog post given a post ID (string or integer)
  2. Create a child identifier for a comment that belongs to a specific blog post, given the parent post identifier and comment ID (string or integer)
  3. Extract the identifier components from a hierarchical identifier, returning a list of tuples where each tuple contains the entity type (kind) and the entity ID
  4. Validate identifier hierarchy by checking if one identifier is an ancestor of another

The system should support two entity types:

  • "BlogPost" for blog posts (top-level entities)
  • "Comment" for comments (child entities of blog posts)

All identifiers should be associated with a project named "test-project".

Test Cases

  • Creating a root identifier for BlogPost with ID "post-1" produces an identifier with kind "BlogPost" and ID "post-1" @test
  • Creating a child identifier for Comment with ID "comment-1" under a BlogPost with ID "post-1" produces a hierarchical identifier with BlogPost as parent and Comment as child @test
  • Extracting components from a hierarchical identifier (BlogPost "post-1" → Comment "comment-1") returns [("BlogPost", "post-1"), ("Comment", "comment-1")] @test
  • Validating that a BlogPost identifier is an ancestor of its Comment identifier returns True @test

@generates

API

def create_root_key(post_id):
    """
    Create a root-level key for a BlogPost entity.

    Args:
        post_id: The identifier for the blog post (string or integer)

    Returns:
        A key object representing the BlogPost entity
    """
    pass

def create_child_key(parent_key, comment_id):
    """
    Create a child key for a Comment entity under a parent BlogPost.

    Args:
        parent_key: The parent BlogPost key object
        comment_id: The identifier for the comment (string or integer)

    Returns:
        A key object representing the Comment entity with the parent relationship
    """
    pass

def extract_key_components(key):
    """
    Extract the hierarchical components from a key.

    Args:
        key: A key object (possibly hierarchical)

    Returns:
        A list of tuples, where each tuple contains (kind, id) for each level
        in the hierarchy from root to leaf
    """
    pass

def is_ancestor(potential_ancestor_key, descendant_key):
    """
    Check if one key is an ancestor of another in the entity hierarchy.

    Args:
        potential_ancestor_key: The key that might be an ancestor
        descendant_key: The key that might be a descendant

    Returns:
        True if potential_ancestor_key is an ancestor of descendant_key, False otherwise
    """
    pass

Dependencies { .dependencies }

gcloud { .dependency }

Provides Google Cloud Datastore client functionality.