datarepr

Version:

Introduction

This project allows to store the arguments for callables.

Installation
Features
datarepr.datarepr(name: Any, /, *args: Any, **kwargs: Any) -> str

This function allows for common sense representation.

datarepr.oxford(*args: Any, conj: Any = "and", default: Any = "") -> Any

This function returns a string coordination of args using the given conjunction. The Oxford comma is used for more than two args. If no args are given, then the function returns default.

Implementation
from typing import *

__all__ = ["datarepr"]


def datarepr(name: Any, /, *args: Any, **kwargs: Any) -> str:
    "This function allows for common sense representation."
    parts = list()
    for a in args:
        parts.append(repr(a))
    for i in kwargs.items():
        parts.append("%s=%r" % i)
    content = ", ".join(parts)
    ans = "%s(%s)" % (name, content)
    return ans
Testing
License
Impressum