You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
429 B
15 lines
429 B
#! /usr/bin/env python
|
|
# -*- coding: utf-8 -*-
|
|
#
|
|
# Copyright (C) 2011 Sebastian Pipping <sebastian@pipping.org>
|
|
# Licensed under GPL v3 or later
|
|
|
|
def _raise_type_error(value, wanted, got):
|
|
raise TypeError('Value <%s> is of type "%s" but type "%s" is required' \
|
|
% (str(value), wanted.__name__, got.__name__))
|
|
|
|
def require_type(wanted, value):
|
|
got = type(value)
|
|
if not got is wanted:
|
|
_raise_type_error(value, wanted, got)
|