or run

tessl search
Log in

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/azure-storage-file-datalake@12.21.x
tile.json

tessl/pypi-azure-storage-file-datalake

tessl install tessl/pypi-azure-storage-file-datalake@12.21.0

Microsoft Azure File DataLake Storage Client Library for Python

Agent Success

Agent success rate when using this tile

92%

Improvement

Agent success rate improvement when using this tile compared to baseline

0.99x

Baseline

Agent success rate without this tile

93%

task.mdevals/scenario-5/

File Content Settings Manager

Build a utility that manages HTTP headers and content settings for files stored in Azure Data Lake Storage Gen2.

Requirements

Create a Python module that provides functionality to configure and retrieve HTTP headers for files in Azure Data Lake Storage. The module should handle:

  1. Setting Content Properties: Configure HTTP headers including content type, content encoding, content language, content disposition, and cache control for files
  2. Retrieving Content Properties: Fetch and display the current content settings for a file
  3. Bulk Updates: Update content settings for multiple files based on file extension patterns

Implementation Details

Your implementation should include:

  • A function set_file_content_settings(file_client, content_type, content_encoding, content_language, content_disposition, cache_control) that configures all HTTP headers for a file
  • A function get_file_content_settings(file_client) that retrieves and returns the current content settings
  • A function update_files_by_extension(file_system_client, extension, content_type, cache_control) that updates content type and cache control for all files with a given extension

Test Cases

  • Setting content type to "application/json", encoding to "gzip", language to "en-US", disposition to "attachment; filename=data.json", and cache control to "max-age=3600" on a file successfully updates all properties @test
  • Retrieving content settings returns the configured values for content type, encoding, language, disposition, and cache control @test
  • Updating all .csv files to have content type "text/csv" and cache control "no-cache" correctly updates only files with .csv extension @test

@generates

API

def set_file_content_settings(file_client, content_type, content_encoding,
                               content_language, content_disposition, cache_control):
    """
    Configure HTTP headers for a file in Azure Data Lake Storage.

    Args:
        file_client: DataLakeFileClient instance for the target file
        content_type: MIME type of the content
        content_encoding: Content encoding (e.g., 'gzip')
        content_language: Content language (e.g., 'en-US')
        content_disposition: Content disposition header
        cache_control: Cache control directive
    """
    pass

def get_file_content_settings(file_client):
    """
    Retrieve current content settings for a file.

    Args:
        file_client: DataLakeFileClient instance for the target file

    Returns:
        dict: Dictionary containing content_type, content_encoding,
              content_language, content_disposition, and cache_control
    """
    pass

def update_files_by_extension(file_system_client, extension, content_type, cache_control):
    """
    Update content settings for all files with a specific extension.

    Args:
        file_system_client: FileSystemClient instance
        extension: File extension to filter (e.g., '.csv')
        content_type: New content type to set
        cache_control: New cache control directive to set
    """
    pass

Dependencies { .dependencies }

azure-storage-file-datalake { .dependency }

Provides Azure Data Lake Storage Gen2 client library for managing files and content settings.