diff --git a/framework/CodeInterfaces/Prescient/PrescientCodeInterface.py b/framework/CodeInterfaces/Prescient/PrescientCodeInterface.py index 404ab37df0..d5182a3f1d 100644 --- a/framework/CodeInterfaces/Prescient/PrescientCodeInterface.py +++ b/framework/CodeInterfaces/Prescient/PrescientCodeInterface.py @@ -20,12 +20,13 @@ import os import re +import warnings try: import pkg_resources prescient = pkg_resources.get_distribution("prescient") prescientLocation = prescient.location except Exception as inst: - print("Finding Prescient failed with",inst) + warnings.warn(f"Finding Prescient failed with {inst}") prescientLocation = None from CodeInterfaceBaseClass import CodeInterfaceBase diff --git a/framework/Decorators/__init__.py b/framework/Decorators/__init__.py index ceff50a6b0..03230f69f7 100644 --- a/framework/Decorators/__init__.py +++ b/framework/Decorators/__init__.py @@ -16,6 +16,7 @@ @author: alfoa """ import builtins +import warnings # line_profiler decorator, @Decorators.timingProfile ## if using kernprof, use "profile" builtin; otherwise, passthrough. @@ -23,12 +24,12 @@ builtins.profile timingProfile = builtins.profile except (AttributeError, ImportError): - print('Unable to load "timingProfile" decorator; replacing with passthrough ...') + warnings.warn('Unable to load "timingProfile" decorator; replacing with passthrough ...', ImportWarning) timingProfile = lambda f: f # memory_profiler decorator, @Decorators.memoryProfile try: from memory_profiler import profile as memoryProfile except (AttributeError, ImportError): - print('Unable to load "memoryProfile" decorator; replacing with passthrough ...') + warnings.warn('Unable to load "memoryProfile" decorator; replacing with passthrough ...', ImportWarning) memoryProfile = lambda f: f diff --git a/framework/Distributions.py b/framework/Distributions.py index 0e3f92110f..9205818c56 100644 --- a/framework/Distributions.py +++ b/framework/Distributions.py @@ -1804,13 +1804,6 @@ def getInputSpecification(cls): is returned to $N$). In case the ``with replacement'' strategy is used, the distribution samples always from the complete set of specified $N$ values. """ - lb = InputData.parameterInputFactory('lowerBound', contentType=InputTypes.FloatType, printPriority=109, - descr=r""" Lower bound of the set of allowed sample values. """) - specs.addSub(lb) - - ub = InputData.parameterInputFactory('upperBound', contentType=InputTypes.FloatType, printPriority=109, - descr=r""" Upper bound of the set of allowed sample values. """) - specs.addSub(ub) np = InputData.parameterInputFactory('nPoints', contentType=InputTypes.IntegerType, printPriority=109, descr=r""" Number of points between lower and upper bound. """) @@ -2864,9 +2857,6 @@ class cls. inputSpecification = super(LogUniform, cls).getInputSpecification() BaseInputType = InputTypes.makeEnumType("base", "baseType", ["natural","decimal"]) - - inputSpecification.addSub(InputData.parameterInputFactory("lowerBound", contentType=InputTypes.FloatType)) - inputSpecification.addSub(InputData.parameterInputFactory("upperBound", contentType=InputTypes.FloatType)) inputSpecification.addSub(InputData.parameterInputFactory("base" , BaseInputType)) return inputSpecification diff --git a/framework/InputTemplates/TemplateBaseClass.py b/framework/InputTemplates/TemplateBaseClass.py index 104426a0c8..305db06c07 100644 --- a/framework/InputTemplates/TemplateBaseClass.py +++ b/framework/InputTemplates/TemplateBaseClass.py @@ -29,9 +29,10 @@ frameworkDir = os.path.normpath(os.path.join(os.path.dirname(__file__), '..')) sys.path.append(frameworkDir) from utils import xmlUtils +from BaseClasses import MessageUser -class Template(object): +class Template(MessageUser): """ Generic class for templating input files. Intended to be used to read a template, be given instructions on how to fill it, @@ -61,12 +62,13 @@ def addNamingTemplates(cls, templates): ############### # API METHODS # ############### - def __init__(self): + def __init__(self, **kwargs): """ Constructor. @ In, None @ Out, None """ + super().__init__() self._template = None # XML element with the root Simulation node of a RAVEN input # assure that the template path gives the location of the inheriting template, not the base class self._templatePath = os.path.dirname(os.path.normpath(sys.modules[self.__class__.__module__].__file__))