You've already forked slimbootloader
mirror of
https://github.com/Dasharo/slimbootloader.git
synced 2026-03-06 15:26:20 -08:00
6f8c44b375
Synced up MdePkg, IntelFsp2Pkg and BaseTools to EDK2 stable tag edk2-stable201905. There are several changes for MdePkg and BaseTools. MdePkg: - Support light print to reduce SBL size MdePkg\Library\BasePrintLib\PrintLibInternal.c MdePkg\Include\Library\DebugLib.h - TCG TPM2 spec changes and remove dependencies MdePkg\Include\IndustryStandard\UefiTcgPlatform.h MdePkg\Include\IndustryStandard\Tpm2Acpi.h - Use old NVM protocol file MdePkg\Include\Protocol\NvmExpressPassthru.h - Removed unused files BaseTools: - Added LZ4 support - Removed unused files Signed-off-by: Maurice Ma <maurice.ma@intel.com>
42 lines
1.2 KiB
Python
42 lines
1.2 KiB
Python
## @file
|
|
# help with caching in BaseTools
|
|
#
|
|
# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
|
|
#
|
|
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
#
|
|
|
|
## Import Modules
|
|
#
|
|
|
|
# for class function
|
|
class cached_class_function(object):
|
|
def __init__(self, function):
|
|
self._function = function
|
|
def __get__(self, obj, cls):
|
|
def CallMeHere(*args,**kwargs):
|
|
Value = self._function(obj, *args,**kwargs)
|
|
obj.__dict__[self._function.__name__] = lambda *args,**kwargs:Value
|
|
return Value
|
|
return CallMeHere
|
|
|
|
# for class property
|
|
class cached_property(object):
|
|
def __init__(self, function):
|
|
self._function = function
|
|
def __get__(self, obj, cls):
|
|
Value = obj.__dict__[self._function.__name__] = self._function(obj)
|
|
return Value
|
|
|
|
# for non-class function
|
|
class cached_basic_function(object):
|
|
def __init__(self, function):
|
|
self._function = function
|
|
# wrapper to call _do since <class>.__dict__ doesn't support changing __call__
|
|
def __call__(self,*args,**kwargs):
|
|
return self._do(*args,**kwargs)
|
|
def _do(self,*args,**kwargs):
|
|
Value = self._function(*args,**kwargs)
|
|
self.__dict__['_do'] = lambda self,*args,**kwargs:Value
|
|
return Value
|