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-6/

Bank Account Transfer System

A bank account transfer system that uses Cloud Datastore transactions to safely transfer money between accounts with automatic rollback on failures.

Capabilities

Account Management

  • Creating an account with ID "acc1" and initial balance 1000 stores the account in datastore and returns the account balance as 1000 @test

Successful Transfers

  • Creating two accounts with balances 1000 and 500, then transferring 300 from the first to the second results in final balances of 700 and 800 @test

Transfer Validation

  • Attempting to transfer 1500 from an account with balance 1000 raises an Exception and leaves both account balances unchanged @test
  • Attempting to transfer a negative amount -100 raises a ValueError @test

Transaction Rollback

  • When a transfer encounters an error after debiting the source account but before crediting the destination, the transaction rolls back and both accounts retain their original balances @test

Implementation

@generates

API

def transfer_money(client, from_account_id, to_account_id, amount):
    """
    Transfer money from one account to another using a transaction.

    Args:
        client: A gcloud datastore Client instance
        from_account_id: String ID of the source account
        to_account_id: String ID of the destination account
        amount: Numeric amount to transfer (must be positive)

    Returns:
        dict: Contains 'success' boolean and 'message' string
        Example: {'success': True, 'message': 'Transfer completed'}

    Raises:
        ValueError: If amount is not positive
        Exception: If accounts don't exist or insufficient balance
    """
    pass

def create_account(client, account_id, initial_balance):
    """
    Create a new bank account in the datastore.

    Args:
        client: A gcloud datastore Client instance
        account_id: String ID for the account
        initial_balance: Numeric starting balance

    Returns:
        Key: The datastore Key of the created account
    """
    pass

def get_balance(client, account_id):
    """
    Get the current balance of an account.

    Args:
        client: A gcloud datastore Client instance
        account_id: String ID of the account

    Returns:
        Numeric: Current account balance

    Raises:
        Exception: If account doesn't exist
    """
    pass

Dependencies { .dependencies }

gcloud { .dependency }

Provides Cloud Datastore client for transactional data operations.

@satisfied-by