tacker/tacker/common/safe_utils.py
Niraj Singh 4fa204b370 Add vnf packages RestFul APIs
Implemented following APIs:-

* GET    /vnf_packages
* POST   /vnf_packages/
* GET    /vnf_packages/{vnfPkgId}
* DELETE /vnf_packages/{vnfPkgId}
* PUT    /vnf_packages/{vnfPkgId}/package_content
* POST   /vnf_packages/{vnfPkgId}/package_content/upload_from_uri

Partial-Implements: blueprint tosca-csar-mgmt-driver

Depends-On: If8155399df12a96cb86631dfa22eaca7a5a8d398

Co-Author: Neha Alhat <neha.alhat@nttdata.com>
Change-Id: Id3b4812e24a1ed84fe94429e074f96ae11530517
2019-09-20 06:48:28 +00:00

42 lines
1.5 KiB
Python

# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 Justin Santa Barbara
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""Utilities and helper functions that won't produce circular imports."""
def get_wrapped_function(function):
"""Get the method at the bottom of a stack of decorators."""
if not hasattr(function, '__closure__') or not function.__closure__:
return function
def _get_wrapped_function(function):
if not hasattr(function, '__closure__') or not function.__closure__:
return None
for closure in function.__closure__:
func = closure.cell_contents
deeper_func = _get_wrapped_function(func)
if deeper_func:
return deeper_func
elif hasattr(closure.cell_contents, '__call__'):
return closure.cell_contents
return function
return _get_wrapped_function(function)