public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
blob 2021b0b9865fa691b071b82e43880d363da854b5 560 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
 
#! /usr/bin/python3

# SPDX-License-Identifier: GPL-2.0-or-later
#
# tasst - Test A Simple Socket Transport
#         library of test helpers for passt & pasta
#
# tasst/typing.py - Type checking and related helpers
#
# Copyright Red Hat
# Author: David Gibson <david@gibson.dropbear.id.au>


def typecheck(val, ty_):
    if not isinstance(val, ty_):
        raise TypeError("Expected {} instead of {}".format(ty_, type(val)))
    return val


def typecheck_default(val, ty_, default):
    if val is None:
        return default
    return typecheck(val, ty_)

debug log:

solving 2021b0b ...
found 2021b0b in https://archives.passt.top/passt-dev/20230531015849.3229596-6-david@gibson.dropbear.id.au/

applying [1/1] https://archives.passt.top/passt-dev/20230531015849.3229596-6-david@gibson.dropbear.id.au/
diff --git a/avocado/tasst/typing.py b/avocado/tasst/typing.py
new file mode 100644
index 0000000..2021b0b

Checking patch avocado/tasst/typing.py...
Applied patch avocado/tasst/typing.py cleanly.

index at:
100644 2021b0b9865fa691b071b82e43880d363da854b5	avocado/tasst/typing.py

Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).