File: auto_namedtuple.py

package info (click to toggle)
pre-commit 4.5.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,452 kB
  • sloc: python: 14,482; sh: 87; makefile: 4
file content (13 lines) | stat: -rw-r--r-- 374 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
from __future__ import annotations

import collections


def auto_namedtuple(classname='auto_namedtuple', **kwargs):
    """Returns an automatic namedtuple object.

    Args:
        classname - The class name for the returned object.
        **kwargs - Properties to give the returned object.
    """
    return (collections.namedtuple(classname, kwargs.keys())(**kwargs))