cengal.modules_management.reload_module.versions.v_0.reload_module
1#!/usr/bin/env python 2# coding=utf-8 3 4# Copyright © 2012-2024 ButenkoMS. All rights reserved. Contacts: <gtalk@butenkoms.space> 5# 6# Licensed under the Apache License, Version 2.0 (the "License"); 7# you may not use this file except in compliance with the License. 8# You may obtain a copy of the License at 9# 10# http://www.apache.org/licenses/LICENSE-2.0 11# 12# Unless required by applicable law or agreed to in writing, software 13# distributed under the License is distributed on an "AS IS" BASIS, 14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15# See the License for the specific language governing permissions and 16# limitations under the License. 17 18import platform 19from importlib import import_module 20PYTHON_VERSION = platform.python_version_tuple() # tuple() of str(); for example: ('3', '5', '1') 21if PYTHON_VERSION[0] == '2': 22 pass 23elif PYTHON_VERSION[0] == '3': 24 try: 25 from imp import reload 26 except ImportError: 27 from importlib import reload 28else: 29 raise ImportError() 30 31""" 32Module Docstring 33Docstrings: http://www.python.org/dev/peps/pep-0257/ 34""" 35 36__author__ = "ButenkoMS <gtalk@butenkoms.space>" 37__copyright__ = "Copyright © 2012-2024 ButenkoMS. All rights reserved. Contacts: <gtalk@butenkoms.space>" 38__credits__ = ["ButenkoMS <gtalk@butenkoms.space>", ] 39__license__ = "Apache License, Version 2.0" 40__version__ = "4.4.1" 41__maintainer__ = "ButenkoMS <gtalk@butenkoms.space>" 42__email__ = "gtalk@butenkoms.space" 43# __status__ = "Prototype" 44__status__ = "Development" 45# __status__ = "Production" 46 47 48def reload_module(module): 49 """ 50 You SHOULD use construction "import SOME_MODULE" before reload_module() call if construction 51 "from SOME_MODULE import SOME_ITEM" was used originally. 52 :param module: 53 :return: 54 """ 55 reload(module) 56 57 58def reload_module_by_text_name(module_name, package=None): 59 """ 60 :param module_name: Text representation of module name. "os.path" for example. 61 See importlib.import_module() in the Python docs 62 :param package: see importlib.import_module() in the Python docs 63 :return: 64 """ 65 module = import_module(module_name, package) 66 reload(module)
PYTHON_VERSION =
('3', '8', '10')
def
reload_module(module):
49def reload_module(module): 50 """ 51 You SHOULD use construction "import SOME_MODULE" before reload_module() call if construction 52 "from SOME_MODULE import SOME_ITEM" was used originally. 53 :param module: 54 :return: 55 """ 56 reload(module)
You SHOULD use construction "import SOME_MODULE" before reload_module() call if construction "from SOME_MODULE import SOME_ITEM" was used originally. :param module: :return:
def
reload_module_by_text_name(module_name, package=None):
59def reload_module_by_text_name(module_name, package=None): 60 """ 61 :param module_name: Text representation of module name. "os.path" for example. 62 See importlib.import_module() in the Python docs 63 :param package: see importlib.import_module() in the Python docs 64 :return: 65 """ 66 module = import_module(module_name, package) 67 reload(module)
:param module_name: Text representation of module name. "os.path" for example. See importlib.import_module() in the Python docs :param package: see importlib.import_module() in the Python docs :return: