CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/pypi-qrcode

QR Code image generator with customizable image formats, error correction levels, and styling options

42%

Overall

Evaluation42%

0.86x

Agent success when using this tile

Overview
Eval results
Files

task.mdevals/scenario-3/

QR Code Configuration Manager

Build a QR code generation utility that creates customized QR codes with specific configuration requirements.

Requirements

You need to implement a QR code generator function that accepts configuration parameters and generates a QR code with the specified settings.

Function Specification

Create a function generate_configured_qr(data, config) that:

  1. Accepts a string data containing the information to encode
  2. Accepts a dictionary config with the following optional keys:
    • version: QR code version (integer 1-40, or None for auto-fit)
    • error_correction: Error correction level (string: 'L', 'M', 'Q', or 'H')
    • box_size: Size of each box in pixels (integer, default 10)
    • border: Border width in boxes (integer, default 4)
  3. Returns a PIL Image object representing the generated QR code

Configuration Rules

  • If version is None or not provided, the QR code should auto-fit to the data
  • Error correction levels map to: 'L' = ~7%, 'M' = ~15%, 'Q' = ~25%, 'H' = ~30%
  • The box_size must be at least 1 pixel
  • The border must be at least 4 boxes (QR code specification minimum)
  • Default values should be used for any missing configuration parameters

Test Cases

  • Generating a QR code with custom box size of 5 pixels produces a smaller image than the default @test
  • Generating a QR code with high error correction level ('H') successfully encodes data @test
  • Generating a QR code with version 1 for short data (e.g., "Hi") fits the data properly @test
  • Generating a QR code with auto-fit (version=None) for longer data selects an appropriate version @test

Implementation

@generates

API

def generate_configured_qr(data: str, config: dict):
    """
    Generate a QR code with custom configuration.

    Args:
        data: String data to encode in the QR code
        config: Dictionary with optional keys:
                - version (int or None): QR version 1-40, None for auto-fit
                - error_correction (str): 'L', 'M', 'Q', or 'H'
                - box_size (int): Size of each box in pixels
                - border (int): Border width in boxes

    Returns:
        PIL Image object containing the QR code
    """
    pass

Dependencies { .dependencies }

qrcode { .dependency }

Provides QR code generation and configuration capabilities.

Install with Tessl CLI

npx tessl i tessl/pypi-qrcode@7.4.0
What are skills?

tile.json