Skip to content

Instantly share code, notes, and snippets.

@oxtopus
Created March 12, 2015 17:56
Show Gist options
  • Save oxtopus/0ed17d496ad19ae07dab to your computer and use it in GitHub Desktop.
Save oxtopus/0ed17d496ad19ae07dab to your computer and use it in GitHub Desktop.
============================= test session starts ==============================
platform linux2 -- Python 2.7.6 -- pytest-2.4.2
plugins: cov, xdist
collected 788 items / 1 errors / 2 skipped
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/utils_test.py ...
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/algorithms/anomaly_likelihood_jeff_test.py ...ss..
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/algorithms/anomaly_likelihood_test.py .............
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/algorithms/anomaly_test.py ............
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/algorithms/cells4_test.py
==== RESET =====
==== RESET =====
.
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/algorithms/cla_classifier_diff_test.py ..................
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/algorithms/cla_classifier_test.py ..................
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/algorithms/fast_cla_classifier_test.py ..................
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/algorithms/sp_overlap_test.py .s.s
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/algorithms/svm_test.py ..s
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/algorithms/tp10x2_test.py *** Synapse consistency checking turned on for Cells4 ***
*** Python segment match turned on for Cells4
.
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/data/aggregator_test.py .
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/data/dictutils_test.py ......
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/data/fieldmeta_test.py .
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/data/file_record_stream_test.py .....
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/data/filters_test.py s
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/data/inference_shifter_test.py ........
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/data/utils_test.py .....
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/data/generators/anomalyzer_test.py ...........
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/data/generators/pattern_machine_test.py .........
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/data/generators/sequence_machine_test.py .....
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/encoders/adaptivescalar_test.py ......
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/encoders/category_test.py .
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/encoders/coordinate_test.py ...............
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/encoders/date_test.py .......
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/encoders/delta_test.py ....
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/encoders/geospatial_coordinate_test.py ..........
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/encoders/logenc_test.py .....
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/encoders/multi_test.py .
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/encoders/pass_through_encoder_test.py ...
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/encoders/random_distributed_scalar_test.py ..............
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/encoders/scalar_test.py .........
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/encoders/scalarspace_test.py .
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/encoders/sdrcategory_test.py ..
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/encoders/sparse_pass_through_encoder_test.py ...
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/engine/network_test.py .........
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/engine/syntactic_sugar_test.py .....
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/engine/unified_py_parameter_test.py ..
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/frameworks/opf/clamodel_classifier_helper_test.py FFFFFFFFFFFFFFFFFFFFFF
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/frameworks/opf/clamodel_test.py ......
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/frameworks/opf/opf_metrics_test.py ............................
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/frameworks/opf/previous_value_model_test.py ......
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/frameworks/opf/safe_interpreter_test.py ........
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/frameworks/opf/two_gram_model_test.py .....
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/math/array_algorithms_test.py ...
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/math/cast_mode_test.py s
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/math/lgamma_test.py .
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/math/nupic_random_test.py .............
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/math/sparse_binary_matrix_test.py .....................................s............
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/math/sparse_matrix_test.py ...s.........................................................................................
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/regions/image_sensor_test.py ...
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/regions/knn_anomaly_classifier_region_test.py ....................
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/regions/pyregion_test.py ....
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/regions/regions_spec_test.py s...s......
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/research/flat_spatial_pooler_compatability_test.py ........
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/research/flat_spatial_pooler_cpp_api_test.py ..
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/research/flat_spatial_pooler_py_api_test.py ................................
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/research/flat_spatial_pooler_unit_test.py ....
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/research/inhibition_object_test.py .
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/research/sp_learn_inference_test.py .
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/research/spatial_pooler_boost_test.py ..
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/research/spatial_pooler_compatability_test.py ....ss..
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/research/spatial_pooler_compute_test.py ..
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/research/spatial_pooler_cpp_api_test.py ..............................
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/research/spatial_pooler_py_api_test.py ..............................
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/research/temporal_memory_test.py ...................................
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/research/tp10x2_test.py ..F.
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/research/tp_constant_test.py *** Synapse consistency checking turned on for Cells4 ***
.*** Synapse consistency checking turned on for Cells4 ***
.*** Synapse consistency checking turned on for Cells4 ***
.
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/research/tp_test.py ..F.
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/research/monitor_mixin/metric_test.py ..
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/research/monitor_mixin/trace_test.py ..
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/configuration_test.py FFFFFFFFFFFFsFFFFFFFFFFFFFFFFFFFF
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/custom_configuration_test.py FFFFFFFFFFFFFFFFFFFsFFFFFFFFFFFFFFFFFFFFFFFFF
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/decorators_test.py ....
../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/object_json_test.py ...............
==================================== ERRORS ====================================
ERROR collecting ../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/research/spatial_pooler_unit_test.py
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/research/spatial_pooler_unit_test.py:39: in <module>
from nupic.bindings.proto import SpatialPoolerProto_capnp
E ImportError: cannot import name SpatialPoolerProto_capnp
=================================== FAILURES ===================================
_______ tests.unit.nupic.frameworks.opf.clamodel_classifier_helper_test ________
self = <tests.unit.nupic.frameworks.opf.clamodel_classifier_helper_test.CLAClassifierHelperTest testMethod=testAddLabel>
def setUp(self):
> self.helper = CLAModelClassifierHelper(Mock(spec=CLAModel))
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/frameworks/opf/clamodel_classifier_helper_test.py:152:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <nupic.frameworks.opf.clamodel_classifier_helper.CLAModelClassifierHelper object at 0x7f88a9ff27d0>
clamodel = <Mock spec='CLAModel' id='140224944351056'>, anomalyParams = {}
def __init__(self, clamodel, anomalyParams={}):
if anomalyParams is None:
anomalyParams = {}
self.clamodel = clamodel
self._version = CLAModelClassifierHelper.__VERSION__
self._classificationMaxDist = 0.1
if 'autoDetectWaitRecords' not in anomalyParams or \
anomalyParams['autoDetectWaitRecords'] is None:
self._autoDetectWaitRecords = int(Configuration.get(
> 'nupic.model.temporalAnomaly.wait_records'))
/usr/local/lib/python2.7/dist-packages/nupic/frameworks/opf/clamodel_classifier_helper.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
prop = 'nupic.model.temporalAnomaly.wait_records', default = None
@classmethod
def get(cls, prop, default=None):
""" Get the value of the given configuration property as string. This
returns a string which is the property value, or the value of "default" arg
if the property is not found. Use Configuration.getString() instead.
NOTE: it's atypical for our configuration properties to be missing - a
missing configuration property is usually a very serious error. Because
of this, it's preferable to use one of the getString, getInt, getFloat,
etc. variants instead of get(). Those variants will raise KeyError when
an expected property is missing.
Parameters:
----------------------------------------------------------------
prop: name of the property
default: default value to return if property does not exist
retval: property value (as a string), or default if the property does
not exist.
"""
try:
> return cls.getString(prop)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:162:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
prop = 'nupic.model.temporalAnomaly.wait_records'
@classmethod
def getString(cls, prop):
""" Retrieve the requested property as a string. If property does not exist,
then KeyError will be raised.
Parameters:
----------------------------------------------------------------
prop: name of the property
retval: property value as a string
"""
if cls._properties is None:
> cls._readStdConfigFiles()
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:81:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
@classmethod
def _readStdConfigFiles(cls):
""" Intercept the _readStdConfigFiles call from our base config class to
read in base and custom configuration settings.
"""
> super(Configuration, cls)._readStdConfigFiles()
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_custom.py:142:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
@classmethod
def _readStdConfigFiles(cls):
""" Read in all standard configuration files
"""
# Default one first
> cls.readConfigFile(DEFAULT_CONFIG)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:429:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
filename = 'nupic-default.xml', path = None
@classmethod
def readConfigFile(cls, filename, path=None):
""" Parse the given XML file and store all properties it describes.
Parameters:
----------------------------------------------------------------
filename: name of XML file to parse (no path)
path: path of the XML file. If None, then use the standard
configuration search path.
"""
> properties = cls._readConfigFile(filename, path)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:219:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
filename = 'nupic-default.xml', path = None
@classmethod
def _readConfigFile(cls, filename, path=None):
""" Parse the given XML file and return a dict describing the file.
Parameters:
----------------------------------------------------------------
filename: name of XML file to parse (no path)
path: path of the XML file. If None, then use the standard
configuration search path.
retval: returns a dict with each property as a key and a dict of all
the property's attributes as value
"""
outputProperties = dict()
# Get the path to the config files.
if path is None:
filePath = cls.findConfigFile(filename)
else:
filePath = os.path.join(path, filename)
# ------------------------------------------------------------------
# Read in the config file
try:
if filePath is not None:
try:
# Use warn since console log level is set to warning
_getLogger().debug("Loading config file: %s", filePath)
with open(filePath, 'rb') as inp:
contents = inp.read()
except Exception:
raise RuntimeError("Expected configuration file at %s" % filePath)
else:
# If the file was not found in the normal search paths, which includes
# checking the NTA_CONF_PATH, we'll try loading it from pkg_resources.
try:
contents = resource_string("nupic.support", filename)
except Exception as resourceException:
# We expect these to be read, and if they don't exist we'll just use
# an empty configuration string.
if filename in [USER_CONFIG, CUSTOM_CONFIG]:
contents = '<configuration/>'
else:
raise resourceException
elements = ElementTree.XML(contents)
if elements.tag != 'configuration':
raise RuntimeError("Expected top-level element to be 'configuration' "
"but got '%s'" % (elements.tag))
# ------------------------------------------------------------------
# Add in each property found
propertyElements = elements.findall('./property')
for propertyItem in propertyElements:
propInfo = dict()
# Parse this property element
propertyAttributes = list(propertyItem)
for propertyAttribute in propertyAttributes:
propInfo[propertyAttribute.tag] = propertyAttribute.text
# Get the name
name = propInfo.get('name', None)
# value is allowed to be empty string
if 'value' in propInfo and propInfo['value'] is None:
value = ''
else:
value = propInfo.get('value', None)
if value is None:
if 'novalue' in propInfo:
# Placeholder "novalue" properties are intended to be overridden
# via dynamic configuration or another configuration layer.
continue
else:
raise RuntimeError("Missing 'value' element within the property "
"element: => %s " % (str(propInfo)))
# The value is allowed to contain substitution tags of the form
# ${env.VARNAME}, which should be substituted with the corresponding
# environment variable values
restOfValue = value
value = ''
while True:
# Find the beginning of substitution tag
pos = restOfValue.find('${env.')
if pos == -1:
# No more environment variable substitutions
value += restOfValue
break
# Append prefix to value accumulator
value += restOfValue[0:pos]
# Find the end of current substitution tag
varTailPos = restOfValue.find('}', pos)
if varTailPos == -1:
raise RuntimeError("Trailing environment variable tag delimiter '}'"
" not found in %r" % (restOfValue))
# Extract environment variable name from tag
varname = restOfValue[pos+6:varTailPos]
if varname not in os.environ:
raise RuntimeError("Attempting to use the value of the environment"
> " variable %r, which is not defined" % (varname))
E RuntimeError: Attempting to use the value of the environment variable 'USER', which is not defined
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:339: RuntimeError
------------------------------- Captured stderr --------------------------------
No handlers could be found for logger "com.numenta.nupic.tools.configuration_base"
_______ tests.unit.nupic.frameworks.opf.clamodel_classifier_helper_test ________
self = <tests.unit.nupic.frameworks.opf.clamodel_classifier_helper_test.CLAClassifierHelperTest testMethod=testAddRecordToKNN>
def setUp(self):
> self.helper = CLAModelClassifierHelper(Mock(spec=CLAModel))
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/frameworks/opf/clamodel_classifier_helper_test.py:152:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <nupic.frameworks.opf.clamodel_classifier_helper.CLAModelClassifierHelper object at 0x7f88abfafe90>
clamodel = <Mock spec='CLAModel' id='140224977630160'>, anomalyParams = {}
def __init__(self, clamodel, anomalyParams={}):
if anomalyParams is None:
anomalyParams = {}
self.clamodel = clamodel
self._version = CLAModelClassifierHelper.__VERSION__
self._classificationMaxDist = 0.1
if 'autoDetectWaitRecords' not in anomalyParams or \
anomalyParams['autoDetectWaitRecords'] is None:
self._autoDetectWaitRecords = int(Configuration.get(
> 'nupic.model.temporalAnomaly.wait_records'))
/usr/local/lib/python2.7/dist-packages/nupic/frameworks/opf/clamodel_classifier_helper.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
prop = 'nupic.model.temporalAnomaly.wait_records', default = None
@classmethod
def get(cls, prop, default=None):
""" Get the value of the given configuration property as string. This
returns a string which is the property value, or the value of "default" arg
if the property is not found. Use Configuration.getString() instead.
NOTE: it's atypical for our configuration properties to be missing - a
missing configuration property is usually a very serious error. Because
of this, it's preferable to use one of the getString, getInt, getFloat,
etc. variants instead of get(). Those variants will raise KeyError when
an expected property is missing.
Parameters:
----------------------------------------------------------------
prop: name of the property
default: default value to return if property does not exist
retval: property value (as a string), or default if the property does
not exist.
"""
try:
> return cls.getString(prop)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:162:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
prop = 'nupic.model.temporalAnomaly.wait_records'
@classmethod
def getString(cls, prop):
""" Retrieve the requested property as a string. If property does not exist,
then KeyError will be raised.
Parameters:
----------------------------------------------------------------
prop: name of the property
retval: property value as a string
"""
if cls._properties is None:
> cls._readStdConfigFiles()
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:81:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
@classmethod
def _readStdConfigFiles(cls):
""" Intercept the _readStdConfigFiles call from our base config class to
read in base and custom configuration settings.
"""
> super(Configuration, cls)._readStdConfigFiles()
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_custom.py:142:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
@classmethod
def _readStdConfigFiles(cls):
""" Read in all standard configuration files
"""
# Default one first
> cls.readConfigFile(DEFAULT_CONFIG)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:429:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
filename = 'nupic-default.xml', path = None
@classmethod
def readConfigFile(cls, filename, path=None):
""" Parse the given XML file and store all properties it describes.
Parameters:
----------------------------------------------------------------
filename: name of XML file to parse (no path)
path: path of the XML file. If None, then use the standard
configuration search path.
"""
> properties = cls._readConfigFile(filename, path)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:219:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
filename = 'nupic-default.xml', path = None
@classmethod
def _readConfigFile(cls, filename, path=None):
""" Parse the given XML file and return a dict describing the file.
Parameters:
----------------------------------------------------------------
filename: name of XML file to parse (no path)
path: path of the XML file. If None, then use the standard
configuration search path.
retval: returns a dict with each property as a key and a dict of all
the property's attributes as value
"""
outputProperties = dict()
# Get the path to the config files.
if path is None:
filePath = cls.findConfigFile(filename)
else:
filePath = os.path.join(path, filename)
# ------------------------------------------------------------------
# Read in the config file
try:
if filePath is not None:
try:
# Use warn since console log level is set to warning
_getLogger().debug("Loading config file: %s", filePath)
with open(filePath, 'rb') as inp:
contents = inp.read()
except Exception:
raise RuntimeError("Expected configuration file at %s" % filePath)
else:
# If the file was not found in the normal search paths, which includes
# checking the NTA_CONF_PATH, we'll try loading it from pkg_resources.
try:
contents = resource_string("nupic.support", filename)
except Exception as resourceException:
# We expect these to be read, and if they don't exist we'll just use
# an empty configuration string.
if filename in [USER_CONFIG, CUSTOM_CONFIG]:
contents = '<configuration/>'
else:
raise resourceException
elements = ElementTree.XML(contents)
if elements.tag != 'configuration':
raise RuntimeError("Expected top-level element to be 'configuration' "
"but got '%s'" % (elements.tag))
# ------------------------------------------------------------------
# Add in each property found
propertyElements = elements.findall('./property')
for propertyItem in propertyElements:
propInfo = dict()
# Parse this property element
propertyAttributes = list(propertyItem)
for propertyAttribute in propertyAttributes:
propInfo[propertyAttribute.tag] = propertyAttribute.text
# Get the name
name = propInfo.get('name', None)
# value is allowed to be empty string
if 'value' in propInfo and propInfo['value'] is None:
value = ''
else:
value = propInfo.get('value', None)
if value is None:
if 'novalue' in propInfo:
# Placeholder "novalue" properties are intended to be overridden
# via dynamic configuration or another configuration layer.
continue
else:
raise RuntimeError("Missing 'value' element within the property "
"element: => %s " % (str(propInfo)))
# The value is allowed to contain substitution tags of the form
# ${env.VARNAME}, which should be substituted with the corresponding
# environment variable values
restOfValue = value
value = ''
while True:
# Find the beginning of substitution tag
pos = restOfValue.find('${env.')
if pos == -1:
# No more environment variable substitutions
value += restOfValue
break
# Append prefix to value accumulator
value += restOfValue[0:pos]
# Find the end of current substitution tag
varTailPos = restOfValue.find('}', pos)
if varTailPos == -1:
raise RuntimeError("Trailing environment variable tag delimiter '}'"
" not found in %r" % (restOfValue))
# Extract environment variable name from tag
varname = restOfValue[pos+6:varTailPos]
if varname not in os.environ:
raise RuntimeError("Attempting to use the value of the environment"
> " variable %r, which is not defined" % (varname))
E RuntimeError: Attempting to use the value of the environment variable 'USER', which is not defined
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:339: RuntimeError
_____________ CLAClassifierHelperTest.testCLAClassificationRecord ______________
self = <tests.unit.nupic.frameworks.opf.clamodel_classifier_helper_test.CLAClassifierHelperTest testMethod=testCLAClassificationRecord>
def setUp(self):
> self.helper = CLAModelClassifierHelper(Mock(spec=CLAModel))
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/frameworks/opf/clamodel_classifier_helper_test.py:152:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <nupic.frameworks.opf.clamodel_classifier_helper.CLAModelClassifierHelper object at 0x7f88a9c00210>
clamodel = <Mock spec='CLAModel' id='140224940213520'>, anomalyParams = {}
def __init__(self, clamodel, anomalyParams={}):
if anomalyParams is None:
anomalyParams = {}
self.clamodel = clamodel
self._version = CLAModelClassifierHelper.__VERSION__
self._classificationMaxDist = 0.1
if 'autoDetectWaitRecords' not in anomalyParams or \
anomalyParams['autoDetectWaitRecords'] is None:
self._autoDetectWaitRecords = int(Configuration.get(
> 'nupic.model.temporalAnomaly.wait_records'))
/usr/local/lib/python2.7/dist-packages/nupic/frameworks/opf/clamodel_classifier_helper.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
prop = 'nupic.model.temporalAnomaly.wait_records', default = None
@classmethod
def get(cls, prop, default=None):
""" Get the value of the given configuration property as string. This
returns a string which is the property value, or the value of "default" arg
if the property is not found. Use Configuration.getString() instead.
NOTE: it's atypical for our configuration properties to be missing - a
missing configuration property is usually a very serious error. Because
of this, it's preferable to use one of the getString, getInt, getFloat,
etc. variants instead of get(). Those variants will raise KeyError when
an expected property is missing.
Parameters:
----------------------------------------------------------------
prop: name of the property
default: default value to return if property does not exist
retval: property value (as a string), or default if the property does
not exist.
"""
try:
> return cls.getString(prop)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:162:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
prop = 'nupic.model.temporalAnomaly.wait_records'
@classmethod
def getString(cls, prop):
""" Retrieve the requested property as a string. If property does not exist,
then KeyError will be raised.
Parameters:
----------------------------------------------------------------
prop: name of the property
retval: property value as a string
"""
if cls._properties is None:
> cls._readStdConfigFiles()
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:81:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
@classmethod
def _readStdConfigFiles(cls):
""" Intercept the _readStdConfigFiles call from our base config class to
read in base and custom configuration settings.
"""
> super(Configuration, cls)._readStdConfigFiles()
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_custom.py:142:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
@classmethod
def _readStdConfigFiles(cls):
""" Read in all standard configuration files
"""
# Default one first
> cls.readConfigFile(DEFAULT_CONFIG)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:429:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
filename = 'nupic-default.xml', path = None
@classmethod
def readConfigFile(cls, filename, path=None):
""" Parse the given XML file and store all properties it describes.
Parameters:
----------------------------------------------------------------
filename: name of XML file to parse (no path)
path: path of the XML file. If None, then use the standard
configuration search path.
"""
> properties = cls._readConfigFile(filename, path)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:219:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
filename = 'nupic-default.xml', path = None
@classmethod
def _readConfigFile(cls, filename, path=None):
""" Parse the given XML file and return a dict describing the file.
Parameters:
----------------------------------------------------------------
filename: name of XML file to parse (no path)
path: path of the XML file. If None, then use the standard
configuration search path.
retval: returns a dict with each property as a key and a dict of all
the property's attributes as value
"""
outputProperties = dict()
# Get the path to the config files.
if path is None:
filePath = cls.findConfigFile(filename)
else:
filePath = os.path.join(path, filename)
# ------------------------------------------------------------------
# Read in the config file
try:
if filePath is not None:
try:
# Use warn since console log level is set to warning
_getLogger().debug("Loading config file: %s", filePath)
with open(filePath, 'rb') as inp:
contents = inp.read()
except Exception:
raise RuntimeError("Expected configuration file at %s" % filePath)
else:
# If the file was not found in the normal search paths, which includes
# checking the NTA_CONF_PATH, we'll try loading it from pkg_resources.
try:
contents = resource_string("nupic.support", filename)
except Exception as resourceException:
# We expect these to be read, and if they don't exist we'll just use
# an empty configuration string.
if filename in [USER_CONFIG, CUSTOM_CONFIG]:
contents = '<configuration/>'
else:
raise resourceException
elements = ElementTree.XML(contents)
if elements.tag != 'configuration':
raise RuntimeError("Expected top-level element to be 'configuration' "
"but got '%s'" % (elements.tag))
# ------------------------------------------------------------------
# Add in each property found
propertyElements = elements.findall('./property')
for propertyItem in propertyElements:
propInfo = dict()
# Parse this property element
propertyAttributes = list(propertyItem)
for propertyAttribute in propertyAttributes:
propInfo[propertyAttribute.tag] = propertyAttribute.text
# Get the name
name = propInfo.get('name', None)
# value is allowed to be empty string
if 'value' in propInfo and propInfo['value'] is None:
value = ''
else:
value = propInfo.get('value', None)
if value is None:
if 'novalue' in propInfo:
# Placeholder "novalue" properties are intended to be overridden
# via dynamic configuration or another configuration layer.
continue
else:
raise RuntimeError("Missing 'value' element within the property "
"element: => %s " % (str(propInfo)))
# The value is allowed to contain substitution tags of the form
# ${env.VARNAME}, which should be substituted with the corresponding
# environment variable values
restOfValue = value
value = ''
while True:
# Find the beginning of substitution tag
pos = restOfValue.find('${env.')
if pos == -1:
# No more environment variable substitutions
value += restOfValue
break
# Append prefix to value accumulator
value += restOfValue[0:pos]
# Find the end of current substitution tag
varTailPos = restOfValue.find('}', pos)
if varTailPos == -1:
raise RuntimeError("Trailing environment variable tag delimiter '}'"
" not found in %r" % (restOfValue))
# Extract environment variable name from tag
varname = restOfValue[pos+6:varTailPos]
if varname not in os.environ:
raise RuntimeError("Attempting to use the value of the environment"
> " variable %r, which is not defined" % (varname))
E RuntimeError: Attempting to use the value of the environment variable 'USER', which is not defined
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:339: RuntimeError
_________ CLAClassifierHelperTest.testCLAClassificationRecordGetState __________
self = <tests.unit.nupic.frameworks.opf.clamodel_classifier_helper_test.CLAClassifierHelperTest testMethod=testCLAClassificationRecordGetState>
def setUp(self):
> self.helper = CLAModelClassifierHelper(Mock(spec=CLAModel))
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/frameworks/opf/clamodel_classifier_helper_test.py:152:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <nupic.frameworks.opf.clamodel_classifier_helper.CLAModelClassifierHelper object at 0x7f88ab2c1510>
clamodel = <Mock spec='CLAModel' id='140224945067216'>, anomalyParams = {}
def __init__(self, clamodel, anomalyParams={}):
if anomalyParams is None:
anomalyParams = {}
self.clamodel = clamodel
self._version = CLAModelClassifierHelper.__VERSION__
self._classificationMaxDist = 0.1
if 'autoDetectWaitRecords' not in anomalyParams or \
anomalyParams['autoDetectWaitRecords'] is None:
self._autoDetectWaitRecords = int(Configuration.get(
> 'nupic.model.temporalAnomaly.wait_records'))
/usr/local/lib/python2.7/dist-packages/nupic/frameworks/opf/clamodel_classifier_helper.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
prop = 'nupic.model.temporalAnomaly.wait_records', default = None
@classmethod
def get(cls, prop, default=None):
""" Get the value of the given configuration property as string. This
returns a string which is the property value, or the value of "default" arg
if the property is not found. Use Configuration.getString() instead.
NOTE: it's atypical for our configuration properties to be missing - a
missing configuration property is usually a very serious error. Because
of this, it's preferable to use one of the getString, getInt, getFloat,
etc. variants instead of get(). Those variants will raise KeyError when
an expected property is missing.
Parameters:
----------------------------------------------------------------
prop: name of the property
default: default value to return if property does not exist
retval: property value (as a string), or default if the property does
not exist.
"""
try:
> return cls.getString(prop)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:162:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
prop = 'nupic.model.temporalAnomaly.wait_records'
@classmethod
def getString(cls, prop):
""" Retrieve the requested property as a string. If property does not exist,
then KeyError will be raised.
Parameters:
----------------------------------------------------------------
prop: name of the property
retval: property value as a string
"""
if cls._properties is None:
> cls._readStdConfigFiles()
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:81:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
@classmethod
def _readStdConfigFiles(cls):
""" Intercept the _readStdConfigFiles call from our base config class to
read in base and custom configuration settings.
"""
> super(Configuration, cls)._readStdConfigFiles()
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_custom.py:142:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
@classmethod
def _readStdConfigFiles(cls):
""" Read in all standard configuration files
"""
# Default one first
> cls.readConfigFile(DEFAULT_CONFIG)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:429:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
filename = 'nupic-default.xml', path = None
@classmethod
def readConfigFile(cls, filename, path=None):
""" Parse the given XML file and store all properties it describes.
Parameters:
----------------------------------------------------------------
filename: name of XML file to parse (no path)
path: path of the XML file. If None, then use the standard
configuration search path.
"""
> properties = cls._readConfigFile(filename, path)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:219:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
filename = 'nupic-default.xml', path = None
@classmethod
def _readConfigFile(cls, filename, path=None):
""" Parse the given XML file and return a dict describing the file.
Parameters:
----------------------------------------------------------------
filename: name of XML file to parse (no path)
path: path of the XML file. If None, then use the standard
configuration search path.
retval: returns a dict with each property as a key and a dict of all
the property's attributes as value
"""
outputProperties = dict()
# Get the path to the config files.
if path is None:
filePath = cls.findConfigFile(filename)
else:
filePath = os.path.join(path, filename)
# ------------------------------------------------------------------
# Read in the config file
try:
if filePath is not None:
try:
# Use warn since console log level is set to warning
_getLogger().debug("Loading config file: %s", filePath)
with open(filePath, 'rb') as inp:
contents = inp.read()
except Exception:
raise RuntimeError("Expected configuration file at %s" % filePath)
else:
# If the file was not found in the normal search paths, which includes
# checking the NTA_CONF_PATH, we'll try loading it from pkg_resources.
try:
contents = resource_string("nupic.support", filename)
except Exception as resourceException:
# We expect these to be read, and if they don't exist we'll just use
# an empty configuration string.
if filename in [USER_CONFIG, CUSTOM_CONFIG]:
contents = '<configuration/>'
else:
raise resourceException
elements = ElementTree.XML(contents)
if elements.tag != 'configuration':
raise RuntimeError("Expected top-level element to be 'configuration' "
"but got '%s'" % (elements.tag))
# ------------------------------------------------------------------
# Add in each property found
propertyElements = elements.findall('./property')
for propertyItem in propertyElements:
propInfo = dict()
# Parse this property element
propertyAttributes = list(propertyItem)
for propertyAttribute in propertyAttributes:
propInfo[propertyAttribute.tag] = propertyAttribute.text
# Get the name
name = propInfo.get('name', None)
# value is allowed to be empty string
if 'value' in propInfo and propInfo['value'] is None:
value = ''
else:
value = propInfo.get('value', None)
if value is None:
if 'novalue' in propInfo:
# Placeholder "novalue" properties are intended to be overridden
# via dynamic configuration or another configuration layer.
continue
else:
raise RuntimeError("Missing 'value' element within the property "
"element: => %s " % (str(propInfo)))
# The value is allowed to contain substitution tags of the form
# ${env.VARNAME}, which should be substituted with the corresponding
# environment variable values
restOfValue = value
value = ''
while True:
# Find the beginning of substitution tag
pos = restOfValue.find('${env.')
if pos == -1:
# No more environment variable substitutions
value += restOfValue
break
# Append prefix to value accumulator
value += restOfValue[0:pos]
# Find the end of current substitution tag
varTailPos = restOfValue.find('}', pos)
if varTailPos == -1:
raise RuntimeError("Trailing environment variable tag delimiter '}'"
" not found in %r" % (restOfValue))
# Extract environment variable name from tag
varname = restOfValue[pos+6:varTailPos]
if varname not in os.environ:
raise RuntimeError("Attempting to use the value of the environment"
> " variable %r, which is not defined" % (varname))
E RuntimeError: Attempting to use the value of the environment variable 'USER', which is not defined
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:339: RuntimeError
_________ CLAClassifierHelperTest.testCLAClassificationRecordSetState __________
self = <tests.unit.nupic.frameworks.opf.clamodel_classifier_helper_test.CLAClassifierHelperTest testMethod=testCLAClassificationRecordSetState>
def setUp(self):
> self.helper = CLAModelClassifierHelper(Mock(spec=CLAModel))
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/frameworks/opf/clamodel_classifier_helper_test.py:152:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <nupic.frameworks.opf.clamodel_classifier_helper.CLAModelClassifierHelper object at 0x7f88ab22df50>
clamodel = <Mock spec='CLAModel' id='140224963468688'>, anomalyParams = {}
def __init__(self, clamodel, anomalyParams={}):
if anomalyParams is None:
anomalyParams = {}
self.clamodel = clamodel
self._version = CLAModelClassifierHelper.__VERSION__
self._classificationMaxDist = 0.1
if 'autoDetectWaitRecords' not in anomalyParams or \
anomalyParams['autoDetectWaitRecords'] is None:
self._autoDetectWaitRecords = int(Configuration.get(
> 'nupic.model.temporalAnomaly.wait_records'))
/usr/local/lib/python2.7/dist-packages/nupic/frameworks/opf/clamodel_classifier_helper.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
prop = 'nupic.model.temporalAnomaly.wait_records', default = None
@classmethod
def get(cls, prop, default=None):
""" Get the value of the given configuration property as string. This
returns a string which is the property value, or the value of "default" arg
if the property is not found. Use Configuration.getString() instead.
NOTE: it's atypical for our configuration properties to be missing - a
missing configuration property is usually a very serious error. Because
of this, it's preferable to use one of the getString, getInt, getFloat,
etc. variants instead of get(). Those variants will raise KeyError when
an expected property is missing.
Parameters:
----------------------------------------------------------------
prop: name of the property
default: default value to return if property does not exist
retval: property value (as a string), or default if the property does
not exist.
"""
try:
> return cls.getString(prop)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:162:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
prop = 'nupic.model.temporalAnomaly.wait_records'
@classmethod
def getString(cls, prop):
""" Retrieve the requested property as a string. If property does not exist,
then KeyError will be raised.
Parameters:
----------------------------------------------------------------
prop: name of the property
retval: property value as a string
"""
if cls._properties is None:
> cls._readStdConfigFiles()
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:81:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
@classmethod
def _readStdConfigFiles(cls):
""" Intercept the _readStdConfigFiles call from our base config class to
read in base and custom configuration settings.
"""
> super(Configuration, cls)._readStdConfigFiles()
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_custom.py:142:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
@classmethod
def _readStdConfigFiles(cls):
""" Read in all standard configuration files
"""
# Default one first
> cls.readConfigFile(DEFAULT_CONFIG)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:429:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
filename = 'nupic-default.xml', path = None
@classmethod
def readConfigFile(cls, filename, path=None):
""" Parse the given XML file and store all properties it describes.
Parameters:
----------------------------------------------------------------
filename: name of XML file to parse (no path)
path: path of the XML file. If None, then use the standard
configuration search path.
"""
> properties = cls._readConfigFile(filename, path)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:219:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
filename = 'nupic-default.xml', path = None
@classmethod
def _readConfigFile(cls, filename, path=None):
""" Parse the given XML file and return a dict describing the file.
Parameters:
----------------------------------------------------------------
filename: name of XML file to parse (no path)
path: path of the XML file. If None, then use the standard
configuration search path.
retval: returns a dict with each property as a key and a dict of all
the property's attributes as value
"""
outputProperties = dict()
# Get the path to the config files.
if path is None:
filePath = cls.findConfigFile(filename)
else:
filePath = os.path.join(path, filename)
# ------------------------------------------------------------------
# Read in the config file
try:
if filePath is not None:
try:
# Use warn since console log level is set to warning
_getLogger().debug("Loading config file: %s", filePath)
with open(filePath, 'rb') as inp:
contents = inp.read()
except Exception:
raise RuntimeError("Expected configuration file at %s" % filePath)
else:
# If the file was not found in the normal search paths, which includes
# checking the NTA_CONF_PATH, we'll try loading it from pkg_resources.
try:
contents = resource_string("nupic.support", filename)
except Exception as resourceException:
# We expect these to be read, and if they don't exist we'll just use
# an empty configuration string.
if filename in [USER_CONFIG, CUSTOM_CONFIG]:
contents = '<configuration/>'
else:
raise resourceException
elements = ElementTree.XML(contents)
if elements.tag != 'configuration':
raise RuntimeError("Expected top-level element to be 'configuration' "
"but got '%s'" % (elements.tag))
# ------------------------------------------------------------------
# Add in each property found
propertyElements = elements.findall('./property')
for propertyItem in propertyElements:
propInfo = dict()
# Parse this property element
propertyAttributes = list(propertyItem)
for propertyAttribute in propertyAttributes:
propInfo[propertyAttribute.tag] = propertyAttribute.text
# Get the name
name = propInfo.get('name', None)
# value is allowed to be empty string
if 'value' in propInfo and propInfo['value'] is None:
value = ''
else:
value = propInfo.get('value', None)
if value is None:
if 'novalue' in propInfo:
# Placeholder "novalue" properties are intended to be overridden
# via dynamic configuration or another configuration layer.
continue
else:
raise RuntimeError("Missing 'value' element within the property "
"element: => %s " % (str(propInfo)))
# The value is allowed to contain substitution tags of the form
# ${env.VARNAME}, which should be substituted with the corresponding
# environment variable values
restOfValue = value
value = ''
while True:
# Find the beginning of substitution tag
pos = restOfValue.find('${env.')
if pos == -1:
# No more environment variable substitutions
value += restOfValue
break
# Append prefix to value accumulator
value += restOfValue[0:pos]
# Find the end of current substitution tag
varTailPos = restOfValue.find('}', pos)
if varTailPos == -1:
raise RuntimeError("Trailing environment variable tag delimiter '}'"
" not found in %r" % (restOfValue))
# Extract environment variable name from tag
varname = restOfValue[pos+6:varTailPos]
if varname not in os.environ:
raise RuntimeError("Attempting to use the value of the environment"
> " variable %r, which is not defined" % (varname))
E RuntimeError: Attempting to use the value of the environment variable 'USER', which is not defined
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:339: RuntimeError
__________________ CLAClassifierHelperTest.testCategoryToList __________________
self = <tests.unit.nupic.frameworks.opf.clamodel_classifier_helper_test.CLAClassifierHelperTest testMethod=testCategoryToList>
def setUp(self):
> self.helper = CLAModelClassifierHelper(Mock(spec=CLAModel))
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/frameworks/opf/clamodel_classifier_helper_test.py:152:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <nupic.frameworks.opf.clamodel_classifier_helper.CLAModelClassifierHelper object at 0x7f88a9c26fd0>
clamodel = <Mock spec='CLAModel' id='140224940371216'>, anomalyParams = {}
def __init__(self, clamodel, anomalyParams={}):
if anomalyParams is None:
anomalyParams = {}
self.clamodel = clamodel
self._version = CLAModelClassifierHelper.__VERSION__
self._classificationMaxDist = 0.1
if 'autoDetectWaitRecords' not in anomalyParams or \
anomalyParams['autoDetectWaitRecords'] is None:
self._autoDetectWaitRecords = int(Configuration.get(
> 'nupic.model.temporalAnomaly.wait_records'))
/usr/local/lib/python2.7/dist-packages/nupic/frameworks/opf/clamodel_classifier_helper.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
prop = 'nupic.model.temporalAnomaly.wait_records', default = None
@classmethod
def get(cls, prop, default=None):
""" Get the value of the given configuration property as string. This
returns a string which is the property value, or the value of "default" arg
if the property is not found. Use Configuration.getString() instead.
NOTE: it's atypical for our configuration properties to be missing - a
missing configuration property is usually a very serious error. Because
of this, it's preferable to use one of the getString, getInt, getFloat,
etc. variants instead of get(). Those variants will raise KeyError when
an expected property is missing.
Parameters:
----------------------------------------------------------------
prop: name of the property
default: default value to return if property does not exist
retval: property value (as a string), or default if the property does
not exist.
"""
try:
> return cls.getString(prop)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:162:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
prop = 'nupic.model.temporalAnomaly.wait_records'
@classmethod
def getString(cls, prop):
""" Retrieve the requested property as a string. If property does not exist,
then KeyError will be raised.
Parameters:
----------------------------------------------------------------
prop: name of the property
retval: property value as a string
"""
if cls._properties is None:
> cls._readStdConfigFiles()
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:81:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
@classmethod
def _readStdConfigFiles(cls):
""" Intercept the _readStdConfigFiles call from our base config class to
read in base and custom configuration settings.
"""
> super(Configuration, cls)._readStdConfigFiles()
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_custom.py:142:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
@classmethod
def _readStdConfigFiles(cls):
""" Read in all standard configuration files
"""
# Default one first
> cls.readConfigFile(DEFAULT_CONFIG)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:429:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
filename = 'nupic-default.xml', path = None
@classmethod
def readConfigFile(cls, filename, path=None):
""" Parse the given XML file and store all properties it describes.
Parameters:
----------------------------------------------------------------
filename: name of XML file to parse (no path)
path: path of the XML file. If None, then use the standard
configuration search path.
"""
> properties = cls._readConfigFile(filename, path)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:219:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
filename = 'nupic-default.xml', path = None
@classmethod
def _readConfigFile(cls, filename, path=None):
""" Parse the given XML file and return a dict describing the file.
Parameters:
----------------------------------------------------------------
filename: name of XML file to parse (no path)
path: path of the XML file. If None, then use the standard
configuration search path.
retval: returns a dict with each property as a key and a dict of all
the property's attributes as value
"""
outputProperties = dict()
# Get the path to the config files.
if path is None:
filePath = cls.findConfigFile(filename)
else:
filePath = os.path.join(path, filename)
# ------------------------------------------------------------------
# Read in the config file
try:
if filePath is not None:
try:
# Use warn since console log level is set to warning
_getLogger().debug("Loading config file: %s", filePath)
with open(filePath, 'rb') as inp:
contents = inp.read()
except Exception:
raise RuntimeError("Expected configuration file at %s" % filePath)
else:
# If the file was not found in the normal search paths, which includes
# checking the NTA_CONF_PATH, we'll try loading it from pkg_resources.
try:
contents = resource_string("nupic.support", filename)
except Exception as resourceException:
# We expect these to be read, and if they don't exist we'll just use
# an empty configuration string.
if filename in [USER_CONFIG, CUSTOM_CONFIG]:
contents = '<configuration/>'
else:
raise resourceException
elements = ElementTree.XML(contents)
if elements.tag != 'configuration':
raise RuntimeError("Expected top-level element to be 'configuration' "
"but got '%s'" % (elements.tag))
# ------------------------------------------------------------------
# Add in each property found
propertyElements = elements.findall('./property')
for propertyItem in propertyElements:
propInfo = dict()
# Parse this property element
propertyAttributes = list(propertyItem)
for propertyAttribute in propertyAttributes:
propInfo[propertyAttribute.tag] = propertyAttribute.text
# Get the name
name = propInfo.get('name', None)
# value is allowed to be empty string
if 'value' in propInfo and propInfo['value'] is None:
value = ''
else:
value = propInfo.get('value', None)
if value is None:
if 'novalue' in propInfo:
# Placeholder "novalue" properties are intended to be overridden
# via dynamic configuration or another configuration layer.
continue
else:
raise RuntimeError("Missing 'value' element within the property "
"element: => %s " % (str(propInfo)))
# The value is allowed to contain substitution tags of the form
# ${env.VARNAME}, which should be substituted with the corresponding
# environment variable values
restOfValue = value
value = ''
while True:
# Find the beginning of substitution tag
pos = restOfValue.find('${env.')
if pos == -1:
# No more environment variable substitutions
value += restOfValue
break
# Append prefix to value accumulator
value += restOfValue[0:pos]
# Find the end of current substitution tag
varTailPos = restOfValue.find('}', pos)
if varTailPos == -1:
raise RuntimeError("Trailing environment variable tag delimiter '}'"
" not found in %r" % (restOfValue))
# Extract environment variable name from tag
varname = restOfValue[pos+6:varTailPos]
if varname not in os.environ:
raise RuntimeError("Attempting to use the value of the environment"
> " variable %r, which is not defined" % (varname))
E RuntimeError: Attempting to use the value of the environment variable 'USER', which is not defined
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:339: RuntimeError
_______ tests.unit.nupic.frameworks.opf.clamodel_classifier_helper_test ________
self = <tests.unit.nupic.frameworks.opf.clamodel_classifier_helper_test.CLAClassifierHelperTest testMethod=testCompute>
def setUp(self):
> self.helper = CLAModelClassifierHelper(Mock(spec=CLAModel))
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/frameworks/opf/clamodel_classifier_helper_test.py:152:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <nupic.frameworks.opf.clamodel_classifier_helper.CLAModelClassifierHelper object at 0x7f88aa443f50>
clamodel = <Mock spec='CLAModel' id='140224948878480'>, anomalyParams = {}
def __init__(self, clamodel, anomalyParams={}):
if anomalyParams is None:
anomalyParams = {}
self.clamodel = clamodel
self._version = CLAModelClassifierHelper.__VERSION__
self._classificationMaxDist = 0.1
if 'autoDetectWaitRecords' not in anomalyParams or \
anomalyParams['autoDetectWaitRecords'] is None:
self._autoDetectWaitRecords = int(Configuration.get(
> 'nupic.model.temporalAnomaly.wait_records'))
/usr/local/lib/python2.7/dist-packages/nupic/frameworks/opf/clamodel_classifier_helper.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
prop = 'nupic.model.temporalAnomaly.wait_records', default = None
@classmethod
def get(cls, prop, default=None):
""" Get the value of the given configuration property as string. This
returns a string which is the property value, or the value of "default" arg
if the property is not found. Use Configuration.getString() instead.
NOTE: it's atypical for our configuration properties to be missing - a
missing configuration property is usually a very serious error. Because
of this, it's preferable to use one of the getString, getInt, getFloat,
etc. variants instead of get(). Those variants will raise KeyError when
an expected property is missing.
Parameters:
----------------------------------------------------------------
prop: name of the property
default: default value to return if property does not exist
retval: property value (as a string), or default if the property does
not exist.
"""
try:
> return cls.getString(prop)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:162:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
prop = 'nupic.model.temporalAnomaly.wait_records'
@classmethod
def getString(cls, prop):
""" Retrieve the requested property as a string. If property does not exist,
then KeyError will be raised.
Parameters:
----------------------------------------------------------------
prop: name of the property
retval: property value as a string
"""
if cls._properties is None:
> cls._readStdConfigFiles()
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:81:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
@classmethod
def _readStdConfigFiles(cls):
""" Intercept the _readStdConfigFiles call from our base config class to
read in base and custom configuration settings.
"""
> super(Configuration, cls)._readStdConfigFiles()
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_custom.py:142:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
@classmethod
def _readStdConfigFiles(cls):
""" Read in all standard configuration files
"""
# Default one first
> cls.readConfigFile(DEFAULT_CONFIG)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:429:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
filename = 'nupic-default.xml', path = None
@classmethod
def readConfigFile(cls, filename, path=None):
""" Parse the given XML file and store all properties it describes.
Parameters:
----------------------------------------------------------------
filename: name of XML file to parse (no path)
path: path of the XML file. If None, then use the standard
configuration search path.
"""
> properties = cls._readConfigFile(filename, path)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:219:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
filename = 'nupic-default.xml', path = None
@classmethod
def _readConfigFile(cls, filename, path=None):
""" Parse the given XML file and return a dict describing the file.
Parameters:
----------------------------------------------------------------
filename: name of XML file to parse (no path)
path: path of the XML file. If None, then use the standard
configuration search path.
retval: returns a dict with each property as a key and a dict of all
the property's attributes as value
"""
outputProperties = dict()
# Get the path to the config files.
if path is None:
filePath = cls.findConfigFile(filename)
else:
filePath = os.path.join(path, filename)
# ------------------------------------------------------------------
# Read in the config file
try:
if filePath is not None:
try:
# Use warn since console log level is set to warning
_getLogger().debug("Loading config file: %s", filePath)
with open(filePath, 'rb') as inp:
contents = inp.read()
except Exception:
raise RuntimeError("Expected configuration file at %s" % filePath)
else:
# If the file was not found in the normal search paths, which includes
# checking the NTA_CONF_PATH, we'll try loading it from pkg_resources.
try:
contents = resource_string("nupic.support", filename)
except Exception as resourceException:
# We expect these to be read, and if they don't exist we'll just use
# an empty configuration string.
if filename in [USER_CONFIG, CUSTOM_CONFIG]:
contents = '<configuration/>'
else:
raise resourceException
elements = ElementTree.XML(contents)
if elements.tag != 'configuration':
raise RuntimeError("Expected top-level element to be 'configuration' "
"but got '%s'" % (elements.tag))
# ------------------------------------------------------------------
# Add in each property found
propertyElements = elements.findall('./property')
for propertyItem in propertyElements:
propInfo = dict()
# Parse this property element
propertyAttributes = list(propertyItem)
for propertyAttribute in propertyAttributes:
propInfo[propertyAttribute.tag] = propertyAttribute.text
# Get the name
name = propInfo.get('name', None)
# value is allowed to be empty string
if 'value' in propInfo and propInfo['value'] is None:
value = ''
else:
value = propInfo.get('value', None)
if value is None:
if 'novalue' in propInfo:
# Placeholder "novalue" properties are intended to be overridden
# via dynamic configuration or another configuration layer.
continue
else:
raise RuntimeError("Missing 'value' element within the property "
"element: => %s " % (str(propInfo)))
# The value is allowed to contain substitution tags of the form
# ${env.VARNAME}, which should be substituted with the corresponding
# environment variable values
restOfValue = value
value = ''
while True:
# Find the beginning of substitution tag
pos = restOfValue.find('${env.')
if pos == -1:
# No more environment variable substitutions
value += restOfValue
break
# Append prefix to value accumulator
value += restOfValue[0:pos]
# Find the end of current substitution tag
varTailPos = restOfValue.find('}', pos)
if varTailPos == -1:
raise RuntimeError("Trailing environment variable tag delimiter '}'"
" not found in %r" % (restOfValue))
# Extract environment variable name from tag
varname = restOfValue[pos+6:varTailPos]
if varname not in os.environ:
raise RuntimeError("Attempting to use the value of the environment"
> " variable %r, which is not defined" % (varname))
E RuntimeError: Attempting to use the value of the environment variable 'USER', which is not defined
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:339: RuntimeError
_______ tests.unit.nupic.frameworks.opf.clamodel_classifier_helper_test ________
self = <tests.unit.nupic.frameworks.opf.clamodel_classifier_helper_test.CLAClassifierHelperTest testMethod=testConfiguration>
def setUp(self):
> self.helper = CLAModelClassifierHelper(Mock(spec=CLAModel))
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/frameworks/opf/clamodel_classifier_helper_test.py:152:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <nupic.frameworks.opf.clamodel_classifier_helper.CLAModelClassifierHelper object at 0x7f88a9a5e0d0>
clamodel = <Mock spec='CLAModel' id='140224938500560'>, anomalyParams = {}
def __init__(self, clamodel, anomalyParams={}):
if anomalyParams is None:
anomalyParams = {}
self.clamodel = clamodel
self._version = CLAModelClassifierHelper.__VERSION__
self._classificationMaxDist = 0.1
if 'autoDetectWaitRecords' not in anomalyParams or \
anomalyParams['autoDetectWaitRecords'] is None:
self._autoDetectWaitRecords = int(Configuration.get(
> 'nupic.model.temporalAnomaly.wait_records'))
/usr/local/lib/python2.7/dist-packages/nupic/frameworks/opf/clamodel_classifier_helper.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
prop = 'nupic.model.temporalAnomaly.wait_records', default = None
@classmethod
def get(cls, prop, default=None):
""" Get the value of the given configuration property as string. This
returns a string which is the property value, or the value of "default" arg
if the property is not found. Use Configuration.getString() instead.
NOTE: it's atypical for our configuration properties to be missing - a
missing configuration property is usually a very serious error. Because
of this, it's preferable to use one of the getString, getInt, getFloat,
etc. variants instead of get(). Those variants will raise KeyError when
an expected property is missing.
Parameters:
----------------------------------------------------------------
prop: name of the property
default: default value to return if property does not exist
retval: property value (as a string), or default if the property does
not exist.
"""
try:
> return cls.getString(prop)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:162:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
prop = 'nupic.model.temporalAnomaly.wait_records'
@classmethod
def getString(cls, prop):
""" Retrieve the requested property as a string. If property does not exist,
then KeyError will be raised.
Parameters:
----------------------------------------------------------------
prop: name of the property
retval: property value as a string
"""
if cls._properties is None:
> cls._readStdConfigFiles()
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:81:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
@classmethod
def _readStdConfigFiles(cls):
""" Intercept the _readStdConfigFiles call from our base config class to
read in base and custom configuration settings.
"""
> super(Configuration, cls)._readStdConfigFiles()
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_custom.py:142:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
@classmethod
def _readStdConfigFiles(cls):
""" Read in all standard configuration files
"""
# Default one first
> cls.readConfigFile(DEFAULT_CONFIG)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:429:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
filename = 'nupic-default.xml', path = None
@classmethod
def readConfigFile(cls, filename, path=None):
""" Parse the given XML file and store all properties it describes.
Parameters:
----------------------------------------------------------------
filename: name of XML file to parse (no path)
path: path of the XML file. If None, then use the standard
configuration search path.
"""
> properties = cls._readConfigFile(filename, path)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:219:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
filename = 'nupic-default.xml', path = None
@classmethod
def _readConfigFile(cls, filename, path=None):
""" Parse the given XML file and return a dict describing the file.
Parameters:
----------------------------------------------------------------
filename: name of XML file to parse (no path)
path: path of the XML file. If None, then use the standard
configuration search path.
retval: returns a dict with each property as a key and a dict of all
the property's attributes as value
"""
outputProperties = dict()
# Get the path to the config files.
if path is None:
filePath = cls.findConfigFile(filename)
else:
filePath = os.path.join(path, filename)
# ------------------------------------------------------------------
# Read in the config file
try:
if filePath is not None:
try:
# Use warn since console log level is set to warning
_getLogger().debug("Loading config file: %s", filePath)
with open(filePath, 'rb') as inp:
contents = inp.read()
except Exception:
raise RuntimeError("Expected configuration file at %s" % filePath)
else:
# If the file was not found in the normal search paths, which includes
# checking the NTA_CONF_PATH, we'll try loading it from pkg_resources.
try:
contents = resource_string("nupic.support", filename)
except Exception as resourceException:
# We expect these to be read, and if they don't exist we'll just use
# an empty configuration string.
if filename in [USER_CONFIG, CUSTOM_CONFIG]:
contents = '<configuration/>'
else:
raise resourceException
elements = ElementTree.XML(contents)
if elements.tag != 'configuration':
raise RuntimeError("Expected top-level element to be 'configuration' "
"but got '%s'" % (elements.tag))
# ------------------------------------------------------------------
# Add in each property found
propertyElements = elements.findall('./property')
for propertyItem in propertyElements:
propInfo = dict()
# Parse this property element
propertyAttributes = list(propertyItem)
for propertyAttribute in propertyAttributes:
propInfo[propertyAttribute.tag] = propertyAttribute.text
# Get the name
name = propInfo.get('name', None)
# value is allowed to be empty string
if 'value' in propInfo and propInfo['value'] is None:
value = ''
else:
value = propInfo.get('value', None)
if value is None:
if 'novalue' in propInfo:
# Placeholder "novalue" properties are intended to be overridden
# via dynamic configuration or another configuration layer.
continue
else:
raise RuntimeError("Missing 'value' element within the property "
"element: => %s " % (str(propInfo)))
# The value is allowed to contain substitution tags of the form
# ${env.VARNAME}, which should be substituted with the corresponding
# environment variable values
restOfValue = value
value = ''
while True:
# Find the beginning of substitution tag
pos = restOfValue.find('${env.')
if pos == -1:
# No more environment variable substitutions
value += restOfValue
break
# Append prefix to value accumulator
value += restOfValue[0:pos]
# Find the end of current substitution tag
varTailPos = restOfValue.find('}', pos)
if varTailPos == -1:
raise RuntimeError("Trailing environment variable tag delimiter '}'"
" not found in %r" % (restOfValue))
# Extract environment variable name from tag
varname = restOfValue[pos+6:varTailPos]
if varname not in os.environ:
raise RuntimeError("Attempting to use the value of the environment"
> " variable %r, which is not defined" % (varname))
E RuntimeError: Attempting to use the value of the environment variable 'USER', which is not defined
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:339: RuntimeError
_______ tests.unit.nupic.frameworks.opf.clamodel_classifier_helper_test ________
self = <tests.unit.nupic.frameworks.opf.clamodel_classifier_helper_test.CLAClassifierHelperTest testMethod=testConfigurationFail>
def setUp(self):
> self.helper = CLAModelClassifierHelper(Mock(spec=CLAModel))
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/frameworks/opf/clamodel_classifier_helper_test.py:152:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <nupic.frameworks.opf.clamodel_classifier_helper.CLAModelClassifierHelper object at 0x7f88ab2d9910>
clamodel = <Mock spec='CLAModel' id='140224938501392'>, anomalyParams = {}
def __init__(self, clamodel, anomalyParams={}):
if anomalyParams is None:
anomalyParams = {}
self.clamodel = clamodel
self._version = CLAModelClassifierHelper.__VERSION__
self._classificationMaxDist = 0.1
if 'autoDetectWaitRecords' not in anomalyParams or \
anomalyParams['autoDetectWaitRecords'] is None:
self._autoDetectWaitRecords = int(Configuration.get(
> 'nupic.model.temporalAnomaly.wait_records'))
/usr/local/lib/python2.7/dist-packages/nupic/frameworks/opf/clamodel_classifier_helper.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
prop = 'nupic.model.temporalAnomaly.wait_records', default = None
@classmethod
def get(cls, prop, default=None):
""" Get the value of the given configuration property as string. This
returns a string which is the property value, or the value of "default" arg
if the property is not found. Use Configuration.getString() instead.
NOTE: it's atypical for our configuration properties to be missing - a
missing configuration property is usually a very serious error. Because
of this, it's preferable to use one of the getString, getInt, getFloat,
etc. variants instead of get(). Those variants will raise KeyError when
an expected property is missing.
Parameters:
----------------------------------------------------------------
prop: name of the property
default: default value to return if property does not exist
retval: property value (as a string), or default if the property does
not exist.
"""
try:
> return cls.getString(prop)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:162:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
prop = 'nupic.model.temporalAnomaly.wait_records'
@classmethod
def getString(cls, prop):
""" Retrieve the requested property as a string. If property does not exist,
then KeyError will be raised.
Parameters:
----------------------------------------------------------------
prop: name of the property
retval: property value as a string
"""
if cls._properties is None:
> cls._readStdConfigFiles()
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:81:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
@classmethod
def _readStdConfigFiles(cls):
""" Intercept the _readStdConfigFiles call from our base config class to
read in base and custom configuration settings.
"""
> super(Configuration, cls)._readStdConfigFiles()
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_custom.py:142:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
@classmethod
def _readStdConfigFiles(cls):
""" Read in all standard configuration files
"""
# Default one first
> cls.readConfigFile(DEFAULT_CONFIG)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:429:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
filename = 'nupic-default.xml', path = None
@classmethod
def readConfigFile(cls, filename, path=None):
""" Parse the given XML file and store all properties it describes.
Parameters:
----------------------------------------------------------------
filename: name of XML file to parse (no path)
path: path of the XML file. If None, then use the standard
configuration search path.
"""
> properties = cls._readConfigFile(filename, path)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:219:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
filename = 'nupic-default.xml', path = None
@classmethod
def _readConfigFile(cls, filename, path=None):
""" Parse the given XML file and return a dict describing the file.
Parameters:
----------------------------------------------------------------
filename: name of XML file to parse (no path)
path: path of the XML file. If None, then use the standard
configuration search path.
retval: returns a dict with each property as a key and a dict of all
the property's attributes as value
"""
outputProperties = dict()
# Get the path to the config files.
if path is None:
filePath = cls.findConfigFile(filename)
else:
filePath = os.path.join(path, filename)
# ------------------------------------------------------------------
# Read in the config file
try:
if filePath is not None:
try:
# Use warn since console log level is set to warning
_getLogger().debug("Loading config file: %s", filePath)
with open(filePath, 'rb') as inp:
contents = inp.read()
except Exception:
raise RuntimeError("Expected configuration file at %s" % filePath)
else:
# If the file was not found in the normal search paths, which includes
# checking the NTA_CONF_PATH, we'll try loading it from pkg_resources.
try:
contents = resource_string("nupic.support", filename)
except Exception as resourceException:
# We expect these to be read, and if they don't exist we'll just use
# an empty configuration string.
if filename in [USER_CONFIG, CUSTOM_CONFIG]:
contents = '<configuration/>'
else:
raise resourceException
elements = ElementTree.XML(contents)
if elements.tag != 'configuration':
raise RuntimeError("Expected top-level element to be 'configuration' "
"but got '%s'" % (elements.tag))
# ------------------------------------------------------------------
# Add in each property found
propertyElements = elements.findall('./property')
for propertyItem in propertyElements:
propInfo = dict()
# Parse this property element
propertyAttributes = list(propertyItem)
for propertyAttribute in propertyAttributes:
propInfo[propertyAttribute.tag] = propertyAttribute.text
# Get the name
name = propInfo.get('name', None)
# value is allowed to be empty string
if 'value' in propInfo and propInfo['value'] is None:
value = ''
else:
value = propInfo.get('value', None)
if value is None:
if 'novalue' in propInfo:
# Placeholder "novalue" properties are intended to be overridden
# via dynamic configuration or another configuration layer.
continue
else:
raise RuntimeError("Missing 'value' element within the property "
"element: => %s " % (str(propInfo)))
# The value is allowed to contain substitution tags of the form
# ${env.VARNAME}, which should be substituted with the corresponding
# environment variable values
restOfValue = value
value = ''
while True:
# Find the beginning of substitution tag
pos = restOfValue.find('${env.')
if pos == -1:
# No more environment variable substitutions
value += restOfValue
break
# Append prefix to value accumulator
value += restOfValue[0:pos]
# Find the end of current substitution tag
varTailPos = restOfValue.find('}', pos)
if varTailPos == -1:
raise RuntimeError("Trailing environment variable tag delimiter '}'"
" not found in %r" % (restOfValue))
# Extract environment variable name from tag
varname = restOfValue[pos+6:varTailPos]
if varname not in os.environ:
raise RuntimeError("Attempting to use the value of the environment"
> " variable %r, which is not defined" % (varname))
E RuntimeError: Attempting to use the value of the environment variable 'USER', which is not defined
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:339: RuntimeError
__________ CLAClassifierHelperTest.testConstructClassificationVector ___________
self = <tests.unit.nupic.frameworks.opf.clamodel_classifier_helper_test.CLAClassifierHelperTest testMethod=testConstructClassificationVector>
def setUp(self):
> self.helper = CLAModelClassifierHelper(Mock(spec=CLAModel))
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/frameworks/opf/clamodel_classifier_helper_test.py:152:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <nupic.frameworks.opf.clamodel_classifier_helper.CLAModelClassifierHelper object at 0x7f88a9c31650>
clamodel = <Mock spec='CLAModel' id='140225072434256'>, anomalyParams = {}
def __init__(self, clamodel, anomalyParams={}):
if anomalyParams is None:
anomalyParams = {}
self.clamodel = clamodel
self._version = CLAModelClassifierHelper.__VERSION__
self._classificationMaxDist = 0.1
if 'autoDetectWaitRecords' not in anomalyParams or \
anomalyParams['autoDetectWaitRecords'] is None:
self._autoDetectWaitRecords = int(Configuration.get(
> 'nupic.model.temporalAnomaly.wait_records'))
/usr/local/lib/python2.7/dist-packages/nupic/frameworks/opf/clamodel_classifier_helper.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
prop = 'nupic.model.temporalAnomaly.wait_records', default = None
@classmethod
def get(cls, prop, default=None):
""" Get the value of the given configuration property as string. This
returns a string which is the property value, or the value of "default" arg
if the property is not found. Use Configuration.getString() instead.
NOTE: it's atypical for our configuration properties to be missing - a
missing configuration property is usually a very serious error. Because
of this, it's preferable to use one of the getString, getInt, getFloat,
etc. variants instead of get(). Those variants will raise KeyError when
an expected property is missing.
Parameters:
----------------------------------------------------------------
prop: name of the property
default: default value to return if property does not exist
retval: property value (as a string), or default if the property does
not exist.
"""
try:
> return cls.getString(prop)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:162:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
prop = 'nupic.model.temporalAnomaly.wait_records'
@classmethod
def getString(cls, prop):
""" Retrieve the requested property as a string. If property does not exist,
then KeyError will be raised.
Parameters:
----------------------------------------------------------------
prop: name of the property
retval: property value as a string
"""
if cls._properties is None:
> cls._readStdConfigFiles()
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:81:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
@classmethod
def _readStdConfigFiles(cls):
""" Intercept the _readStdConfigFiles call from our base config class to
read in base and custom configuration settings.
"""
> super(Configuration, cls)._readStdConfigFiles()
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_custom.py:142:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
@classmethod
def _readStdConfigFiles(cls):
""" Read in all standard configuration files
"""
# Default one first
> cls.readConfigFile(DEFAULT_CONFIG)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:429:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
filename = 'nupic-default.xml', path = None
@classmethod
def readConfigFile(cls, filename, path=None):
""" Parse the given XML file and store all properties it describes.
Parameters:
----------------------------------------------------------------
filename: name of XML file to parse (no path)
path: path of the XML file. If None, then use the standard
configuration search path.
"""
> properties = cls._readConfigFile(filename, path)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:219:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
filename = 'nupic-default.xml', path = None
@classmethod
def _readConfigFile(cls, filename, path=None):
""" Parse the given XML file and return a dict describing the file.
Parameters:
----------------------------------------------------------------
filename: name of XML file to parse (no path)
path: path of the XML file. If None, then use the standard
configuration search path.
retval: returns a dict with each property as a key and a dict of all
the property's attributes as value
"""
outputProperties = dict()
# Get the path to the config files.
if path is None:
filePath = cls.findConfigFile(filename)
else:
filePath = os.path.join(path, filename)
# ------------------------------------------------------------------
# Read in the config file
try:
if filePath is not None:
try:
# Use warn since console log level is set to warning
_getLogger().debug("Loading config file: %s", filePath)
with open(filePath, 'rb') as inp:
contents = inp.read()
except Exception:
raise RuntimeError("Expected configuration file at %s" % filePath)
else:
# If the file was not found in the normal search paths, which includes
# checking the NTA_CONF_PATH, we'll try loading it from pkg_resources.
try:
contents = resource_string("nupic.support", filename)
except Exception as resourceException:
# We expect these to be read, and if they don't exist we'll just use
# an empty configuration string.
if filename in [USER_CONFIG, CUSTOM_CONFIG]:
contents = '<configuration/>'
else:
raise resourceException
elements = ElementTree.XML(contents)
if elements.tag != 'configuration':
raise RuntimeError("Expected top-level element to be 'configuration' "
"but got '%s'" % (elements.tag))
# ------------------------------------------------------------------
# Add in each property found
propertyElements = elements.findall('./property')
for propertyItem in propertyElements:
propInfo = dict()
# Parse this property element
propertyAttributes = list(propertyItem)
for propertyAttribute in propertyAttributes:
propInfo[propertyAttribute.tag] = propertyAttribute.text
# Get the name
name = propInfo.get('name', None)
# value is allowed to be empty string
if 'value' in propInfo and propInfo['value'] is None:
value = ''
else:
value = propInfo.get('value', None)
if value is None:
if 'novalue' in propInfo:
# Placeholder "novalue" properties are intended to be overridden
# via dynamic configuration or another configuration layer.
continue
else:
raise RuntimeError("Missing 'value' element within the property "
"element: => %s " % (str(propInfo)))
# The value is allowed to contain substitution tags of the form
# ${env.VARNAME}, which should be substituted with the corresponding
# environment variable values
restOfValue = value
value = ''
while True:
# Find the beginning of substitution tag
pos = restOfValue.find('${env.')
if pos == -1:
# No more environment variable substitutions
value += restOfValue
break
# Append prefix to value accumulator
value += restOfValue[0:pos]
# Find the end of current substitution tag
varTailPos = restOfValue.find('}', pos)
if varTailPos == -1:
raise RuntimeError("Trailing environment variable tag delimiter '}'"
" not found in %r" % (restOfValue))
# Extract environment variable name from tag
varname = restOfValue[pos+6:varTailPos]
if varname not in os.environ:
raise RuntimeError("Attempting to use the value of the environment"
> " variable %r, which is not defined" % (varname))
E RuntimeError: Attempting to use the value of the environment variable 'USER', which is not defined
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:339: RuntimeError
_______ tests.unit.nupic.frameworks.opf.clamodel_classifier_helper_test ________
self = <tests.unit.nupic.frameworks.opf.clamodel_classifier_helper_test.CLAClassifierHelperTest testMethod=testDeleteRangeFromKNN>
def setUp(self):
> self.helper = CLAModelClassifierHelper(Mock(spec=CLAModel))
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/frameworks/opf/clamodel_classifier_helper_test.py:152:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <nupic.frameworks.opf.clamodel_classifier_helper.CLAModelClassifierHelper object at 0x7f88aa41df10>
clamodel = <Mock spec='CLAModel' id='140224948722960'>, anomalyParams = {}
def __init__(self, clamodel, anomalyParams={}):
if anomalyParams is None:
anomalyParams = {}
self.clamodel = clamodel
self._version = CLAModelClassifierHelper.__VERSION__
self._classificationMaxDist = 0.1
if 'autoDetectWaitRecords' not in anomalyParams or \
anomalyParams['autoDetectWaitRecords'] is None:
self._autoDetectWaitRecords = int(Configuration.get(
> 'nupic.model.temporalAnomaly.wait_records'))
/usr/local/lib/python2.7/dist-packages/nupic/frameworks/opf/clamodel_classifier_helper.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
prop = 'nupic.model.temporalAnomaly.wait_records', default = None
@classmethod
def get(cls, prop, default=None):
""" Get the value of the given configuration property as string. This
returns a string which is the property value, or the value of "default" arg
if the property is not found. Use Configuration.getString() instead.
NOTE: it's atypical for our configuration properties to be missing - a
missing configuration property is usually a very serious error. Because
of this, it's preferable to use one of the getString, getInt, getFloat,
etc. variants instead of get(). Those variants will raise KeyError when
an expected property is missing.
Parameters:
----------------------------------------------------------------
prop: name of the property
default: default value to return if property does not exist
retval: property value (as a string), or default if the property does
not exist.
"""
try:
> return cls.getString(prop)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:162:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
prop = 'nupic.model.temporalAnomaly.wait_records'
@classmethod
def getString(cls, prop):
""" Retrieve the requested property as a string. If property does not exist,
then KeyError will be raised.
Parameters:
----------------------------------------------------------------
prop: name of the property
retval: property value as a string
"""
if cls._properties is None:
> cls._readStdConfigFiles()
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:81:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
@classmethod
def _readStdConfigFiles(cls):
""" Intercept the _readStdConfigFiles call from our base config class to
read in base and custom configuration settings.
"""
> super(Configuration, cls)._readStdConfigFiles()
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_custom.py:142:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
@classmethod
def _readStdConfigFiles(cls):
""" Read in all standard configuration files
"""
# Default one first
> cls.readConfigFile(DEFAULT_CONFIG)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:429:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
filename = 'nupic-default.xml', path = None
@classmethod
def readConfigFile(cls, filename, path=None):
""" Parse the given XML file and store all properties it describes.
Parameters:
----------------------------------------------------------------
filename: name of XML file to parse (no path)
path: path of the XML file. If None, then use the standard
configuration search path.
"""
> properties = cls._readConfigFile(filename, path)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:219:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
filename = 'nupic-default.xml', path = None
@classmethod
def _readConfigFile(cls, filename, path=None):
""" Parse the given XML file and return a dict describing the file.
Parameters:
----------------------------------------------------------------
filename: name of XML file to parse (no path)
path: path of the XML file. If None, then use the standard
configuration search path.
retval: returns a dict with each property as a key and a dict of all
the property's attributes as value
"""
outputProperties = dict()
# Get the path to the config files.
if path is None:
filePath = cls.findConfigFile(filename)
else:
filePath = os.path.join(path, filename)
# ------------------------------------------------------------------
# Read in the config file
try:
if filePath is not None:
try:
# Use warn since console log level is set to warning
_getLogger().debug("Loading config file: %s", filePath)
with open(filePath, 'rb') as inp:
contents = inp.read()
except Exception:
raise RuntimeError("Expected configuration file at %s" % filePath)
else:
# If the file was not found in the normal search paths, which includes
# checking the NTA_CONF_PATH, we'll try loading it from pkg_resources.
try:
contents = resource_string("nupic.support", filename)
except Exception as resourceException:
# We expect these to be read, and if they don't exist we'll just use
# an empty configuration string.
if filename in [USER_CONFIG, CUSTOM_CONFIG]:
contents = '<configuration/>'
else:
raise resourceException
elements = ElementTree.XML(contents)
if elements.tag != 'configuration':
raise RuntimeError("Expected top-level element to be 'configuration' "
"but got '%s'" % (elements.tag))
# ------------------------------------------------------------------
# Add in each property found
propertyElements = elements.findall('./property')
for propertyItem in propertyElements:
propInfo = dict()
# Parse this property element
propertyAttributes = list(propertyItem)
for propertyAttribute in propertyAttributes:
propInfo[propertyAttribute.tag] = propertyAttribute.text
# Get the name
name = propInfo.get('name', None)
# value is allowed to be empty string
if 'value' in propInfo and propInfo['value'] is None:
value = ''
else:
value = propInfo.get('value', None)
if value is None:
if 'novalue' in propInfo:
# Placeholder "novalue" properties are intended to be overridden
# via dynamic configuration or another configuration layer.
continue
else:
raise RuntimeError("Missing 'value' element within the property "
"element: => %s " % (str(propInfo)))
# The value is allowed to contain substitution tags of the form
# ${env.VARNAME}, which should be substituted with the corresponding
# environment variable values
restOfValue = value
value = ''
while True:
# Find the beginning of substitution tag
pos = restOfValue.find('${env.')
if pos == -1:
# No more environment variable substitutions
value += restOfValue
break
# Append prefix to value accumulator
value += restOfValue[0:pos]
# Find the end of current substitution tag
varTailPos = restOfValue.find('}', pos)
if varTailPos == -1:
raise RuntimeError("Trailing environment variable tag delimiter '}'"
" not found in %r" % (restOfValue))
# Extract environment variable name from tag
varname = restOfValue[pos+6:varTailPos]
if varname not in os.environ:
raise RuntimeError("Attempting to use the value of the environment"
> " variable %r, which is not defined" % (varname))
E RuntimeError: Attempting to use the value of the environment variable 'USER', which is not defined
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:339: RuntimeError
_________________ CLAClassifierHelperTest.testGetAnomalyVector _________________
self = <tests.unit.nupic.frameworks.opf.clamodel_classifier_helper_test.CLAClassifierHelperTest testMethod=testGetAnomalyVector>
def setUp(self):
> self.helper = CLAModelClassifierHelper(Mock(spec=CLAModel))
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/frameworks/opf/clamodel_classifier_helper_test.py:152:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <nupic.frameworks.opf.clamodel_classifier_helper.CLAModelClassifierHelper object at 0x7f88aa443890>
clamodel = <Mock spec='CLAModel' id='140224948878096'>, anomalyParams = {}
def __init__(self, clamodel, anomalyParams={}):
if anomalyParams is None:
anomalyParams = {}
self.clamodel = clamodel
self._version = CLAModelClassifierHelper.__VERSION__
self._classificationMaxDist = 0.1
if 'autoDetectWaitRecords' not in anomalyParams or \
anomalyParams['autoDetectWaitRecords'] is None:
self._autoDetectWaitRecords = int(Configuration.get(
> 'nupic.model.temporalAnomaly.wait_records'))
/usr/local/lib/python2.7/dist-packages/nupic/frameworks/opf/clamodel_classifier_helper.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
prop = 'nupic.model.temporalAnomaly.wait_records', default = None
@classmethod
def get(cls, prop, default=None):
""" Get the value of the given configuration property as string. This
returns a string which is the property value, or the value of "default" arg
if the property is not found. Use Configuration.getString() instead.
NOTE: it's atypical for our configuration properties to be missing - a
missing configuration property is usually a very serious error. Because
of this, it's preferable to use one of the getString, getInt, getFloat,
etc. variants instead of get(). Those variants will raise KeyError when
an expected property is missing.
Parameters:
----------------------------------------------------------------
prop: name of the property
default: default value to return if property does not exist
retval: property value (as a string), or default if the property does
not exist.
"""
try:
> return cls.getString(prop)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:162:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
prop = 'nupic.model.temporalAnomaly.wait_records'
@classmethod
def getString(cls, prop):
""" Retrieve the requested property as a string. If property does not exist,
then KeyError will be raised.
Parameters:
----------------------------------------------------------------
prop: name of the property
retval: property value as a string
"""
if cls._properties is None:
> cls._readStdConfigFiles()
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:81:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
@classmethod
def _readStdConfigFiles(cls):
""" Intercept the _readStdConfigFiles call from our base config class to
read in base and custom configuration settings.
"""
> super(Configuration, cls)._readStdConfigFiles()
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_custom.py:142:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
@classmethod
def _readStdConfigFiles(cls):
""" Read in all standard configuration files
"""
# Default one first
> cls.readConfigFile(DEFAULT_CONFIG)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:429:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
filename = 'nupic-default.xml', path = None
@classmethod
def readConfigFile(cls, filename, path=None):
""" Parse the given XML file and store all properties it describes.
Parameters:
----------------------------------------------------------------
filename: name of XML file to parse (no path)
path: path of the XML file. If None, then use the standard
configuration search path.
"""
> properties = cls._readConfigFile(filename, path)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:219:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
filename = 'nupic-default.xml', path = None
@classmethod
def _readConfigFile(cls, filename, path=None):
""" Parse the given XML file and return a dict describing the file.
Parameters:
----------------------------------------------------------------
filename: name of XML file to parse (no path)
path: path of the XML file. If None, then use the standard
configuration search path.
retval: returns a dict with each property as a key and a dict of all
the property's attributes as value
"""
outputProperties = dict()
# Get the path to the config files.
if path is None:
filePath = cls.findConfigFile(filename)
else:
filePath = os.path.join(path, filename)
# ------------------------------------------------------------------
# Read in the config file
try:
if filePath is not None:
try:
# Use warn since console log level is set to warning
_getLogger().debug("Loading config file: %s", filePath)
with open(filePath, 'rb') as inp:
contents = inp.read()
except Exception:
raise RuntimeError("Expected configuration file at %s" % filePath)
else:
# If the file was not found in the normal search paths, which includes
# checking the NTA_CONF_PATH, we'll try loading it from pkg_resources.
try:
contents = resource_string("nupic.support", filename)
except Exception as resourceException:
# We expect these to be read, and if they don't exist we'll just use
# an empty configuration string.
if filename in [USER_CONFIG, CUSTOM_CONFIG]:
contents = '<configuration/>'
else:
raise resourceException
elements = ElementTree.XML(contents)
if elements.tag != 'configuration':
raise RuntimeError("Expected top-level element to be 'configuration' "
"but got '%s'" % (elements.tag))
# ------------------------------------------------------------------
# Add in each property found
propertyElements = elements.findall('./property')
for propertyItem in propertyElements:
propInfo = dict()
# Parse this property element
propertyAttributes = list(propertyItem)
for propertyAttribute in propertyAttributes:
propInfo[propertyAttribute.tag] = propertyAttribute.text
# Get the name
name = propInfo.get('name', None)
# value is allowed to be empty string
if 'value' in propInfo and propInfo['value'] is None:
value = ''
else:
value = propInfo.get('value', None)
if value is None:
if 'novalue' in propInfo:
# Placeholder "novalue" properties are intended to be overridden
# via dynamic configuration or another configuration layer.
continue
else:
raise RuntimeError("Missing 'value' element within the property "
"element: => %s " % (str(propInfo)))
# The value is allowed to contain substitution tags of the form
# ${env.VARNAME}, which should be substituted with the corresponding
# environment variable values
restOfValue = value
value = ''
while True:
# Find the beginning of substitution tag
pos = restOfValue.find('${env.')
if pos == -1:
# No more environment variable substitutions
value += restOfValue
break
# Append prefix to value accumulator
value += restOfValue[0:pos]
# Find the end of current substitution tag
varTailPos = restOfValue.find('}', pos)
if varTailPos == -1:
raise RuntimeError("Trailing environment variable tag delimiter '}'"
" not found in %r" % (restOfValue))
# Extract environment variable name from tag
varname = restOfValue[pos+6:varTailPos]
if varname not in os.environ:
raise RuntimeError("Attempting to use the value of the environment"
> " variable %r, which is not defined" % (varname))
E RuntimeError: Attempting to use the value of the environment variable 'USER', which is not defined
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:339: RuntimeError
____________________ CLAClassifierHelperTest.testGetLabels _____________________
self = <tests.unit.nupic.frameworks.opf.clamodel_classifier_helper_test.CLAClassifierHelperTest testMethod=testGetLabels>
def setUp(self):
> self.helper = CLAModelClassifierHelper(Mock(spec=CLAModel))
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/frameworks/opf/clamodel_classifier_helper_test.py:152:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <nupic.frameworks.opf.clamodel_classifier_helper.CLAModelClassifierHelper object at 0x7f88aaceb490>
clamodel = <Mock spec='CLAModel' id='140224957952528'>, anomalyParams = {}
def __init__(self, clamodel, anomalyParams={}):
if anomalyParams is None:
anomalyParams = {}
self.clamodel = clamodel
self._version = CLAModelClassifierHelper.__VERSION__
self._classificationMaxDist = 0.1
if 'autoDetectWaitRecords' not in anomalyParams or \
anomalyParams['autoDetectWaitRecords'] is None:
self._autoDetectWaitRecords = int(Configuration.get(
> 'nupic.model.temporalAnomaly.wait_records'))
/usr/local/lib/python2.7/dist-packages/nupic/frameworks/opf/clamodel_classifier_helper.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
prop = 'nupic.model.temporalAnomaly.wait_records', default = None
@classmethod
def get(cls, prop, default=None):
""" Get the value of the given configuration property as string. This
returns a string which is the property value, or the value of "default" arg
if the property is not found. Use Configuration.getString() instead.
NOTE: it's atypical for our configuration properties to be missing - a
missing configuration property is usually a very serious error. Because
of this, it's preferable to use one of the getString, getInt, getFloat,
etc. variants instead of get(). Those variants will raise KeyError when
an expected property is missing.
Parameters:
----------------------------------------------------------------
prop: name of the property
default: default value to return if property does not exist
retval: property value (as a string), or default if the property does
not exist.
"""
try:
> return cls.getString(prop)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:162:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
prop = 'nupic.model.temporalAnomaly.wait_records'
@classmethod
def getString(cls, prop):
""" Retrieve the requested property as a string. If property does not exist,
then KeyError will be raised.
Parameters:
----------------------------------------------------------------
prop: name of the property
retval: property value as a string
"""
if cls._properties is None:
> cls._readStdConfigFiles()
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:81:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
@classmethod
def _readStdConfigFiles(cls):
""" Intercept the _readStdConfigFiles call from our base config class to
read in base and custom configuration settings.
"""
> super(Configuration, cls)._readStdConfigFiles()
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_custom.py:142:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
@classmethod
def _readStdConfigFiles(cls):
""" Read in all standard configuration files
"""
# Default one first
> cls.readConfigFile(DEFAULT_CONFIG)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:429:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
filename = 'nupic-default.xml', path = None
@classmethod
def readConfigFile(cls, filename, path=None):
""" Parse the given XML file and store all properties it describes.
Parameters:
----------------------------------------------------------------
filename: name of XML file to parse (no path)
path: path of the XML file. If None, then use the standard
configuration search path.
"""
> properties = cls._readConfigFile(filename, path)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:219:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
filename = 'nupic-default.xml', path = None
@classmethod
def _readConfigFile(cls, filename, path=None):
""" Parse the given XML file and return a dict describing the file.
Parameters:
----------------------------------------------------------------
filename: name of XML file to parse (no path)
path: path of the XML file. If None, then use the standard
configuration search path.
retval: returns a dict with each property as a key and a dict of all
the property's attributes as value
"""
outputProperties = dict()
# Get the path to the config files.
if path is None:
filePath = cls.findConfigFile(filename)
else:
filePath = os.path.join(path, filename)
# ------------------------------------------------------------------
# Read in the config file
try:
if filePath is not None:
try:
# Use warn since console log level is set to warning
_getLogger().debug("Loading config file: %s", filePath)
with open(filePath, 'rb') as inp:
contents = inp.read()
except Exception:
raise RuntimeError("Expected configuration file at %s" % filePath)
else:
# If the file was not found in the normal search paths, which includes
# checking the NTA_CONF_PATH, we'll try loading it from pkg_resources.
try:
contents = resource_string("nupic.support", filename)
except Exception as resourceException:
# We expect these to be read, and if they don't exist we'll just use
# an empty configuration string.
if filename in [USER_CONFIG, CUSTOM_CONFIG]:
contents = '<configuration/>'
else:
raise resourceException
elements = ElementTree.XML(contents)
if elements.tag != 'configuration':
raise RuntimeError("Expected top-level element to be 'configuration' "
"but got '%s'" % (elements.tag))
# ------------------------------------------------------------------
# Add in each property found
propertyElements = elements.findall('./property')
for propertyItem in propertyElements:
propInfo = dict()
# Parse this property element
propertyAttributes = list(propertyItem)
for propertyAttribute in propertyAttributes:
propInfo[propertyAttribute.tag] = propertyAttribute.text
# Get the name
name = propInfo.get('name', None)
# value is allowed to be empty string
if 'value' in propInfo and propInfo['value'] is None:
value = ''
else:
value = propInfo.get('value', None)
if value is None:
if 'novalue' in propInfo:
# Placeholder "novalue" properties are intended to be overridden
# via dynamic configuration or another configuration layer.
continue
else:
raise RuntimeError("Missing 'value' element within the property "
"element: => %s " % (str(propInfo)))
# The value is allowed to contain substitution tags of the form
# ${env.VARNAME}, which should be substituted with the corresponding
# environment variable values
restOfValue = value
value = ''
while True:
# Find the beginning of substitution tag
pos = restOfValue.find('${env.')
if pos == -1:
# No more environment variable substitutions
value += restOfValue
break
# Append prefix to value accumulator
value += restOfValue[0:pos]
# Find the end of current substitution tag
varTailPos = restOfValue.find('}', pos)
if varTailPos == -1:
raise RuntimeError("Trailing environment variable tag delimiter '}'"
" not found in %r" % (restOfValue))
# Extract environment variable name from tag
varname = restOfValue[pos+6:varTailPos]
if varname not in os.environ:
raise RuntimeError("Attempting to use the value of the environment"
> " variable %r, which is not defined" % (varname))
E RuntimeError: Attempting to use the value of the environment variable 'USER', which is not defined
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:339: RuntimeError
_______ tests.unit.nupic.frameworks.opf.clamodel_classifier_helper_test ________
self = <tests.unit.nupic.frameworks.opf.clamodel_classifier_helper_test.CLAClassifierHelperTest testMethod=testInit>
def setUp(self):
> self.helper = CLAModelClassifierHelper(Mock(spec=CLAModel))
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/frameworks/opf/clamodel_classifier_helper_test.py:152:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <nupic.frameworks.opf.clamodel_classifier_helper.CLAModelClassifierHelper object at 0x7f88aa1ab150>
clamodel = <Mock spec='CLAModel' id='140224946156048'>, anomalyParams = {}
def __init__(self, clamodel, anomalyParams={}):
if anomalyParams is None:
anomalyParams = {}
self.clamodel = clamodel
self._version = CLAModelClassifierHelper.__VERSION__
self._classificationMaxDist = 0.1
if 'autoDetectWaitRecords' not in anomalyParams or \
anomalyParams['autoDetectWaitRecords'] is None:
self._autoDetectWaitRecords = int(Configuration.get(
> 'nupic.model.temporalAnomaly.wait_records'))
/usr/local/lib/python2.7/dist-packages/nupic/frameworks/opf/clamodel_classifier_helper.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
prop = 'nupic.model.temporalAnomaly.wait_records', default = None
@classmethod
def get(cls, prop, default=None):
""" Get the value of the given configuration property as string. This
returns a string which is the property value, or the value of "default" arg
if the property is not found. Use Configuration.getString() instead.
NOTE: it's atypical for our configuration properties to be missing - a
missing configuration property is usually a very serious error. Because
of this, it's preferable to use one of the getString, getInt, getFloat,
etc. variants instead of get(). Those variants will raise KeyError when
an expected property is missing.
Parameters:
----------------------------------------------------------------
prop: name of the property
default: default value to return if property does not exist
retval: property value (as a string), or default if the property does
not exist.
"""
try:
> return cls.getString(prop)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:162:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
prop = 'nupic.model.temporalAnomaly.wait_records'
@classmethod
def getString(cls, prop):
""" Retrieve the requested property as a string. If property does not exist,
then KeyError will be raised.
Parameters:
----------------------------------------------------------------
prop: name of the property
retval: property value as a string
"""
if cls._properties is None:
> cls._readStdConfigFiles()
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:81:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
@classmethod
def _readStdConfigFiles(cls):
""" Intercept the _readStdConfigFiles call from our base config class to
read in base and custom configuration settings.
"""
> super(Configuration, cls)._readStdConfigFiles()
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_custom.py:142:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
@classmethod
def _readStdConfigFiles(cls):
""" Read in all standard configuration files
"""
# Default one first
> cls.readConfigFile(DEFAULT_CONFIG)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:429:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
filename = 'nupic-default.xml', path = None
@classmethod
def readConfigFile(cls, filename, path=None):
""" Parse the given XML file and store all properties it describes.
Parameters:
----------------------------------------------------------------
filename: name of XML file to parse (no path)
path: path of the XML file. If None, then use the standard
configuration search path.
"""
> properties = cls._readConfigFile(filename, path)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:219:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
filename = 'nupic-default.xml', path = None
@classmethod
def _readConfigFile(cls, filename, path=None):
""" Parse the given XML file and return a dict describing the file.
Parameters:
----------------------------------------------------------------
filename: name of XML file to parse (no path)
path: path of the XML file. If None, then use the standard
configuration search path.
retval: returns a dict with each property as a key and a dict of all
the property's attributes as value
"""
outputProperties = dict()
# Get the path to the config files.
if path is None:
filePath = cls.findConfigFile(filename)
else:
filePath = os.path.join(path, filename)
# ------------------------------------------------------------------
# Read in the config file
try:
if filePath is not None:
try:
# Use warn since console log level is set to warning
_getLogger().debug("Loading config file: %s", filePath)
with open(filePath, 'rb') as inp:
contents = inp.read()
except Exception:
raise RuntimeError("Expected configuration file at %s" % filePath)
else:
# If the file was not found in the normal search paths, which includes
# checking the NTA_CONF_PATH, we'll try loading it from pkg_resources.
try:
contents = resource_string("nupic.support", filename)
except Exception as resourceException:
# We expect these to be read, and if they don't exist we'll just use
# an empty configuration string.
if filename in [USER_CONFIG, CUSTOM_CONFIG]:
contents = '<configuration/>'
else:
raise resourceException
elements = ElementTree.XML(contents)
if elements.tag != 'configuration':
raise RuntimeError("Expected top-level element to be 'configuration' "
"but got '%s'" % (elements.tag))
# ------------------------------------------------------------------
# Add in each property found
propertyElements = elements.findall('./property')
for propertyItem in propertyElements:
propInfo = dict()
# Parse this property element
propertyAttributes = list(propertyItem)
for propertyAttribute in propertyAttributes:
propInfo[propertyAttribute.tag] = propertyAttribute.text
# Get the name
name = propInfo.get('name', None)
# value is allowed to be empty string
if 'value' in propInfo and propInfo['value'] is None:
value = ''
else:
value = propInfo.get('value', None)
if value is None:
if 'novalue' in propInfo:
# Placeholder "novalue" properties are intended to be overridden
# via dynamic configuration or another configuration layer.
continue
else:
raise RuntimeError("Missing 'value' element within the property "
"element: => %s " % (str(propInfo)))
# The value is allowed to contain substitution tags of the form
# ${env.VARNAME}, which should be substituted with the corresponding
# environment variable values
restOfValue = value
value = ''
while True:
# Find the beginning of substitution tag
pos = restOfValue.find('${env.')
if pos == -1:
# No more environment variable substitutions
value += restOfValue
break
# Append prefix to value accumulator
value += restOfValue[0:pos]
# Find the end of current substitution tag
varTailPos = restOfValue.find('}', pos)
if varTailPos == -1:
raise RuntimeError("Trailing environment variable tag delimiter '}'"
" not found in %r" % (restOfValue))
# Extract environment variable name from tag
varname = restOfValue[pos+6:varTailPos]
if varname not in os.environ:
raise RuntimeError("Attempting to use the value of the environment"
> " variable %r, which is not defined" % (varname))
E RuntimeError: Attempting to use the value of the environment variable 'USER', which is not defined
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:339: RuntimeError
_______ tests.unit.nupic.frameworks.opf.clamodel_classifier_helper_test ________
self = <tests.unit.nupic.frameworks.opf.clamodel_classifier_helper_test.CLAClassifierHelperTest testMethod=testRecomputeRecordFromKNN>
def setUp(self):
> self.helper = CLAModelClassifierHelper(Mock(spec=CLAModel))
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/frameworks/opf/clamodel_classifier_helper_test.py:152:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <nupic.frameworks.opf.clamodel_classifier_helper.CLAModelClassifierHelper object at 0x7f88ab2d9890>
clamodel = <Mock spec='CLAModel' id='140224946155920'>, anomalyParams = {}
def __init__(self, clamodel, anomalyParams={}):
if anomalyParams is None:
anomalyParams = {}
self.clamodel = clamodel
self._version = CLAModelClassifierHelper.__VERSION__
self._classificationMaxDist = 0.1
if 'autoDetectWaitRecords' not in anomalyParams or \
anomalyParams['autoDetectWaitRecords'] is None:
self._autoDetectWaitRecords = int(Configuration.get(
> 'nupic.model.temporalAnomaly.wait_records'))
/usr/local/lib/python2.7/dist-packages/nupic/frameworks/opf/clamodel_classifier_helper.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
prop = 'nupic.model.temporalAnomaly.wait_records', default = None
@classmethod
def get(cls, prop, default=None):
""" Get the value of the given configuration property as string. This
returns a string which is the property value, or the value of "default" arg
if the property is not found. Use Configuration.getString() instead.
NOTE: it's atypical for our configuration properties to be missing - a
missing configuration property is usually a very serious error. Because
of this, it's preferable to use one of the getString, getInt, getFloat,
etc. variants instead of get(). Those variants will raise KeyError when
an expected property is missing.
Parameters:
----------------------------------------------------------------
prop: name of the property
default: default value to return if property does not exist
retval: property value (as a string), or default if the property does
not exist.
"""
try:
> return cls.getString(prop)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:162:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
prop = 'nupic.model.temporalAnomaly.wait_records'
@classmethod
def getString(cls, prop):
""" Retrieve the requested property as a string. If property does not exist,
then KeyError will be raised.
Parameters:
----------------------------------------------------------------
prop: name of the property
retval: property value as a string
"""
if cls._properties is None:
> cls._readStdConfigFiles()
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:81:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
@classmethod
def _readStdConfigFiles(cls):
""" Intercept the _readStdConfigFiles call from our base config class to
read in base and custom configuration settings.
"""
> super(Configuration, cls)._readStdConfigFiles()
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_custom.py:142:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
@classmethod
def _readStdConfigFiles(cls):
""" Read in all standard configuration files
"""
# Default one first
> cls.readConfigFile(DEFAULT_CONFIG)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:429:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
filename = 'nupic-default.xml', path = None
@classmethod
def readConfigFile(cls, filename, path=None):
""" Parse the given XML file and store all properties it describes.
Parameters:
----------------------------------------------------------------
filename: name of XML file to parse (no path)
path: path of the XML file. If None, then use the standard
configuration search path.
"""
> properties = cls._readConfigFile(filename, path)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:219:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
filename = 'nupic-default.xml', path = None
@classmethod
def _readConfigFile(cls, filename, path=None):
""" Parse the given XML file and return a dict describing the file.
Parameters:
----------------------------------------------------------------
filename: name of XML file to parse (no path)
path: path of the XML file. If None, then use the standard
configuration search path.
retval: returns a dict with each property as a key and a dict of all
the property's attributes as value
"""
outputProperties = dict()
# Get the path to the config files.
if path is None:
filePath = cls.findConfigFile(filename)
else:
filePath = os.path.join(path, filename)
# ------------------------------------------------------------------
# Read in the config file
try:
if filePath is not None:
try:
# Use warn since console log level is set to warning
_getLogger().debug("Loading config file: %s", filePath)
with open(filePath, 'rb') as inp:
contents = inp.read()
except Exception:
raise RuntimeError("Expected configuration file at %s" % filePath)
else:
# If the file was not found in the normal search paths, which includes
# checking the NTA_CONF_PATH, we'll try loading it from pkg_resources.
try:
contents = resource_string("nupic.support", filename)
except Exception as resourceException:
# We expect these to be read, and if they don't exist we'll just use
# an empty configuration string.
if filename in [USER_CONFIG, CUSTOM_CONFIG]:
contents = '<configuration/>'
else:
raise resourceException
elements = ElementTree.XML(contents)
if elements.tag != 'configuration':
raise RuntimeError("Expected top-level element to be 'configuration' "
"but got '%s'" % (elements.tag))
# ------------------------------------------------------------------
# Add in each property found
propertyElements = elements.findall('./property')
for propertyItem in propertyElements:
propInfo = dict()
# Parse this property element
propertyAttributes = list(propertyItem)
for propertyAttribute in propertyAttributes:
propInfo[propertyAttribute.tag] = propertyAttribute.text
# Get the name
name = propInfo.get('name', None)
# value is allowed to be empty string
if 'value' in propInfo and propInfo['value'] is None:
value = ''
else:
value = propInfo.get('value', None)
if value is None:
if 'novalue' in propInfo:
# Placeholder "novalue" properties are intended to be overridden
# via dynamic configuration or another configuration layer.
continue
else:
raise RuntimeError("Missing 'value' element within the property "
"element: => %s " % (str(propInfo)))
# The value is allowed to contain substitution tags of the form
# ${env.VARNAME}, which should be substituted with the corresponding
# environment variable values
restOfValue = value
value = ''
while True:
# Find the beginning of substitution tag
pos = restOfValue.find('${env.')
if pos == -1:
# No more environment variable substitutions
value += restOfValue
break
# Append prefix to value accumulator
value += restOfValue[0:pos]
# Find the end of current substitution tag
varTailPos = restOfValue.find('}', pos)
if varTailPos == -1:
raise RuntimeError("Trailing environment variable tag delimiter '}'"
" not found in %r" % (restOfValue))
# Extract environment variable name from tag
varname = restOfValue[pos+6:varTailPos]
if varname not in os.environ:
raise RuntimeError("Attempting to use the value of the environment"
> " variable %r, which is not defined" % (varname))
E RuntimeError: Attempting to use the value of the environment variable 'USER', which is not defined
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:339: RuntimeError
_______ tests.unit.nupic.frameworks.opf.clamodel_classifier_helper_test ________
self = <tests.unit.nupic.frameworks.opf.clamodel_classifier_helper_test.CLAClassifierHelperTest testMethod=testRemoveLabel>
def setUp(self):
> self.helper = CLAModelClassifierHelper(Mock(spec=CLAModel))
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/frameworks/opf/clamodel_classifier_helper_test.py:152:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <nupic.frameworks.opf.clamodel_classifier_helper.CLAModelClassifierHelper object at 0x7f88a9c00690>
clamodel = <Mock spec='CLAModel' id='140224940213584'>, anomalyParams = {}
def __init__(self, clamodel, anomalyParams={}):
if anomalyParams is None:
anomalyParams = {}
self.clamodel = clamodel
self._version = CLAModelClassifierHelper.__VERSION__
self._classificationMaxDist = 0.1
if 'autoDetectWaitRecords' not in anomalyParams or \
anomalyParams['autoDetectWaitRecords'] is None:
self._autoDetectWaitRecords = int(Configuration.get(
> 'nupic.model.temporalAnomaly.wait_records'))
/usr/local/lib/python2.7/dist-packages/nupic/frameworks/opf/clamodel_classifier_helper.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
prop = 'nupic.model.temporalAnomaly.wait_records', default = None
@classmethod
def get(cls, prop, default=None):
""" Get the value of the given configuration property as string. This
returns a string which is the property value, or the value of "default" arg
if the property is not found. Use Configuration.getString() instead.
NOTE: it's atypical for our configuration properties to be missing - a
missing configuration property is usually a very serious error. Because
of this, it's preferable to use one of the getString, getInt, getFloat,
etc. variants instead of get(). Those variants will raise KeyError when
an expected property is missing.
Parameters:
----------------------------------------------------------------
prop: name of the property
default: default value to return if property does not exist
retval: property value (as a string), or default if the property does
not exist.
"""
try:
> return cls.getString(prop)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:162:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
prop = 'nupic.model.temporalAnomaly.wait_records'
@classmethod
def getString(cls, prop):
""" Retrieve the requested property as a string. If property does not exist,
then KeyError will be raised.
Parameters:
----------------------------------------------------------------
prop: name of the property
retval: property value as a string
"""
if cls._properties is None:
> cls._readStdConfigFiles()
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:81:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
@classmethod
def _readStdConfigFiles(cls):
""" Intercept the _readStdConfigFiles call from our base config class to
read in base and custom configuration settings.
"""
> super(Configuration, cls)._readStdConfigFiles()
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_custom.py:142:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
@classmethod
def _readStdConfigFiles(cls):
""" Read in all standard configuration files
"""
# Default one first
> cls.readConfigFile(DEFAULT_CONFIG)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:429:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
filename = 'nupic-default.xml', path = None
@classmethod
def readConfigFile(cls, filename, path=None):
""" Parse the given XML file and store all properties it describes.
Parameters:
----------------------------------------------------------------
filename: name of XML file to parse (no path)
path: path of the XML file. If None, then use the standard
configuration search path.
"""
> properties = cls._readConfigFile(filename, path)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:219:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
filename = 'nupic-default.xml', path = None
@classmethod
def _readConfigFile(cls, filename, path=None):
""" Parse the given XML file and return a dict describing the file.
Parameters:
----------------------------------------------------------------
filename: name of XML file to parse (no path)
path: path of the XML file. If None, then use the standard
configuration search path.
retval: returns a dict with each property as a key and a dict of all
the property's attributes as value
"""
outputProperties = dict()
# Get the path to the config files.
if path is None:
filePath = cls.findConfigFile(filename)
else:
filePath = os.path.join(path, filename)
# ------------------------------------------------------------------
# Read in the config file
try:
if filePath is not None:
try:
# Use warn since console log level is set to warning
_getLogger().debug("Loading config file: %s", filePath)
with open(filePath, 'rb') as inp:
contents = inp.read()
except Exception:
raise RuntimeError("Expected configuration file at %s" % filePath)
else:
# If the file was not found in the normal search paths, which includes
# checking the NTA_CONF_PATH, we'll try loading it from pkg_resources.
try:
contents = resource_string("nupic.support", filename)
except Exception as resourceException:
# We expect these to be read, and if they don't exist we'll just use
# an empty configuration string.
if filename in [USER_CONFIG, CUSTOM_CONFIG]:
contents = '<configuration/>'
else:
raise resourceException
elements = ElementTree.XML(contents)
if elements.tag != 'configuration':
raise RuntimeError("Expected top-level element to be 'configuration' "
"but got '%s'" % (elements.tag))
# ------------------------------------------------------------------
# Add in each property found
propertyElements = elements.findall('./property')
for propertyItem in propertyElements:
propInfo = dict()
# Parse this property element
propertyAttributes = list(propertyItem)
for propertyAttribute in propertyAttributes:
propInfo[propertyAttribute.tag] = propertyAttribute.text
# Get the name
name = propInfo.get('name', None)
# value is allowed to be empty string
if 'value' in propInfo and propInfo['value'] is None:
value = ''
else:
value = propInfo.get('value', None)
if value is None:
if 'novalue' in propInfo:
# Placeholder "novalue" properties are intended to be overridden
# via dynamic configuration or another configuration layer.
continue
else:
raise RuntimeError("Missing 'value' element within the property "
"element: => %s " % (str(propInfo)))
# The value is allowed to contain substitution tags of the form
# ${env.VARNAME}, which should be substituted with the corresponding
# environment variable values
restOfValue = value
value = ''
while True:
# Find the beginning of substitution tag
pos = restOfValue.find('${env.')
if pos == -1:
# No more environment variable substitutions
value += restOfValue
break
# Append prefix to value accumulator
value += restOfValue[0:pos]
# Find the end of current substitution tag
varTailPos = restOfValue.find('}', pos)
if varTailPos == -1:
raise RuntimeError("Trailing environment variable tag delimiter '}'"
" not found in %r" % (restOfValue))
# Extract environment variable name from tag
varname = restOfValue[pos+6:varTailPos]
if varname not in os.environ:
raise RuntimeError("Attempting to use the value of the environment"
> " variable %r, which is not defined" % (varname))
E RuntimeError: Attempting to use the value of the environment variable 'USER', which is not defined
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:339: RuntimeError
_______ tests.unit.nupic.frameworks.opf.clamodel_classifier_helper_test ________
self = <tests.unit.nupic.frameworks.opf.clamodel_classifier_helper_test.CLAClassifierHelperTest testMethod=testRemoveLabelNoFilter>
def setUp(self):
> self.helper = CLAModelClassifierHelper(Mock(spec=CLAModel))
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/frameworks/opf/clamodel_classifier_helper_test.py:152:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <nupic.frameworks.opf.clamodel_classifier_helper.CLAModelClassifierHelper object at 0x7f88aa422110>
clamodel = <Mock spec='CLAModel' id='140224948740240'>, anomalyParams = {}
def __init__(self, clamodel, anomalyParams={}):
if anomalyParams is None:
anomalyParams = {}
self.clamodel = clamodel
self._version = CLAModelClassifierHelper.__VERSION__
self._classificationMaxDist = 0.1
if 'autoDetectWaitRecords' not in anomalyParams or \
anomalyParams['autoDetectWaitRecords'] is None:
self._autoDetectWaitRecords = int(Configuration.get(
> 'nupic.model.temporalAnomaly.wait_records'))
/usr/local/lib/python2.7/dist-packages/nupic/frameworks/opf/clamodel_classifier_helper.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
prop = 'nupic.model.temporalAnomaly.wait_records', default = None
@classmethod
def get(cls, prop, default=None):
""" Get the value of the given configuration property as string. This
returns a string which is the property value, or the value of "default" arg
if the property is not found. Use Configuration.getString() instead.
NOTE: it's atypical for our configuration properties to be missing - a
missing configuration property is usually a very serious error. Because
of this, it's preferable to use one of the getString, getInt, getFloat,
etc. variants instead of get(). Those variants will raise KeyError when
an expected property is missing.
Parameters:
----------------------------------------------------------------
prop: name of the property
default: default value to return if property does not exist
retval: property value (as a string), or default if the property does
not exist.
"""
try:
> return cls.getString(prop)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:162:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
prop = 'nupic.model.temporalAnomaly.wait_records'
@classmethod
def getString(cls, prop):
""" Retrieve the requested property as a string. If property does not exist,
then KeyError will be raised.
Parameters:
----------------------------------------------------------------
prop: name of the property
retval: property value as a string
"""
if cls._properties is None:
> cls._readStdConfigFiles()
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:81:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
@classmethod
def _readStdConfigFiles(cls):
""" Intercept the _readStdConfigFiles call from our base config class to
read in base and custom configuration settings.
"""
> super(Configuration, cls)._readStdConfigFiles()
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_custom.py:142:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
@classmethod
def _readStdConfigFiles(cls):
""" Read in all standard configuration files
"""
# Default one first
> cls.readConfigFile(DEFAULT_CONFIG)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:429:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
filename = 'nupic-default.xml', path = None
@classmethod
def readConfigFile(cls, filename, path=None):
""" Parse the given XML file and store all properties it describes.
Parameters:
----------------------------------------------------------------
filename: name of XML file to parse (no path)
path: path of the XML file. If None, then use the standard
configuration search path.
"""
> properties = cls._readConfigFile(filename, path)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:219:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
filename = 'nupic-default.xml', path = None
@classmethod
def _readConfigFile(cls, filename, path=None):
""" Parse the given XML file and return a dict describing the file.
Parameters:
----------------------------------------------------------------
filename: name of XML file to parse (no path)
path: path of the XML file. If None, then use the standard
configuration search path.
retval: returns a dict with each property as a key and a dict of all
the property's attributes as value
"""
outputProperties = dict()
# Get the path to the config files.
if path is None:
filePath = cls.findConfigFile(filename)
else:
filePath = os.path.join(path, filename)
# ------------------------------------------------------------------
# Read in the config file
try:
if filePath is not None:
try:
# Use warn since console log level is set to warning
_getLogger().debug("Loading config file: %s", filePath)
with open(filePath, 'rb') as inp:
contents = inp.read()
except Exception:
raise RuntimeError("Expected configuration file at %s" % filePath)
else:
# If the file was not found in the normal search paths, which includes
# checking the NTA_CONF_PATH, we'll try loading it from pkg_resources.
try:
contents = resource_string("nupic.support", filename)
except Exception as resourceException:
# We expect these to be read, and if they don't exist we'll just use
# an empty configuration string.
if filename in [USER_CONFIG, CUSTOM_CONFIG]:
contents = '<configuration/>'
else:
raise resourceException
elements = ElementTree.XML(contents)
if elements.tag != 'configuration':
raise RuntimeError("Expected top-level element to be 'configuration' "
"but got '%s'" % (elements.tag))
# ------------------------------------------------------------------
# Add in each property found
propertyElements = elements.findall('./property')
for propertyItem in propertyElements:
propInfo = dict()
# Parse this property element
propertyAttributes = list(propertyItem)
for propertyAttribute in propertyAttributes:
propInfo[propertyAttribute.tag] = propertyAttribute.text
# Get the name
name = propInfo.get('name', None)
# value is allowed to be empty string
if 'value' in propInfo and propInfo['value'] is None:
value = ''
else:
value = propInfo.get('value', None)
if value is None:
if 'novalue' in propInfo:
# Placeholder "novalue" properties are intended to be overridden
# via dynamic configuration or another configuration layer.
continue
else:
raise RuntimeError("Missing 'value' element within the property "
"element: => %s " % (str(propInfo)))
# The value is allowed to contain substitution tags of the form
# ${env.VARNAME}, which should be substituted with the corresponding
# environment variable values
restOfValue = value
value = ''
while True:
# Find the beginning of substitution tag
pos = restOfValue.find('${env.')
if pos == -1:
# No more environment variable substitutions
value += restOfValue
break
# Append prefix to value accumulator
value += restOfValue[0:pos]
# Find the end of current substitution tag
varTailPos = restOfValue.find('}', pos)
if varTailPos == -1:
raise RuntimeError("Trailing environment variable tag delimiter '}'"
" not found in %r" % (restOfValue))
# Extract environment variable name from tag
varname = restOfValue[pos+6:varTailPos]
if varname not in os.environ:
raise RuntimeError("Attempting to use the value of the environment"
> " variable %r, which is not defined" % (varname))
E RuntimeError: Attempting to use the value of the environment variable 'USER', which is not defined
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:339: RuntimeError
_______ tests.unit.nupic.frameworks.opf.clamodel_classifier_helper_test ________
self = <tests.unit.nupic.frameworks.opf.clamodel_classifier_helper_test.CLAClassifierHelperTest testMethod=testRun>
def setUp(self):
> self.helper = CLAModelClassifierHelper(Mock(spec=CLAModel))
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/frameworks/opf/clamodel_classifier_helper_test.py:152:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <nupic.frameworks.opf.clamodel_classifier_helper.CLAModelClassifierHelper object at 0x7f88a9c31290>
clamodel = <Mock spec='CLAModel' id='140224940413776'>, anomalyParams = {}
def __init__(self, clamodel, anomalyParams={}):
if anomalyParams is None:
anomalyParams = {}
self.clamodel = clamodel
self._version = CLAModelClassifierHelper.__VERSION__
self._classificationMaxDist = 0.1
if 'autoDetectWaitRecords' not in anomalyParams or \
anomalyParams['autoDetectWaitRecords'] is None:
self._autoDetectWaitRecords = int(Configuration.get(
> 'nupic.model.temporalAnomaly.wait_records'))
/usr/local/lib/python2.7/dist-packages/nupic/frameworks/opf/clamodel_classifier_helper.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
prop = 'nupic.model.temporalAnomaly.wait_records', default = None
@classmethod
def get(cls, prop, default=None):
""" Get the value of the given configuration property as string. This
returns a string which is the property value, or the value of "default" arg
if the property is not found. Use Configuration.getString() instead.
NOTE: it's atypical for our configuration properties to be missing - a
missing configuration property is usually a very serious error. Because
of this, it's preferable to use one of the getString, getInt, getFloat,
etc. variants instead of get(). Those variants will raise KeyError when
an expected property is missing.
Parameters:
----------------------------------------------------------------
prop: name of the property
default: default value to return if property does not exist
retval: property value (as a string), or default if the property does
not exist.
"""
try:
> return cls.getString(prop)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:162:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
prop = 'nupic.model.temporalAnomaly.wait_records'
@classmethod
def getString(cls, prop):
""" Retrieve the requested property as a string. If property does not exist,
then KeyError will be raised.
Parameters:
----------------------------------------------------------------
prop: name of the property
retval: property value as a string
"""
if cls._properties is None:
> cls._readStdConfigFiles()
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:81:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
@classmethod
def _readStdConfigFiles(cls):
""" Intercept the _readStdConfigFiles call from our base config class to
read in base and custom configuration settings.
"""
> super(Configuration, cls)._readStdConfigFiles()
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_custom.py:142:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
@classmethod
def _readStdConfigFiles(cls):
""" Read in all standard configuration files
"""
# Default one first
> cls.readConfigFile(DEFAULT_CONFIG)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:429:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
filename = 'nupic-default.xml', path = None
@classmethod
def readConfigFile(cls, filename, path=None):
""" Parse the given XML file and store all properties it describes.
Parameters:
----------------------------------------------------------------
filename: name of XML file to parse (no path)
path: path of the XML file. If None, then use the standard
configuration search path.
"""
> properties = cls._readConfigFile(filename, path)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:219:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
filename = 'nupic-default.xml', path = None
@classmethod
def _readConfigFile(cls, filename, path=None):
""" Parse the given XML file and return a dict describing the file.
Parameters:
----------------------------------------------------------------
filename: name of XML file to parse (no path)
path: path of the XML file. If None, then use the standard
configuration search path.
retval: returns a dict with each property as a key and a dict of all
the property's attributes as value
"""
outputProperties = dict()
# Get the path to the config files.
if path is None:
filePath = cls.findConfigFile(filename)
else:
filePath = os.path.join(path, filename)
# ------------------------------------------------------------------
# Read in the config file
try:
if filePath is not None:
try:
# Use warn since console log level is set to warning
_getLogger().debug("Loading config file: %s", filePath)
with open(filePath, 'rb') as inp:
contents = inp.read()
except Exception:
raise RuntimeError("Expected configuration file at %s" % filePath)
else:
# If the file was not found in the normal search paths, which includes
# checking the NTA_CONF_PATH, we'll try loading it from pkg_resources.
try:
contents = resource_string("nupic.support", filename)
except Exception as resourceException:
# We expect these to be read, and if they don't exist we'll just use
# an empty configuration string.
if filename in [USER_CONFIG, CUSTOM_CONFIG]:
contents = '<configuration/>'
else:
raise resourceException
elements = ElementTree.XML(contents)
if elements.tag != 'configuration':
raise RuntimeError("Expected top-level element to be 'configuration' "
"but got '%s'" % (elements.tag))
# ------------------------------------------------------------------
# Add in each property found
propertyElements = elements.findall('./property')
for propertyItem in propertyElements:
propInfo = dict()
# Parse this property element
propertyAttributes = list(propertyItem)
for propertyAttribute in propertyAttributes:
propInfo[propertyAttribute.tag] = propertyAttribute.text
# Get the name
name = propInfo.get('name', None)
# value is allowed to be empty string
if 'value' in propInfo and propInfo['value'] is None:
value = ''
else:
value = propInfo.get('value', None)
if value is None:
if 'novalue' in propInfo:
# Placeholder "novalue" properties are intended to be overridden
# via dynamic configuration or another configuration layer.
continue
else:
raise RuntimeError("Missing 'value' element within the property "
"element: => %s " % (str(propInfo)))
# The value is allowed to contain substitution tags of the form
# ${env.VARNAME}, which should be substituted with the corresponding
# environment variable values
restOfValue = value
value = ''
while True:
# Find the beginning of substitution tag
pos = restOfValue.find('${env.')
if pos == -1:
# No more environment variable substitutions
value += restOfValue
break
# Append prefix to value accumulator
value += restOfValue[0:pos]
# Find the end of current substitution tag
varTailPos = restOfValue.find('}', pos)
if varTailPos == -1:
raise RuntimeError("Trailing environment variable tag delimiter '}'"
" not found in %r" % (restOfValue))
# Extract environment variable name from tag
varname = restOfValue[pos+6:varTailPos]
if varname not in os.environ:
raise RuntimeError("Attempting to use the value of the environment"
> " variable %r, which is not defined" % (varname))
E RuntimeError: Attempting to use the value of the environment variable 'USER', which is not defined
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:339: RuntimeError
_______ tests.unit.nupic.frameworks.opf.clamodel_classifier_helper_test ________
self = <tests.unit.nupic.frameworks.opf.clamodel_classifier_helper_test.CLAClassifierHelperTest testMethod=testSetGetThreshold>
def setUp(self):
> self.helper = CLAModelClassifierHelper(Mock(spec=CLAModel))
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/frameworks/opf/clamodel_classifier_helper_test.py:152:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <nupic.frameworks.opf.clamodel_classifier_helper.CLAModelClassifierHelper object at 0x7f88aa04d6d0>
clamodel = <Mock spec='CLAModel' id='140224944724304'>, anomalyParams = {}
def __init__(self, clamodel, anomalyParams={}):
if anomalyParams is None:
anomalyParams = {}
self.clamodel = clamodel
self._version = CLAModelClassifierHelper.__VERSION__
self._classificationMaxDist = 0.1
if 'autoDetectWaitRecords' not in anomalyParams or \
anomalyParams['autoDetectWaitRecords'] is None:
self._autoDetectWaitRecords = int(Configuration.get(
> 'nupic.model.temporalAnomaly.wait_records'))
/usr/local/lib/python2.7/dist-packages/nupic/frameworks/opf/clamodel_classifier_helper.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
prop = 'nupic.model.temporalAnomaly.wait_records', default = None
@classmethod
def get(cls, prop, default=None):
""" Get the value of the given configuration property as string. This
returns a string which is the property value, or the value of "default" arg
if the property is not found. Use Configuration.getString() instead.
NOTE: it's atypical for our configuration properties to be missing - a
missing configuration property is usually a very serious error. Because
of this, it's preferable to use one of the getString, getInt, getFloat,
etc. variants instead of get(). Those variants will raise KeyError when
an expected property is missing.
Parameters:
----------------------------------------------------------------
prop: name of the property
default: default value to return if property does not exist
retval: property value (as a string), or default if the property does
not exist.
"""
try:
> return cls.getString(prop)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:162:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
prop = 'nupic.model.temporalAnomaly.wait_records'
@classmethod
def getString(cls, prop):
""" Retrieve the requested property as a string. If property does not exist,
then KeyError will be raised.
Parameters:
----------------------------------------------------------------
prop: name of the property
retval: property value as a string
"""
if cls._properties is None:
> cls._readStdConfigFiles()
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:81:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
@classmethod
def _readStdConfigFiles(cls):
""" Intercept the _readStdConfigFiles call from our base config class to
read in base and custom configuration settings.
"""
> super(Configuration, cls)._readStdConfigFiles()
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_custom.py:142:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
@classmethod
def _readStdConfigFiles(cls):
""" Read in all standard configuration files
"""
# Default one first
> cls.readConfigFile(DEFAULT_CONFIG)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:429:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
filename = 'nupic-default.xml', path = None
@classmethod
def readConfigFile(cls, filename, path=None):
""" Parse the given XML file and store all properties it describes.
Parameters:
----------------------------------------------------------------
filename: name of XML file to parse (no path)
path: path of the XML file. If None, then use the standard
configuration search path.
"""
> properties = cls._readConfigFile(filename, path)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:219:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
filename = 'nupic-default.xml', path = None
@classmethod
def _readConfigFile(cls, filename, path=None):
""" Parse the given XML file and return a dict describing the file.
Parameters:
----------------------------------------------------------------
filename: name of XML file to parse (no path)
path: path of the XML file. If None, then use the standard
configuration search path.
retval: returns a dict with each property as a key and a dict of all
the property's attributes as value
"""
outputProperties = dict()
# Get the path to the config files.
if path is None:
filePath = cls.findConfigFile(filename)
else:
filePath = os.path.join(path, filename)
# ------------------------------------------------------------------
# Read in the config file
try:
if filePath is not None:
try:
# Use warn since console log level is set to warning
_getLogger().debug("Loading config file: %s", filePath)
with open(filePath, 'rb') as inp:
contents = inp.read()
except Exception:
raise RuntimeError("Expected configuration file at %s" % filePath)
else:
# If the file was not found in the normal search paths, which includes
# checking the NTA_CONF_PATH, we'll try loading it from pkg_resources.
try:
contents = resource_string("nupic.support", filename)
except Exception as resourceException:
# We expect these to be read, and if they don't exist we'll just use
# an empty configuration string.
if filename in [USER_CONFIG, CUSTOM_CONFIG]:
contents = '<configuration/>'
else:
raise resourceException
elements = ElementTree.XML(contents)
if elements.tag != 'configuration':
raise RuntimeError("Expected top-level element to be 'configuration' "
"but got '%s'" % (elements.tag))
# ------------------------------------------------------------------
# Add in each property found
propertyElements = elements.findall('./property')
for propertyItem in propertyElements:
propInfo = dict()
# Parse this property element
propertyAttributes = list(propertyItem)
for propertyAttribute in propertyAttributes:
propInfo[propertyAttribute.tag] = propertyAttribute.text
# Get the name
name = propInfo.get('name', None)
# value is allowed to be empty string
if 'value' in propInfo and propInfo['value'] is None:
value = ''
else:
value = propInfo.get('value', None)
if value is None:
if 'novalue' in propInfo:
# Placeholder "novalue" properties are intended to be overridden
# via dynamic configuration or another configuration layer.
continue
else:
raise RuntimeError("Missing 'value' element within the property "
"element: => %s " % (str(propInfo)))
# The value is allowed to contain substitution tags of the form
# ${env.VARNAME}, which should be substituted with the corresponding
# environment variable values
restOfValue = value
value = ''
while True:
# Find the beginning of substitution tag
pos = restOfValue.find('${env.')
if pos == -1:
# No more environment variable substitutions
value += restOfValue
break
# Append prefix to value accumulator
value += restOfValue[0:pos]
# Find the end of current substitution tag
varTailPos = restOfValue.find('}', pos)
if varTailPos == -1:
raise RuntimeError("Trailing environment variable tag delimiter '}'"
" not found in %r" % (restOfValue))
# Extract environment variable name from tag
varname = restOfValue[pos+6:varTailPos]
if varname not in os.environ:
raise RuntimeError("Attempting to use the value of the environment"
> " variable %r, which is not defined" % (varname))
E RuntimeError: Attempting to use the value of the environment variable 'USER', which is not defined
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:339: RuntimeError
_______ tests.unit.nupic.frameworks.opf.clamodel_classifier_helper_test ________
self = <tests.unit.nupic.frameworks.opf.clamodel_classifier_helper_test.CLAClassifierHelperTest testMethod=testSetGetWaitRecords>
def setUp(self):
> self.helper = CLAModelClassifierHelper(Mock(spec=CLAModel))
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/frameworks/opf/clamodel_classifier_helper_test.py:152:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <nupic.frameworks.opf.clamodel_classifier_helper.CLAModelClassifierHelper object at 0x7f88ab2d9910>
clamodel = <Mock spec='CLAModel' id='140224944722000'>, anomalyParams = {}
def __init__(self, clamodel, anomalyParams={}):
if anomalyParams is None:
anomalyParams = {}
self.clamodel = clamodel
self._version = CLAModelClassifierHelper.__VERSION__
self._classificationMaxDist = 0.1
if 'autoDetectWaitRecords' not in anomalyParams or \
anomalyParams['autoDetectWaitRecords'] is None:
self._autoDetectWaitRecords = int(Configuration.get(
> 'nupic.model.temporalAnomaly.wait_records'))
/usr/local/lib/python2.7/dist-packages/nupic/frameworks/opf/clamodel_classifier_helper.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
prop = 'nupic.model.temporalAnomaly.wait_records', default = None
@classmethod
def get(cls, prop, default=None):
""" Get the value of the given configuration property as string. This
returns a string which is the property value, or the value of "default" arg
if the property is not found. Use Configuration.getString() instead.
NOTE: it's atypical for our configuration properties to be missing - a
missing configuration property is usually a very serious error. Because
of this, it's preferable to use one of the getString, getInt, getFloat,
etc. variants instead of get(). Those variants will raise KeyError when
an expected property is missing.
Parameters:
----------------------------------------------------------------
prop: name of the property
default: default value to return if property does not exist
retval: property value (as a string), or default if the property does
not exist.
"""
try:
> return cls.getString(prop)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:162:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
prop = 'nupic.model.temporalAnomaly.wait_records'
@classmethod
def getString(cls, prop):
""" Retrieve the requested property as a string. If property does not exist,
then KeyError will be raised.
Parameters:
----------------------------------------------------------------
prop: name of the property
retval: property value as a string
"""
if cls._properties is None:
> cls._readStdConfigFiles()
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:81:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
@classmethod
def _readStdConfigFiles(cls):
""" Intercept the _readStdConfigFiles call from our base config class to
read in base and custom configuration settings.
"""
> super(Configuration, cls)._readStdConfigFiles()
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_custom.py:142:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
@classmethod
def _readStdConfigFiles(cls):
""" Read in all standard configuration files
"""
# Default one first
> cls.readConfigFile(DEFAULT_CONFIG)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:429:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
filename = 'nupic-default.xml', path = None
@classmethod
def readConfigFile(cls, filename, path=None):
""" Parse the given XML file and store all properties it describes.
Parameters:
----------------------------------------------------------------
filename: name of XML file to parse (no path)
path: path of the XML file. If None, then use the standard
configuration search path.
"""
> properties = cls._readConfigFile(filename, path)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:219:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
filename = 'nupic-default.xml', path = None
@classmethod
def _readConfigFile(cls, filename, path=None):
""" Parse the given XML file and return a dict describing the file.
Parameters:
----------------------------------------------------------------
filename: name of XML file to parse (no path)
path: path of the XML file. If None, then use the standard
configuration search path.
retval: returns a dict with each property as a key and a dict of all
the property's attributes as value
"""
outputProperties = dict()
# Get the path to the config files.
if path is None:
filePath = cls.findConfigFile(filename)
else:
filePath = os.path.join(path, filename)
# ------------------------------------------------------------------
# Read in the config file
try:
if filePath is not None:
try:
# Use warn since console log level is set to warning
_getLogger().debug("Loading config file: %s", filePath)
with open(filePath, 'rb') as inp:
contents = inp.read()
except Exception:
raise RuntimeError("Expected configuration file at %s" % filePath)
else:
# If the file was not found in the normal search paths, which includes
# checking the NTA_CONF_PATH, we'll try loading it from pkg_resources.
try:
contents = resource_string("nupic.support", filename)
except Exception as resourceException:
# We expect these to be read, and if they don't exist we'll just use
# an empty configuration string.
if filename in [USER_CONFIG, CUSTOM_CONFIG]:
contents = '<configuration/>'
else:
raise resourceException
elements = ElementTree.XML(contents)
if elements.tag != 'configuration':
raise RuntimeError("Expected top-level element to be 'configuration' "
"but got '%s'" % (elements.tag))
# ------------------------------------------------------------------
# Add in each property found
propertyElements = elements.findall('./property')
for propertyItem in propertyElements:
propInfo = dict()
# Parse this property element
propertyAttributes = list(propertyItem)
for propertyAttribute in propertyAttributes:
propInfo[propertyAttribute.tag] = propertyAttribute.text
# Get the name
name = propInfo.get('name', None)
# value is allowed to be empty string
if 'value' in propInfo and propInfo['value'] is None:
value = ''
else:
value = propInfo.get('value', None)
if value is None:
if 'novalue' in propInfo:
# Placeholder "novalue" properties are intended to be overridden
# via dynamic configuration or another configuration layer.
continue
else:
raise RuntimeError("Missing 'value' element within the property "
"element: => %s " % (str(propInfo)))
# The value is allowed to contain substitution tags of the form
# ${env.VARNAME}, which should be substituted with the corresponding
# environment variable values
restOfValue = value
value = ''
while True:
# Find the beginning of substitution tag
pos = restOfValue.find('${env.')
if pos == -1:
# No more environment variable substitutions
value += restOfValue
break
# Append prefix to value accumulator
value += restOfValue[0:pos]
# Find the end of current substitution tag
varTailPos = restOfValue.find('}', pos)
if varTailPos == -1:
raise RuntimeError("Trailing environment variable tag delimiter '}'"
" not found in %r" % (restOfValue))
# Extract environment variable name from tag
varname = restOfValue[pos+6:varTailPos]
if varname not in os.environ:
raise RuntimeError("Attempting to use the value of the environment"
> " variable %r, which is not defined" % (varname))
E RuntimeError: Attempting to use the value of the environment variable 'USER', which is not defined
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:339: RuntimeError
_______ tests.unit.nupic.frameworks.opf.clamodel_classifier_helper_test ________
self = <tests.unit.nupic.frameworks.opf.clamodel_classifier_helper_test.CLAClassifierHelperTest testMethod=testSetState>
def setUp(self):
> self.helper = CLAModelClassifierHelper(Mock(spec=CLAModel))
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/frameworks/opf/clamodel_classifier_helper_test.py:152:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <nupic.frameworks.opf.clamodel_classifier_helper.CLAModelClassifierHelper object at 0x7f88ab22ddd0>
clamodel = <Mock spec='CLAModel' id='140224963467920'>, anomalyParams = {}
def __init__(self, clamodel, anomalyParams={}):
if anomalyParams is None:
anomalyParams = {}
self.clamodel = clamodel
self._version = CLAModelClassifierHelper.__VERSION__
self._classificationMaxDist = 0.1
if 'autoDetectWaitRecords' not in anomalyParams or \
anomalyParams['autoDetectWaitRecords'] is None:
self._autoDetectWaitRecords = int(Configuration.get(
> 'nupic.model.temporalAnomaly.wait_records'))
/usr/local/lib/python2.7/dist-packages/nupic/frameworks/opf/clamodel_classifier_helper.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
prop = 'nupic.model.temporalAnomaly.wait_records', default = None
@classmethod
def get(cls, prop, default=None):
""" Get the value of the given configuration property as string. This
returns a string which is the property value, or the value of "default" arg
if the property is not found. Use Configuration.getString() instead.
NOTE: it's atypical for our configuration properties to be missing - a
missing configuration property is usually a very serious error. Because
of this, it's preferable to use one of the getString, getInt, getFloat,
etc. variants instead of get(). Those variants will raise KeyError when
an expected property is missing.
Parameters:
----------------------------------------------------------------
prop: name of the property
default: default value to return if property does not exist
retval: property value (as a string), or default if the property does
not exist.
"""
try:
> return cls.getString(prop)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:162:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
prop = 'nupic.model.temporalAnomaly.wait_records'
@classmethod
def getString(cls, prop):
""" Retrieve the requested property as a string. If property does not exist,
then KeyError will be raised.
Parameters:
----------------------------------------------------------------
prop: name of the property
retval: property value as a string
"""
if cls._properties is None:
> cls._readStdConfigFiles()
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:81:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
@classmethod
def _readStdConfigFiles(cls):
""" Intercept the _readStdConfigFiles call from our base config class to
read in base and custom configuration settings.
"""
> super(Configuration, cls)._readStdConfigFiles()
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_custom.py:142:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
@classmethod
def _readStdConfigFiles(cls):
""" Read in all standard configuration files
"""
# Default one first
> cls.readConfigFile(DEFAULT_CONFIG)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:429:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
filename = 'nupic-default.xml', path = None
@classmethod
def readConfigFile(cls, filename, path=None):
""" Parse the given XML file and store all properties it describes.
Parameters:
----------------------------------------------------------------
filename: name of XML file to parse (no path)
path: path of the XML file. If None, then use the standard
configuration search path.
"""
> properties = cls._readConfigFile(filename, path)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:219:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
filename = 'nupic-default.xml', path = None
@classmethod
def _readConfigFile(cls, filename, path=None):
""" Parse the given XML file and return a dict describing the file.
Parameters:
----------------------------------------------------------------
filename: name of XML file to parse (no path)
path: path of the XML file. If None, then use the standard
configuration search path.
retval: returns a dict with each property as a key and a dict of all
the property's attributes as value
"""
outputProperties = dict()
# Get the path to the config files.
if path is None:
filePath = cls.findConfigFile(filename)
else:
filePath = os.path.join(path, filename)
# ------------------------------------------------------------------
# Read in the config file
try:
if filePath is not None:
try:
# Use warn since console log level is set to warning
_getLogger().debug("Loading config file: %s", filePath)
with open(filePath, 'rb') as inp:
contents = inp.read()
except Exception:
raise RuntimeError("Expected configuration file at %s" % filePath)
else:
# If the file was not found in the normal search paths, which includes
# checking the NTA_CONF_PATH, we'll try loading it from pkg_resources.
try:
contents = resource_string("nupic.support", filename)
except Exception as resourceException:
# We expect these to be read, and if they don't exist we'll just use
# an empty configuration string.
if filename in [USER_CONFIG, CUSTOM_CONFIG]:
contents = '<configuration/>'
else:
raise resourceException
elements = ElementTree.XML(contents)
if elements.tag != 'configuration':
raise RuntimeError("Expected top-level element to be 'configuration' "
"but got '%s'" % (elements.tag))
# ------------------------------------------------------------------
# Add in each property found
propertyElements = elements.findall('./property')
for propertyItem in propertyElements:
propInfo = dict()
# Parse this property element
propertyAttributes = list(propertyItem)
for propertyAttribute in propertyAttributes:
propInfo[propertyAttribute.tag] = propertyAttribute.text
# Get the name
name = propInfo.get('name', None)
# value is allowed to be empty string
if 'value' in propInfo and propInfo['value'] is None:
value = ''
else:
value = propInfo.get('value', None)
if value is None:
if 'novalue' in propInfo:
# Placeholder "novalue" properties are intended to be overridden
# via dynamic configuration or another configuration layer.
continue
else:
raise RuntimeError("Missing 'value' element within the property "
"element: => %s " % (str(propInfo)))
# The value is allowed to contain substitution tags of the form
# ${env.VARNAME}, which should be substituted with the corresponding
# environment variable values
restOfValue = value
value = ''
while True:
# Find the beginning of substitution tag
pos = restOfValue.find('${env.')
if pos == -1:
# No more environment variable substitutions
value += restOfValue
break
# Append prefix to value accumulator
value += restOfValue[0:pos]
# Find the end of current substitution tag
varTailPos = restOfValue.find('}', pos)
if varTailPos == -1:
raise RuntimeError("Trailing environment variable tag delimiter '}'"
" not found in %r" % (restOfValue))
# Extract environment variable name from tag
varname = restOfValue[pos+6:varTailPos]
if varname not in os.environ:
raise RuntimeError("Attempting to use the value of the environment"
> " variable %r, which is not defined" % (varname))
E RuntimeError: Attempting to use the value of the environment variable 'USER', which is not defined
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:339: RuntimeError
_______ tests.unit.nupic.frameworks.opf.clamodel_classifier_helper_test ________
self = <tests.unit.nupic.frameworks.opf.clamodel_classifier_helper_test.CLAClassifierHelperTest testMethod=testUpdateState>
def setUp(self):
> self.helper = CLAModelClassifierHelper(Mock(spec=CLAModel))
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/frameworks/opf/clamodel_classifier_helper_test.py:152:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <nupic.frameworks.opf.clamodel_classifier_helper.CLAModelClassifierHelper object at 0x7f88a9b06f10>
clamodel = <Mock spec='CLAModel' id='140224939188816'>, anomalyParams = {}
def __init__(self, clamodel, anomalyParams={}):
if anomalyParams is None:
anomalyParams = {}
self.clamodel = clamodel
self._version = CLAModelClassifierHelper.__VERSION__
self._classificationMaxDist = 0.1
if 'autoDetectWaitRecords' not in anomalyParams or \
anomalyParams['autoDetectWaitRecords'] is None:
self._autoDetectWaitRecords = int(Configuration.get(
> 'nupic.model.temporalAnomaly.wait_records'))
/usr/local/lib/python2.7/dist-packages/nupic/frameworks/opf/clamodel_classifier_helper.py:74:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
prop = 'nupic.model.temporalAnomaly.wait_records', default = None
@classmethod
def get(cls, prop, default=None):
""" Get the value of the given configuration property as string. This
returns a string which is the property value, or the value of "default" arg
if the property is not found. Use Configuration.getString() instead.
NOTE: it's atypical for our configuration properties to be missing - a
missing configuration property is usually a very serious error. Because
of this, it's preferable to use one of the getString, getInt, getFloat,
etc. variants instead of get(). Those variants will raise KeyError when
an expected property is missing.
Parameters:
----------------------------------------------------------------
prop: name of the property
default: default value to return if property does not exist
retval: property value (as a string), or default if the property does
not exist.
"""
try:
> return cls.getString(prop)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:162:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
prop = 'nupic.model.temporalAnomaly.wait_records'
@classmethod
def getString(cls, prop):
""" Retrieve the requested property as a string. If property does not exist,
then KeyError will be raised.
Parameters:
----------------------------------------------------------------
prop: name of the property
retval: property value as a string
"""
if cls._properties is None:
> cls._readStdConfigFiles()
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:81:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
@classmethod
def _readStdConfigFiles(cls):
""" Intercept the _readStdConfigFiles call from our base config class to
read in base and custom configuration settings.
"""
> super(Configuration, cls)._readStdConfigFiles()
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_custom.py:142:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
@classmethod
def _readStdConfigFiles(cls):
""" Read in all standard configuration files
"""
# Default one first
> cls.readConfigFile(DEFAULT_CONFIG)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:429:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
filename = 'nupic-default.xml', path = None
@classmethod
def readConfigFile(cls, filename, path=None):
""" Parse the given XML file and store all properties it describes.
Parameters:
----------------------------------------------------------------
filename: name of XML file to parse (no path)
path: path of the XML file. If None, then use the standard
configuration search path.
"""
> properties = cls._readConfigFile(filename, path)
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:219:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'nupic.support.configuration_custom.Configuration'>
filename = 'nupic-default.xml', path = None
@classmethod
def _readConfigFile(cls, filename, path=None):
""" Parse the given XML file and return a dict describing the file.
Parameters:
----------------------------------------------------------------
filename: name of XML file to parse (no path)
path: path of the XML file. If None, then use the standard
configuration search path.
retval: returns a dict with each property as a key and a dict of all
the property's attributes as value
"""
outputProperties = dict()
# Get the path to the config files.
if path is None:
filePath = cls.findConfigFile(filename)
else:
filePath = os.path.join(path, filename)
# ------------------------------------------------------------------
# Read in the config file
try:
if filePath is not None:
try:
# Use warn since console log level is set to warning
_getLogger().debug("Loading config file: %s", filePath)
with open(filePath, 'rb') as inp:
contents = inp.read()
except Exception:
raise RuntimeError("Expected configuration file at %s" % filePath)
else:
# If the file was not found in the normal search paths, which includes
# checking the NTA_CONF_PATH, we'll try loading it from pkg_resources.
try:
contents = resource_string("nupic.support", filename)
except Exception as resourceException:
# We expect these to be read, and if they don't exist we'll just use
# an empty configuration string.
if filename in [USER_CONFIG, CUSTOM_CONFIG]:
contents = '<configuration/>'
else:
raise resourceException
elements = ElementTree.XML(contents)
if elements.tag != 'configuration':
raise RuntimeError("Expected top-level element to be 'configuration' "
"but got '%s'" % (elements.tag))
# ------------------------------------------------------------------
# Add in each property found
propertyElements = elements.findall('./property')
for propertyItem in propertyElements:
propInfo = dict()
# Parse this property element
propertyAttributes = list(propertyItem)
for propertyAttribute in propertyAttributes:
propInfo[propertyAttribute.tag] = propertyAttribute.text
# Get the name
name = propInfo.get('name', None)
# value is allowed to be empty string
if 'value' in propInfo and propInfo['value'] is None:
value = ''
else:
value = propInfo.get('value', None)
if value is None:
if 'novalue' in propInfo:
# Placeholder "novalue" properties are intended to be overridden
# via dynamic configuration or another configuration layer.
continue
else:
raise RuntimeError("Missing 'value' element within the property "
"element: => %s " % (str(propInfo)))
# The value is allowed to contain substitution tags of the form
# ${env.VARNAME}, which should be substituted with the corresponding
# environment variable values
restOfValue = value
value = ''
while True:
# Find the beginning of substitution tag
pos = restOfValue.find('${env.')
if pos == -1:
# No more environment variable substitutions
value += restOfValue
break
# Append prefix to value accumulator
value += restOfValue[0:pos]
# Find the end of current substitution tag
varTailPos = restOfValue.find('}', pos)
if varTailPos == -1:
raise RuntimeError("Trailing environment variable tag delimiter '}'"
" not found in %r" % (restOfValue))
# Extract environment variable name from tag
varname = restOfValue[pos+6:varTailPos]
if varname not in os.environ:
raise RuntimeError("Attempting to use the value of the environment"
> " variable %r, which is not defined" % (varname))
E RuntimeError: Attempting to use the value of the environment variable 'USER', which is not defined
/usr/local/lib/python2.7/dist-packages/nupic/support/configuration_base.py:339: RuntimeError
____________________ TPTest.testCheckpointMiddleOfSequence2 ____________________
self = <tests.unit.nupic.research.tp_test.TPTest testMethod=testCheckpointMiddleOfSequence2>
def testCheckpointMiddleOfSequence2(self):
"""More complex test of checkpointing in the middle of a sequence."""
tp1 = TP(2048, 32, 0.21, 0.5, 11, 20, 0.1, 0.1, 1.0, 0.0, 14, False, 5, 2,
False, 1960, 0, False, 3, 10, 5, 0, 32, 128, 32, 'normal')
tp2 = TP(2048, 32, 0.21, 0.5, 11, 20, 0.1, 0.1, 1.0, 0.0, 14, False, 5, 2,
False, 1960, 0, False, 3, 10, 5, 0, 32, 128, 32, 'normal')
> with open(resource_filename(__name__, 'data/tp_input.csv'), 'r') as fin:
reader = csv.reader(fin)
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/research/data/tp_input.csv'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/research/tp_test.py:139: IOError
____________________ TPTest.testCheckpointMiddleOfSequence2 ____________________
self = <tests.unit.nupic.research.tp_test.TPTest testMethod=testCheckpointMiddleOfSequence2>
def testCheckpointMiddleOfSequence2(self):
"""More complex test of checkpointing in the middle of a sequence."""
tp1 = TP(2048, 32, 0.21, 0.5, 11, 20, 0.1, 0.1, 1.0, 0.0, 14, False, 5, 2,
False, 1960, 0, False, 3, 10, 5, 0, 32, 128, 32, 'normal')
tp2 = TP(2048, 32, 0.21, 0.5, 11, 20, 0.1, 0.1, 1.0, 0.0, 14, False, 5, 2,
False, 1960, 0, False, 3, 10, 5, 0, 32, 128, 32, 'normal')
> with open(resource_filename(__name__, 'data/tp_input.csv'), 'r') as fin:
reader = csv.reader(fin)
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/research/data/tp_input.csv'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/research/tp_test.py:139: IOError
_________________ tests.unit.nupic.support.configuration_test __________________
self = <tests.unit.nupic.support.configuration_test.ConfigurationTest testMethod=testClear>
def setUp(self):
"""configuration.Configuration relies on static methods
which load files by name. Since we need to be able to run tests and
potentially change the content of those files between tests without
interfering with one another and with the system configuration, this
setUp() function will allocate temporary files used only during the using
conf/nupic-default.xml and conf/nupic-site.xml (relative to the unit tests)
as templates.
"""
self.files = {}
with tempfile.NamedTemporaryFile(
prefix='nupic-default.xml-unittest-', delete=False) as outp:
self.addCleanup(os.remove, outp.name)
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
outp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/configuration_test.py:62: IOError
_________________ tests.unit.nupic.support.configuration_test __________________
self = <tests.unit.nupic.support.configuration_test.ConfigurationTest testMethod=testConfiguration>
def setUp(self):
"""configuration.Configuration relies on static methods
which load files by name. Since we need to be able to run tests and
potentially change the content of those files between tests without
interfering with one another and with the system configuration, this
setUp() function will allocate temporary files used only during the using
conf/nupic-default.xml and conf/nupic-site.xml (relative to the unit tests)
as templates.
"""
self.files = {}
with tempfile.NamedTemporaryFile(
prefix='nupic-default.xml-unittest-', delete=False) as outp:
self.addCleanup(os.remove, outp.name)
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
outp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/configuration_test.py:62: IOError
_________________ tests.unit.nupic.support.configuration_test __________________
self = <tests.unit.nupic.support.configuration_test.ConfigurationTest testMethod=testConfiguration2>
def setUp(self):
"""configuration.Configuration relies on static methods
which load files by name. Since we need to be able to run tests and
potentially change the content of those files between tests without
interfering with one another and with the system configuration, this
setUp() function will allocate temporary files used only during the using
conf/nupic-default.xml and conf/nupic-site.xml (relative to the unit tests)
as templates.
"""
self.files = {}
with tempfile.NamedTemporaryFile(
prefix='nupic-default.xml-unittest-', delete=False) as outp:
self.addCleanup(os.remove, outp.name)
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
outp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/configuration_test.py:62: IOError
_________________ tests.unit.nupic.support.configuration_test __________________
self = <tests.unit.nupic.support.configuration_test.ConfigurationTest testMethod=testDict>
def setUp(self):
"""configuration.Configuration relies on static methods
which load files by name. Since we need to be able to run tests and
potentially change the content of those files between tests without
interfering with one another and with the system configuration, this
setUp() function will allocate temporary files used only during the using
conf/nupic-default.xml and conf/nupic-site.xml (relative to the unit tests)
as templates.
"""
self.files = {}
with tempfile.NamedTemporaryFile(
prefix='nupic-default.xml-unittest-', delete=False) as outp:
self.addCleanup(os.remove, outp.name)
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
outp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/configuration_test.py:62: IOError
_________________ tests.unit.nupic.support.configuration_test __________________
self = <tests.unit.nupic.support.configuration_test.ConfigurationTest testMethod=testDictReadsFilesFirstTime>
def setUp(self):
"""configuration.Configuration relies on static methods
which load files by name. Since we need to be able to run tests and
potentially change the content of those files between tests without
interfering with one another and with the system configuration, this
setUp() function will allocate temporary files used only during the using
conf/nupic-default.xml and conf/nupic-site.xml (relative to the unit tests)
as templates.
"""
self.files = {}
with tempfile.NamedTemporaryFile(
prefix='nupic-default.xml-unittest-', delete=False) as outp:
self.addCleanup(os.remove, outp.name)
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
outp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/configuration_test.py:62: IOError
_________________ tests.unit.nupic.support.configuration_test __________________
self = <tests.unit.nupic.support.configuration_test.ConfigurationTest testMethod=testDictReplacesKeysFromEnvironment>
def setUp(self):
"""configuration.Configuration relies on static methods
which load files by name. Since we need to be able to run tests and
potentially change the content of those files between tests without
interfering with one another and with the system configuration, this
setUp() function will allocate temporary files used only during the using
conf/nupic-default.xml and conf/nupic-site.xml (relative to the unit tests)
as templates.
"""
self.files = {}
with tempfile.NamedTemporaryFile(
prefix='nupic-default.xml-unittest-', delete=False) as outp:
self.addCleanup(os.remove, outp.name)
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
outp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/configuration_test.py:62: IOError
_________________ tests.unit.nupic.support.configuration_test __________________
self = <tests.unit.nupic.support.configuration_test.ConfigurationTest testMethod=testFindConfigFile>
def setUp(self):
"""configuration.Configuration relies on static methods
which load files by name. Since we need to be able to run tests and
potentially change the content of those files between tests without
interfering with one another and with the system configuration, this
setUp() function will allocate temporary files used only during the using
conf/nupic-default.xml and conf/nupic-site.xml (relative to the unit tests)
as templates.
"""
self.files = {}
with tempfile.NamedTemporaryFile(
prefix='nupic-default.xml-unittest-', delete=False) as outp:
self.addCleanup(os.remove, outp.name)
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
outp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/configuration_test.py:62: IOError
_________________ tests.unit.nupic.support.configuration_test __________________
self = <tests.unit.nupic.support.configuration_test.ConfigurationTest testMethod=testFindConfigFileReturnsNoneForMissingFile>
def setUp(self):
"""configuration.Configuration relies on static methods
which load files by name. Since we need to be able to run tests and
potentially change the content of those files between tests without
interfering with one another and with the system configuration, this
setUp() function will allocate temporary files used only during the using
conf/nupic-default.xml and conf/nupic-site.xml (relative to the unit tests)
as templates.
"""
self.files = {}
with tempfile.NamedTemporaryFile(
prefix='nupic-default.xml-unittest-', delete=False) as outp:
self.addCleanup(os.remove, outp.name)
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
outp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/configuration_test.py:62: IOError
_________________ tests.unit.nupic.support.configuration_test __________________
self = <tests.unit.nupic.support.configuration_test.ConfigurationTest testMethod=testGetBool>
def setUp(self):
"""configuration.Configuration relies on static methods
which load files by name. Since we need to be able to run tests and
potentially change the content of those files between tests without
interfering with one another and with the system configuration, this
setUp() function will allocate temporary files used only during the using
conf/nupic-default.xml and conf/nupic-site.xml (relative to the unit tests)
as templates.
"""
self.files = {}
with tempfile.NamedTemporaryFile(
prefix='nupic-default.xml-unittest-', delete=False) as outp:
self.addCleanup(os.remove, outp.name)
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
outp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/configuration_test.py:62: IOError
_________________ tests.unit.nupic.support.configuration_test __________________
self = <tests.unit.nupic.support.configuration_test.ConfigurationTest testMethod=testGetBoolMissingRaisesKeyError>
def setUp(self):
"""configuration.Configuration relies on static methods
which load files by name. Since we need to be able to run tests and
potentially change the content of those files between tests without
interfering with one another and with the system configuration, this
setUp() function will allocate temporary files used only during the using
conf/nupic-default.xml and conf/nupic-site.xml (relative to the unit tests)
as templates.
"""
self.files = {}
with tempfile.NamedTemporaryFile(
prefix='nupic-default.xml-unittest-', delete=False) as outp:
self.addCleanup(os.remove, outp.name)
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
outp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/configuration_test.py:62: IOError
_________________ tests.unit.nupic.support.configuration_test __________________
self = <tests.unit.nupic.support.configuration_test.ConfigurationTest testMethod=testGetBoolOutOfRangeRaisesValueError>
def setUp(self):
"""configuration.Configuration relies on static methods
which load files by name. Since we need to be able to run tests and
potentially change the content of those files between tests without
interfering with one another and with the system configuration, this
setUp() function will allocate temporary files used only during the using
conf/nupic-default.xml and conf/nupic-site.xml (relative to the unit tests)
as templates.
"""
self.files = {}
with tempfile.NamedTemporaryFile(
prefix='nupic-default.xml-unittest-', delete=False) as outp:
self.addCleanup(os.remove, outp.name)
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
outp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/configuration_test.py:62: IOError
_________________ tests.unit.nupic.support.configuration_test __________________
self = <tests.unit.nupic.support.configuration_test.ConfigurationTest testMethod=testGetConfigPaths>
def setUp(self):
"""configuration.Configuration relies on static methods
which load files by name. Since we need to be able to run tests and
potentially change the content of those files between tests without
interfering with one another and with the system configuration, this
setUp() function will allocate temporary files used only during the using
conf/nupic-default.xml and conf/nupic-site.xml (relative to the unit tests)
as templates.
"""
self.files = {}
with tempfile.NamedTemporaryFile(
prefix='nupic-default.xml-unittest-', delete=False) as outp:
self.addCleanup(os.remove, outp.name)
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
outp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/configuration_test.py:62: IOError
_________________ tests.unit.nupic.support.configuration_test __________________
self = <tests.unit.nupic.support.configuration_test.ConfigurationTest testMethod=testGetConfigPathsForNoneWithNTA_CONF_PATHInEnv>
def setUp(self):
"""configuration.Configuration relies on static methods
which load files by name. Since we need to be able to run tests and
potentially change the content of those files between tests without
interfering with one another and with the system configuration, this
setUp() function will allocate temporary files used only during the using
conf/nupic-default.xml and conf/nupic-site.xml (relative to the unit tests)
as templates.
"""
self.files = {}
with tempfile.NamedTemporaryFile(
prefix='nupic-default.xml-unittest-', delete=False) as outp:
self.addCleanup(os.remove, outp.name)
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
outp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/configuration_test.py:62: IOError
_________________ tests.unit.nupic.support.configuration_test __________________
self = <tests.unit.nupic.support.configuration_test.ConfigurationTest testMethod=testGetFloat>
def setUp(self):
"""configuration.Configuration relies on static methods
which load files by name. Since we need to be able to run tests and
potentially change the content of those files between tests without
interfering with one another and with the system configuration, this
setUp() function will allocate temporary files used only during the using
conf/nupic-default.xml and conf/nupic-site.xml (relative to the unit tests)
as templates.
"""
self.files = {}
with tempfile.NamedTemporaryFile(
prefix='nupic-default.xml-unittest-', delete=False) as outp:
self.addCleanup(os.remove, outp.name)
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
outp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/configuration_test.py:62: IOError
_________________ tests.unit.nupic.support.configuration_test __________________
self = <tests.unit.nupic.support.configuration_test.ConfigurationTest testMethod=testGetFloatMissingRaisesKeyError>
def setUp(self):
"""configuration.Configuration relies on static methods
which load files by name. Since we need to be able to run tests and
potentially change the content of those files between tests without
interfering with one another and with the system configuration, this
setUp() function will allocate temporary files used only during the using
conf/nupic-default.xml and conf/nupic-site.xml (relative to the unit tests)
as templates.
"""
self.files = {}
with tempfile.NamedTemporaryFile(
prefix='nupic-default.xml-unittest-', delete=False) as outp:
self.addCleanup(os.remove, outp.name)
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
outp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/configuration_test.py:62: IOError
_________________ tests.unit.nupic.support.configuration_test __________________
self = <tests.unit.nupic.support.configuration_test.ConfigurationTest testMethod=testGetFromEnvironment>
def setUp(self):
"""configuration.Configuration relies on static methods
which load files by name. Since we need to be able to run tests and
potentially change the content of those files between tests without
interfering with one another and with the system configuration, this
setUp() function will allocate temporary files used only during the using
conf/nupic-default.xml and conf/nupic-site.xml (relative to the unit tests)
as templates.
"""
self.files = {}
with tempfile.NamedTemporaryFile(
prefix='nupic-default.xml-unittest-', delete=False) as outp:
self.addCleanup(os.remove, outp.name)
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
outp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/configuration_test.py:62: IOError
_________________ tests.unit.nupic.support.configuration_test __________________
self = <tests.unit.nupic.support.configuration_test.ConfigurationTest testMethod=testGetInt>
def setUp(self):
"""configuration.Configuration relies on static methods
which load files by name. Since we need to be able to run tests and
potentially change the content of those files between tests without
interfering with one another and with the system configuration, this
setUp() function will allocate temporary files used only during the using
conf/nupic-default.xml and conf/nupic-site.xml (relative to the unit tests)
as templates.
"""
self.files = {}
with tempfile.NamedTemporaryFile(
prefix='nupic-default.xml-unittest-', delete=False) as outp:
self.addCleanup(os.remove, outp.name)
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
outp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/configuration_test.py:62: IOError
_________________ tests.unit.nupic.support.configuration_test __________________
self = <tests.unit.nupic.support.configuration_test.ConfigurationTest testMethod=testGetIntMissingRaisesKeyError>
def setUp(self):
"""configuration.Configuration relies on static methods
which load files by name. Since we need to be able to run tests and
potentially change the content of those files between tests without
interfering with one another and with the system configuration, this
setUp() function will allocate temporary files used only during the using
conf/nupic-default.xml and conf/nupic-site.xml (relative to the unit tests)
as templates.
"""
self.files = {}
with tempfile.NamedTemporaryFile(
prefix='nupic-default.xml-unittest-', delete=False) as outp:
self.addCleanup(os.remove, outp.name)
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
outp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/configuration_test.py:62: IOError
_________________ tests.unit.nupic.support.configuration_test __________________
self = <tests.unit.nupic.support.configuration_test.ConfigurationTest testMethod=testGetMissingReturnsNone>
def setUp(self):
"""configuration.Configuration relies on static methods
which load files by name. Since we need to be able to run tests and
potentially change the content of those files between tests without
interfering with one another and with the system configuration, this
setUp() function will allocate temporary files used only during the using
conf/nupic-default.xml and conf/nupic-site.xml (relative to the unit tests)
as templates.
"""
self.files = {}
with tempfile.NamedTemporaryFile(
prefix='nupic-default.xml-unittest-', delete=False) as outp:
self.addCleanup(os.remove, outp.name)
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
outp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/configuration_test.py:62: IOError
_________________ tests.unit.nupic.support.configuration_test __________________
self = <tests.unit.nupic.support.configuration_test.ConfigurationTest testMethod=testGetString>
def setUp(self):
"""configuration.Configuration relies on static methods
which load files by name. Since we need to be able to run tests and
potentially change the content of those files between tests without
interfering with one another and with the system configuration, this
setUp() function will allocate temporary files used only during the using
conf/nupic-default.xml and conf/nupic-site.xml (relative to the unit tests)
as templates.
"""
self.files = {}
with tempfile.NamedTemporaryFile(
prefix='nupic-default.xml-unittest-', delete=False) as outp:
self.addCleanup(os.remove, outp.name)
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
outp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/configuration_test.py:62: IOError
_________________ tests.unit.nupic.support.configuration_test __________________
self = <tests.unit.nupic.support.configuration_test.ConfigurationTest testMethod=testGetStringMissingRaisesKeyError>
def setUp(self):
"""configuration.Configuration relies on static methods
which load files by name. Since we need to be able to run tests and
potentially change the content of those files between tests without
interfering with one another and with the system configuration, this
setUp() function will allocate temporary files used only during the using
conf/nupic-default.xml and conf/nupic-site.xml (relative to the unit tests)
as templates.
"""
self.files = {}
with tempfile.NamedTemporaryFile(
prefix='nupic-default.xml-unittest-', delete=False) as outp:
self.addCleanup(os.remove, outp.name)
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
outp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/configuration_test.py:62: IOError
_________________ tests.unit.nupic.support.configuration_test __________________
self = <tests.unit.nupic.support.configuration_test.ConfigurationTest testMethod=testReadConfigFileEmptyNameAndValue>
def setUp(self):
"""configuration.Configuration relies on static methods
which load files by name. Since we need to be able to run tests and
potentially change the content of those files between tests without
interfering with one another and with the system configuration, this
setUp() function will allocate temporary files used only during the using
conf/nupic-default.xml and conf/nupic-site.xml (relative to the unit tests)
as templates.
"""
self.files = {}
with tempfile.NamedTemporaryFile(
prefix='nupic-default.xml-unittest-', delete=False) as outp:
self.addCleanup(os.remove, outp.name)
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
outp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/configuration_test.py:62: IOError
_________________ tests.unit.nupic.support.configuration_test __________________
self = <tests.unit.nupic.support.configuration_test.ConfigurationTest testMethod=testReadConfigFileEmptyValue>
def setUp(self):
"""configuration.Configuration relies on static methods
which load files by name. Since we need to be able to run tests and
potentially change the content of those files between tests without
interfering with one another and with the system configuration, this
setUp() function will allocate temporary files used only during the using
conf/nupic-default.xml and conf/nupic-site.xml (relative to the unit tests)
as templates.
"""
self.files = {}
with tempfile.NamedTemporaryFile(
prefix='nupic-default.xml-unittest-', delete=False) as outp:
self.addCleanup(os.remove, outp.name)
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
outp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/configuration_test.py:62: IOError
_________________ tests.unit.nupic.support.configuration_test __________________
self = <tests.unit.nupic.support.configuration_test.ConfigurationTest testMethod=testReadConfigFileEnvironmentOverride>
def setUp(self):
"""configuration.Configuration relies on static methods
which load files by name. Since we need to be able to run tests and
potentially change the content of those files between tests without
interfering with one another and with the system configuration, this
setUp() function will allocate temporary files used only during the using
conf/nupic-default.xml and conf/nupic-site.xml (relative to the unit tests)
as templates.
"""
self.files = {}
with tempfile.NamedTemporaryFile(
prefix='nupic-default.xml-unittest-', delete=False) as outp:
self.addCleanup(os.remove, outp.name)
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
outp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/configuration_test.py:62: IOError
_________________ tests.unit.nupic.support.configuration_test __________________
self = <tests.unit.nupic.support.configuration_test.ConfigurationTest testMethod=testReadConfigFileFromPath>
def setUp(self):
"""configuration.Configuration relies on static methods
which load files by name. Since we need to be able to run tests and
potentially change the content of those files between tests without
interfering with one another and with the system configuration, this
setUp() function will allocate temporary files used only during the using
conf/nupic-default.xml and conf/nupic-site.xml (relative to the unit tests)
as templates.
"""
self.files = {}
with tempfile.NamedTemporaryFile(
prefix='nupic-default.xml-unittest-', delete=False) as outp:
self.addCleanup(os.remove, outp.name)
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
outp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/configuration_test.py:62: IOError
_________________ tests.unit.nupic.support.configuration_test __________________
self = <tests.unit.nupic.support.configuration_test.ConfigurationTest testMethod=testReadConfigFileMalformedEnvReference>
def setUp(self):
"""configuration.Configuration relies on static methods
which load files by name. Since we need to be able to run tests and
potentially change the content of those files between tests without
interfering with one another and with the system configuration, this
setUp() function will allocate temporary files used only during the using
conf/nupic-default.xml and conf/nupic-site.xml (relative to the unit tests)
as templates.
"""
self.files = {}
with tempfile.NamedTemporaryFile(
prefix='nupic-default.xml-unittest-', delete=False) as outp:
self.addCleanup(os.remove, outp.name)
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
outp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/configuration_test.py:62: IOError
_________________ tests.unit.nupic.support.configuration_test __________________
self = <tests.unit.nupic.support.configuration_test.ConfigurationTest testMethod=testReadConfigFileMissingDocumentRoot>
def setUp(self):
"""configuration.Configuration relies on static methods
which load files by name. Since we need to be able to run tests and
potentially change the content of those files between tests without
interfering with one another and with the system configuration, this
setUp() function will allocate temporary files used only during the using
conf/nupic-default.xml and conf/nupic-site.xml (relative to the unit tests)
as templates.
"""
self.files = {}
with tempfile.NamedTemporaryFile(
prefix='nupic-default.xml-unittest-', delete=False) as outp:
self.addCleanup(os.remove, outp.name)
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
outp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/configuration_test.py:62: IOError
_________________ tests.unit.nupic.support.configuration_test __________________
self = <tests.unit.nupic.support.configuration_test.ConfigurationTest testMethod=testReadConfigFileMissingEnvVars>
def setUp(self):
"""configuration.Configuration relies on static methods
which load files by name. Since we need to be able to run tests and
potentially change the content of those files between tests without
interfering with one another and with the system configuration, this
setUp() function will allocate temporary files used only during the using
conf/nupic-default.xml and conf/nupic-site.xml (relative to the unit tests)
as templates.
"""
self.files = {}
with tempfile.NamedTemporaryFile(
prefix='nupic-default.xml-unittest-', delete=False) as outp:
self.addCleanup(os.remove, outp.name)
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
outp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/configuration_test.py:62: IOError
_________________ tests.unit.nupic.support.configuration_test __________________
self = <tests.unit.nupic.support.configuration_test.ConfigurationTest testMethod=testReadConfigFileMissingNonPropertyConfigurationChildren>
def setUp(self):
"""configuration.Configuration relies on static methods
which load files by name. Since we need to be able to run tests and
potentially change the content of those files between tests without
interfering with one another and with the system configuration, this
setUp() function will allocate temporary files used only during the using
conf/nupic-default.xml and conf/nupic-site.xml (relative to the unit tests)
as templates.
"""
self.files = {}
with tempfile.NamedTemporaryFile(
prefix='nupic-default.xml-unittest-', delete=False) as outp:
self.addCleanup(os.remove, outp.name)
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
outp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/configuration_test.py:62: IOError
_________________ tests.unit.nupic.support.configuration_test __________________
self = <tests.unit.nupic.support.configuration_test.ConfigurationTest testMethod=testReadConfigFileUnexpectedElementAtRoot>
def setUp(self):
"""configuration.Configuration relies on static methods
which load files by name. Since we need to be able to run tests and
potentially change the content of those files between tests without
interfering with one another and with the system configuration, this
setUp() function will allocate temporary files used only during the using
conf/nupic-default.xml and conf/nupic-site.xml (relative to the unit tests)
as templates.
"""
self.files = {}
with tempfile.NamedTemporaryFile(
prefix='nupic-default.xml-unittest-', delete=False) as outp:
self.addCleanup(os.remove, outp.name)
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
outp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/configuration_test.py:62: IOError
_________________ tests.unit.nupic.support.configuration_test __________________
self = <tests.unit.nupic.support.configuration_test.ConfigurationTest testMethod=testSetAndGet>
def setUp(self):
"""configuration.Configuration relies on static methods
which load files by name. Since we need to be able to run tests and
potentially change the content of those files between tests without
interfering with one another and with the system configuration, this
setUp() function will allocate temporary files used only during the using
conf/nupic-default.xml and conf/nupic-site.xml (relative to the unit tests)
as templates.
"""
self.files = {}
with tempfile.NamedTemporaryFile(
prefix='nupic-default.xml-unittest-', delete=False) as outp:
self.addCleanup(os.remove, outp.name)
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
outp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/configuration_test.py:62: IOError
______ ConfigurationTest.testSetConfigPathsForNoneWithNTA_CONF_PATHInEnv _______
self = <tests.unit.nupic.support.configuration_test.ConfigurationTest testMethod=testSetConfigPathsForNoneWithNTA_CONF_PATHInEnv>
def setUp(self):
"""configuration.Configuration relies on static methods
which load files by name. Since we need to be able to run tests and
potentially change the content of those files between tests without
interfering with one another and with the system configuration, this
setUp() function will allocate temporary files used only during the using
conf/nupic-default.xml and conf/nupic-site.xml (relative to the unit tests)
as templates.
"""
self.files = {}
with tempfile.NamedTemporaryFile(
prefix='nupic-default.xml-unittest-', delete=False) as outp:
self.addCleanup(os.remove, outp.name)
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
outp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/configuration_test.py:62: IOError
______________ tests.unit.nupic.support.custom_configuration_test ______________
self = <tests.unit.nupic.support.custom_configuration_test.ConfigurationCustomTest testMethod=testClear>
def setUp(self):
if "NTA_DYNAMIC_CONF_DIR" in os.environ:
# Remove it to make sure our in-proc tests won't accidentally
# mess with actual files
oldNtaDynamicConfDir = os.environ["NTA_DYNAMIC_CONF_DIR"]
del os.environ["NTA_DYNAMIC_CONF_DIR"]
self.addCleanup(os.environ.update,
dict(NTA_DYNAMIC_CONF_DIR=oldNtaDynamicConfDir))
self.files = dict()
tmpDir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, tmpDir)
with open(os.path.join(tmpDir, 'nupic-default.xml-unittest'), 'w') as fp:
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
fp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/custom_configuration_test.py:68: IOError
______________ tests.unit.nupic.support.custom_configuration_test ______________
self = <tests.unit.nupic.support.custom_configuration_test.ConfigurationCustomTest testMethod=testClearInvalidFile>
def setUp(self):
if "NTA_DYNAMIC_CONF_DIR" in os.environ:
# Remove it to make sure our in-proc tests won't accidentally
# mess with actual files
oldNtaDynamicConfDir = os.environ["NTA_DYNAMIC_CONF_DIR"]
del os.environ["NTA_DYNAMIC_CONF_DIR"]
self.addCleanup(os.environ.update,
dict(NTA_DYNAMIC_CONF_DIR=oldNtaDynamicConfDir))
self.files = dict()
tmpDir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, tmpDir)
with open(os.path.join(tmpDir, 'nupic-default.xml-unittest'), 'w') as fp:
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
fp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/custom_configuration_test.py:68: IOError
______________ tests.unit.nupic.support.custom_configuration_test ______________
self = <tests.unit.nupic.support.custom_configuration_test.ConfigurationCustomTest testMethod=testConfiguration>
def setUp(self):
if "NTA_DYNAMIC_CONF_DIR" in os.environ:
# Remove it to make sure our in-proc tests won't accidentally
# mess with actual files
oldNtaDynamicConfDir = os.environ["NTA_DYNAMIC_CONF_DIR"]
del os.environ["NTA_DYNAMIC_CONF_DIR"]
self.addCleanup(os.environ.update,
dict(NTA_DYNAMIC_CONF_DIR=oldNtaDynamicConfDir))
self.files = dict()
tmpDir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, tmpDir)
with open(os.path.join(tmpDir, 'nupic-default.xml-unittest'), 'w') as fp:
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
fp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/custom_configuration_test.py:68: IOError
______________ tests.unit.nupic.support.custom_configuration_test ______________
self = <tests.unit.nupic.support.custom_configuration_test.ConfigurationCustomTest testMethod=testConfiguration2>
def setUp(self):
if "NTA_DYNAMIC_CONF_DIR" in os.environ:
# Remove it to make sure our in-proc tests won't accidentally
# mess with actual files
oldNtaDynamicConfDir = os.environ["NTA_DYNAMIC_CONF_DIR"]
del os.environ["NTA_DYNAMIC_CONF_DIR"]
self.addCleanup(os.environ.update,
dict(NTA_DYNAMIC_CONF_DIR=oldNtaDynamicConfDir))
self.files = dict()
tmpDir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, tmpDir)
with open(os.path.join(tmpDir, 'nupic-default.xml-unittest'), 'w') as fp:
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
fp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/custom_configuration_test.py:68: IOError
______________ tests.unit.nupic.support.custom_configuration_test ______________
self = <tests.unit.nupic.support.custom_configuration_test.ConfigurationCustomTest testMethod=testCustomConfigDict>
def setUp(self):
if "NTA_DYNAMIC_CONF_DIR" in os.environ:
# Remove it to make sure our in-proc tests won't accidentally
# mess with actual files
oldNtaDynamicConfDir = os.environ["NTA_DYNAMIC_CONF_DIR"]
del os.environ["NTA_DYNAMIC_CONF_DIR"]
self.addCleanup(os.environ.update,
dict(NTA_DYNAMIC_CONF_DIR=oldNtaDynamicConfDir))
self.files = dict()
tmpDir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, tmpDir)
with open(os.path.join(tmpDir, 'nupic-default.xml-unittest'), 'w') as fp:
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
fp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/custom_configuration_test.py:68: IOError
______________ tests.unit.nupic.support.custom_configuration_test ______________
self = <tests.unit.nupic.support.custom_configuration_test.ConfigurationCustomTest testMethod=testCustomConfigOverrides>
def setUp(self):
if "NTA_DYNAMIC_CONF_DIR" in os.environ:
# Remove it to make sure our in-proc tests won't accidentally
# mess with actual files
oldNtaDynamicConfDir = os.environ["NTA_DYNAMIC_CONF_DIR"]
del os.environ["NTA_DYNAMIC_CONF_DIR"]
self.addCleanup(os.environ.update,
dict(NTA_DYNAMIC_CONF_DIR=oldNtaDynamicConfDir))
self.files = dict()
tmpDir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, tmpDir)
with open(os.path.join(tmpDir, 'nupic-default.xml-unittest'), 'w') as fp:
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
fp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/custom_configuration_test.py:68: IOError
______________ tests.unit.nupic.support.custom_configuration_test ______________
self = <tests.unit.nupic.support.custom_configuration_test.ConfigurationCustomTest testMethod=testCustomFileCreated>
def setUp(self):
if "NTA_DYNAMIC_CONF_DIR" in os.environ:
# Remove it to make sure our in-proc tests won't accidentally
# mess with actual files
oldNtaDynamicConfDir = os.environ["NTA_DYNAMIC_CONF_DIR"]
del os.environ["NTA_DYNAMIC_CONF_DIR"]
self.addCleanup(os.environ.update,
dict(NTA_DYNAMIC_CONF_DIR=oldNtaDynamicConfDir))
self.files = dict()
tmpDir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, tmpDir)
with open(os.path.join(tmpDir, 'nupic-default.xml-unittest'), 'w') as fp:
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
fp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/custom_configuration_test.py:68: IOError
______________ tests.unit.nupic.support.custom_configuration_test ______________
self = <tests.unit.nupic.support.custom_configuration_test.ConfigurationCustomTest testMethod=testDict>
def setUp(self):
if "NTA_DYNAMIC_CONF_DIR" in os.environ:
# Remove it to make sure our in-proc tests won't accidentally
# mess with actual files
oldNtaDynamicConfDir = os.environ["NTA_DYNAMIC_CONF_DIR"]
del os.environ["NTA_DYNAMIC_CONF_DIR"]
self.addCleanup(os.environ.update,
dict(NTA_DYNAMIC_CONF_DIR=oldNtaDynamicConfDir))
self.files = dict()
tmpDir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, tmpDir)
with open(os.path.join(tmpDir, 'nupic-default.xml-unittest'), 'w') as fp:
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
fp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/custom_configuration_test.py:68: IOError
______________ tests.unit.nupic.support.custom_configuration_test ______________
self = <tests.unit.nupic.support.custom_configuration_test.ConfigurationCustomTest testMethod=testDictReadsFilesFirstTime>
def setUp(self):
if "NTA_DYNAMIC_CONF_DIR" in os.environ:
# Remove it to make sure our in-proc tests won't accidentally
# mess with actual files
oldNtaDynamicConfDir = os.environ["NTA_DYNAMIC_CONF_DIR"]
del os.environ["NTA_DYNAMIC_CONF_DIR"]
self.addCleanup(os.environ.update,
dict(NTA_DYNAMIC_CONF_DIR=oldNtaDynamicConfDir))
self.files = dict()
tmpDir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, tmpDir)
with open(os.path.join(tmpDir, 'nupic-default.xml-unittest'), 'w') as fp:
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
fp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/custom_configuration_test.py:68: IOError
______________ tests.unit.nupic.support.custom_configuration_test ______________
self = <tests.unit.nupic.support.custom_configuration_test.ConfigurationCustomTest testMethod=testDictReplacesKeysFromEnvironment>
def setUp(self):
if "NTA_DYNAMIC_CONF_DIR" in os.environ:
# Remove it to make sure our in-proc tests won't accidentally
# mess with actual files
oldNtaDynamicConfDir = os.environ["NTA_DYNAMIC_CONF_DIR"]
del os.environ["NTA_DYNAMIC_CONF_DIR"]
self.addCleanup(os.environ.update,
dict(NTA_DYNAMIC_CONF_DIR=oldNtaDynamicConfDir))
self.files = dict()
tmpDir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, tmpDir)
with open(os.path.join(tmpDir, 'nupic-default.xml-unittest'), 'w') as fp:
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
fp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/custom_configuration_test.py:68: IOError
______________ tests.unit.nupic.support.custom_configuration_test ______________
self = <tests.unit.nupic.support.custom_configuration_test.ConfigurationCustomTest testMethod=testDictWithTemp>
def setUp(self):
if "NTA_DYNAMIC_CONF_DIR" in os.environ:
# Remove it to make sure our in-proc tests won't accidentally
# mess with actual files
oldNtaDynamicConfDir = os.environ["NTA_DYNAMIC_CONF_DIR"]
del os.environ["NTA_DYNAMIC_CONF_DIR"]
self.addCleanup(os.environ.update,
dict(NTA_DYNAMIC_CONF_DIR=oldNtaDynamicConfDir))
self.files = dict()
tmpDir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, tmpDir)
with open(os.path.join(tmpDir, 'nupic-default.xml-unittest'), 'w') as fp:
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
fp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/custom_configuration_test.py:68: IOError
______________ tests.unit.nupic.support.custom_configuration_test ______________
self = <tests.unit.nupic.support.custom_configuration_test.ConfigurationCustomTest testMethod=testEmptyGetCustomDict>
def setUp(self):
if "NTA_DYNAMIC_CONF_DIR" in os.environ:
# Remove it to make sure our in-proc tests won't accidentally
# mess with actual files
oldNtaDynamicConfDir = os.environ["NTA_DYNAMIC_CONF_DIR"]
del os.environ["NTA_DYNAMIC_CONF_DIR"]
self.addCleanup(os.environ.update,
dict(NTA_DYNAMIC_CONF_DIR=oldNtaDynamicConfDir))
self.files = dict()
tmpDir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, tmpDir)
with open(os.path.join(tmpDir, 'nupic-default.xml-unittest'), 'w') as fp:
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
fp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/custom_configuration_test.py:68: IOError
______________ tests.unit.nupic.support.custom_configuration_test ______________
self = <tests.unit.nupic.support.custom_configuration_test.ConfigurationCustomTest testMethod=testFindConfigFile>
def setUp(self):
if "NTA_DYNAMIC_CONF_DIR" in os.environ:
# Remove it to make sure our in-proc tests won't accidentally
# mess with actual files
oldNtaDynamicConfDir = os.environ["NTA_DYNAMIC_CONF_DIR"]
del os.environ["NTA_DYNAMIC_CONF_DIR"]
self.addCleanup(os.environ.update,
dict(NTA_DYNAMIC_CONF_DIR=oldNtaDynamicConfDir))
self.files = dict()
tmpDir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, tmpDir)
with open(os.path.join(tmpDir, 'nupic-default.xml-unittest'), 'w') as fp:
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
fp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/custom_configuration_test.py:68: IOError
______________ tests.unit.nupic.support.custom_configuration_test ______________
self = <tests.unit.nupic.support.custom_configuration_test.ConfigurationCustomTest testMethod=testFindConfigFileReturnsNoneForMissingFile>
def setUp(self):
if "NTA_DYNAMIC_CONF_DIR" in os.environ:
# Remove it to make sure our in-proc tests won't accidentally
# mess with actual files
oldNtaDynamicConfDir = os.environ["NTA_DYNAMIC_CONF_DIR"]
del os.environ["NTA_DYNAMIC_CONF_DIR"]
self.addCleanup(os.environ.update,
dict(NTA_DYNAMIC_CONF_DIR=oldNtaDynamicConfDir))
self.files = dict()
tmpDir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, tmpDir)
with open(os.path.join(tmpDir, 'nupic-default.xml-unittest'), 'w') as fp:
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
fp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/custom_configuration_test.py:68: IOError
______________ tests.unit.nupic.support.custom_configuration_test ______________
self = <tests.unit.nupic.support.custom_configuration_test.ConfigurationCustomTest testMethod=testGet>
def setUp(self):
if "NTA_DYNAMIC_CONF_DIR" in os.environ:
# Remove it to make sure our in-proc tests won't accidentally
# mess with actual files
oldNtaDynamicConfDir = os.environ["NTA_DYNAMIC_CONF_DIR"]
del os.environ["NTA_DYNAMIC_CONF_DIR"]
self.addCleanup(os.environ.update,
dict(NTA_DYNAMIC_CONF_DIR=oldNtaDynamicConfDir))
self.files = dict()
tmpDir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, tmpDir)
with open(os.path.join(tmpDir, 'nupic-default.xml-unittest'), 'w') as fp:
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
fp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/custom_configuration_test.py:68: IOError
______________ tests.unit.nupic.support.custom_configuration_test ______________
self = <tests.unit.nupic.support.custom_configuration_test.ConfigurationCustomTest testMethod=testGetBool>
def setUp(self):
if "NTA_DYNAMIC_CONF_DIR" in os.environ:
# Remove it to make sure our in-proc tests won't accidentally
# mess with actual files
oldNtaDynamicConfDir = os.environ["NTA_DYNAMIC_CONF_DIR"]
del os.environ["NTA_DYNAMIC_CONF_DIR"]
self.addCleanup(os.environ.update,
dict(NTA_DYNAMIC_CONF_DIR=oldNtaDynamicConfDir))
self.files = dict()
tmpDir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, tmpDir)
with open(os.path.join(tmpDir, 'nupic-default.xml-unittest'), 'w') as fp:
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
fp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/custom_configuration_test.py:68: IOError
______________ tests.unit.nupic.support.custom_configuration_test ______________
self = <tests.unit.nupic.support.custom_configuration_test.ConfigurationCustomTest testMethod=testGetBoolMissingRaisesKeyError>
def setUp(self):
if "NTA_DYNAMIC_CONF_DIR" in os.environ:
# Remove it to make sure our in-proc tests won't accidentally
# mess with actual files
oldNtaDynamicConfDir = os.environ["NTA_DYNAMIC_CONF_DIR"]
del os.environ["NTA_DYNAMIC_CONF_DIR"]
self.addCleanup(os.environ.update,
dict(NTA_DYNAMIC_CONF_DIR=oldNtaDynamicConfDir))
self.files = dict()
tmpDir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, tmpDir)
with open(os.path.join(tmpDir, 'nupic-default.xml-unittest'), 'w') as fp:
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
fp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/custom_configuration_test.py:68: IOError
______________ tests.unit.nupic.support.custom_configuration_test ______________
self = <tests.unit.nupic.support.custom_configuration_test.ConfigurationCustomTest testMethod=testGetBoolOutOfRangeRaisesValueError>
def setUp(self):
if "NTA_DYNAMIC_CONF_DIR" in os.environ:
# Remove it to make sure our in-proc tests won't accidentally
# mess with actual files
oldNtaDynamicConfDir = os.environ["NTA_DYNAMIC_CONF_DIR"]
del os.environ["NTA_DYNAMIC_CONF_DIR"]
self.addCleanup(os.environ.update,
dict(NTA_DYNAMIC_CONF_DIR=oldNtaDynamicConfDir))
self.files = dict()
tmpDir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, tmpDir)
with open(os.path.join(tmpDir, 'nupic-default.xml-unittest'), 'w') as fp:
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
fp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/custom_configuration_test.py:68: IOError
______________ tests.unit.nupic.support.custom_configuration_test ______________
self = <tests.unit.nupic.support.custom_configuration_test.ConfigurationCustomTest testMethod=testGetConfigPaths>
def setUp(self):
if "NTA_DYNAMIC_CONF_DIR" in os.environ:
# Remove it to make sure our in-proc tests won't accidentally
# mess with actual files
oldNtaDynamicConfDir = os.environ["NTA_DYNAMIC_CONF_DIR"]
del os.environ["NTA_DYNAMIC_CONF_DIR"]
self.addCleanup(os.environ.update,
dict(NTA_DYNAMIC_CONF_DIR=oldNtaDynamicConfDir))
self.files = dict()
tmpDir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, tmpDir)
with open(os.path.join(tmpDir, 'nupic-default.xml-unittest'), 'w') as fp:
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
fp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/custom_configuration_test.py:68: IOError
______________ tests.unit.nupic.support.custom_configuration_test ______________
self = <tests.unit.nupic.support.custom_configuration_test.ConfigurationCustomTest testMethod=testGetConfigPathsForNoneWithNTA_CONF_PATHInEnv>
def setUp(self):
if "NTA_DYNAMIC_CONF_DIR" in os.environ:
# Remove it to make sure our in-proc tests won't accidentally
# mess with actual files
oldNtaDynamicConfDir = os.environ["NTA_DYNAMIC_CONF_DIR"]
del os.environ["NTA_DYNAMIC_CONF_DIR"]
self.addCleanup(os.environ.update,
dict(NTA_DYNAMIC_CONF_DIR=oldNtaDynamicConfDir))
self.files = dict()
tmpDir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, tmpDir)
with open(os.path.join(tmpDir, 'nupic-default.xml-unittest'), 'w') as fp:
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
fp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/custom_configuration_test.py:68: IOError
______________ tests.unit.nupic.support.custom_configuration_test ______________
self = <tests.unit.nupic.support.custom_configuration_test.ConfigurationCustomTest testMethod=testGetCustomDict>
def setUp(self):
if "NTA_DYNAMIC_CONF_DIR" in os.environ:
# Remove it to make sure our in-proc tests won't accidentally
# mess with actual files
oldNtaDynamicConfDir = os.environ["NTA_DYNAMIC_CONF_DIR"]
del os.environ["NTA_DYNAMIC_CONF_DIR"]
self.addCleanup(os.environ.update,
dict(NTA_DYNAMIC_CONF_DIR=oldNtaDynamicConfDir))
self.files = dict()
tmpDir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, tmpDir)
with open(os.path.join(tmpDir, 'nupic-default.xml-unittest'), 'w') as fp:
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
fp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/custom_configuration_test.py:68: IOError
______________ tests.unit.nupic.support.custom_configuration_test ______________
self = <tests.unit.nupic.support.custom_configuration_test.ConfigurationCustomTest testMethod=testGetCustomDictNoFile>
def setUp(self):
if "NTA_DYNAMIC_CONF_DIR" in os.environ:
# Remove it to make sure our in-proc tests won't accidentally
# mess with actual files
oldNtaDynamicConfDir = os.environ["NTA_DYNAMIC_CONF_DIR"]
del os.environ["NTA_DYNAMIC_CONF_DIR"]
self.addCleanup(os.environ.update,
dict(NTA_DYNAMIC_CONF_DIR=oldNtaDynamicConfDir))
self.files = dict()
tmpDir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, tmpDir)
with open(os.path.join(tmpDir, 'nupic-default.xml-unittest'), 'w') as fp:
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
fp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/custom_configuration_test.py:68: IOError
______________ tests.unit.nupic.support.custom_configuration_test ______________
self = <tests.unit.nupic.support.custom_configuration_test.ConfigurationCustomTest testMethod=testGetFloat>
def setUp(self):
if "NTA_DYNAMIC_CONF_DIR" in os.environ:
# Remove it to make sure our in-proc tests won't accidentally
# mess with actual files
oldNtaDynamicConfDir = os.environ["NTA_DYNAMIC_CONF_DIR"]
del os.environ["NTA_DYNAMIC_CONF_DIR"]
self.addCleanup(os.environ.update,
dict(NTA_DYNAMIC_CONF_DIR=oldNtaDynamicConfDir))
self.files = dict()
tmpDir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, tmpDir)
with open(os.path.join(tmpDir, 'nupic-default.xml-unittest'), 'w') as fp:
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
fp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/custom_configuration_test.py:68: IOError
______________ tests.unit.nupic.support.custom_configuration_test ______________
self = <tests.unit.nupic.support.custom_configuration_test.ConfigurationCustomTest testMethod=testGetFloatMissingRaisesKeyError>
def setUp(self):
if "NTA_DYNAMIC_CONF_DIR" in os.environ:
# Remove it to make sure our in-proc tests won't accidentally
# mess with actual files
oldNtaDynamicConfDir = os.environ["NTA_DYNAMIC_CONF_DIR"]
del os.environ["NTA_DYNAMIC_CONF_DIR"]
self.addCleanup(os.environ.update,
dict(NTA_DYNAMIC_CONF_DIR=oldNtaDynamicConfDir))
self.files = dict()
tmpDir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, tmpDir)
with open(os.path.join(tmpDir, 'nupic-default.xml-unittest'), 'w') as fp:
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
fp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/custom_configuration_test.py:68: IOError
______________ tests.unit.nupic.support.custom_configuration_test ______________
self = <tests.unit.nupic.support.custom_configuration_test.ConfigurationCustomTest testMethod=testGetFromEnvironment>
def setUp(self):
if "NTA_DYNAMIC_CONF_DIR" in os.environ:
# Remove it to make sure our in-proc tests won't accidentally
# mess with actual files
oldNtaDynamicConfDir = os.environ["NTA_DYNAMIC_CONF_DIR"]
del os.environ["NTA_DYNAMIC_CONF_DIR"]
self.addCleanup(os.environ.update,
dict(NTA_DYNAMIC_CONF_DIR=oldNtaDynamicConfDir))
self.files = dict()
tmpDir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, tmpDir)
with open(os.path.join(tmpDir, 'nupic-default.xml-unittest'), 'w') as fp:
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
fp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/custom_configuration_test.py:68: IOError
______________ tests.unit.nupic.support.custom_configuration_test ______________
self = <tests.unit.nupic.support.custom_configuration_test.ConfigurationCustomTest testMethod=testGetInt>
def setUp(self):
if "NTA_DYNAMIC_CONF_DIR" in os.environ:
# Remove it to make sure our in-proc tests won't accidentally
# mess with actual files
oldNtaDynamicConfDir = os.environ["NTA_DYNAMIC_CONF_DIR"]
del os.environ["NTA_DYNAMIC_CONF_DIR"]
self.addCleanup(os.environ.update,
dict(NTA_DYNAMIC_CONF_DIR=oldNtaDynamicConfDir))
self.files = dict()
tmpDir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, tmpDir)
with open(os.path.join(tmpDir, 'nupic-default.xml-unittest'), 'w') as fp:
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
fp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/custom_configuration_test.py:68: IOError
______________ tests.unit.nupic.support.custom_configuration_test ______________
self = <tests.unit.nupic.support.custom_configuration_test.ConfigurationCustomTest testMethod=testGetIntMissingRaisesKeyError>
def setUp(self):
if "NTA_DYNAMIC_CONF_DIR" in os.environ:
# Remove it to make sure our in-proc tests won't accidentally
# mess with actual files
oldNtaDynamicConfDir = os.environ["NTA_DYNAMIC_CONF_DIR"]
del os.environ["NTA_DYNAMIC_CONF_DIR"]
self.addCleanup(os.environ.update,
dict(NTA_DYNAMIC_CONF_DIR=oldNtaDynamicConfDir))
self.files = dict()
tmpDir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, tmpDir)
with open(os.path.join(tmpDir, 'nupic-default.xml-unittest'), 'w') as fp:
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
fp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/custom_configuration_test.py:68: IOError
______________ tests.unit.nupic.support.custom_configuration_test ______________
self = <tests.unit.nupic.support.custom_configuration_test.ConfigurationCustomTest testMethod=testGetMissingReturnsNone>
def setUp(self):
if "NTA_DYNAMIC_CONF_DIR" in os.environ:
# Remove it to make sure our in-proc tests won't accidentally
# mess with actual files
oldNtaDynamicConfDir = os.environ["NTA_DYNAMIC_CONF_DIR"]
del os.environ["NTA_DYNAMIC_CONF_DIR"]
self.addCleanup(os.environ.update,
dict(NTA_DYNAMIC_CONF_DIR=oldNtaDynamicConfDir))
self.files = dict()
tmpDir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, tmpDir)
with open(os.path.join(tmpDir, 'nupic-default.xml-unittest'), 'w') as fp:
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
fp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/custom_configuration_test.py:68: IOError
______________ tests.unit.nupic.support.custom_configuration_test ______________
self = <tests.unit.nupic.support.custom_configuration_test.ConfigurationCustomTest testMethod=testGetString>
def setUp(self):
if "NTA_DYNAMIC_CONF_DIR" in os.environ:
# Remove it to make sure our in-proc tests won't accidentally
# mess with actual files
oldNtaDynamicConfDir = os.environ["NTA_DYNAMIC_CONF_DIR"]
del os.environ["NTA_DYNAMIC_CONF_DIR"]
self.addCleanup(os.environ.update,
dict(NTA_DYNAMIC_CONF_DIR=oldNtaDynamicConfDir))
self.files = dict()
tmpDir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, tmpDir)
with open(os.path.join(tmpDir, 'nupic-default.xml-unittest'), 'w') as fp:
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
fp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/custom_configuration_test.py:68: IOError
______________ tests.unit.nupic.support.custom_configuration_test ______________
self = <tests.unit.nupic.support.custom_configuration_test.ConfigurationCustomTest testMethod=testGetStringMissingRaisesKeyError>
def setUp(self):
if "NTA_DYNAMIC_CONF_DIR" in os.environ:
# Remove it to make sure our in-proc tests won't accidentally
# mess with actual files
oldNtaDynamicConfDir = os.environ["NTA_DYNAMIC_CONF_DIR"]
del os.environ["NTA_DYNAMIC_CONF_DIR"]
self.addCleanup(os.environ.update,
dict(NTA_DYNAMIC_CONF_DIR=oldNtaDynamicConfDir))
self.files = dict()
tmpDir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, tmpDir)
with open(os.path.join(tmpDir, 'nupic-default.xml-unittest'), 'w') as fp:
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
fp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/custom_configuration_test.py:68: IOError
______________ tests.unit.nupic.support.custom_configuration_test ______________
self = <tests.unit.nupic.support.custom_configuration_test.ConfigurationCustomTest testMethod=testReadConfigFileEmptyNameAndValue>
def setUp(self):
if "NTA_DYNAMIC_CONF_DIR" in os.environ:
# Remove it to make sure our in-proc tests won't accidentally
# mess with actual files
oldNtaDynamicConfDir = os.environ["NTA_DYNAMIC_CONF_DIR"]
del os.environ["NTA_DYNAMIC_CONF_DIR"]
self.addCleanup(os.environ.update,
dict(NTA_DYNAMIC_CONF_DIR=oldNtaDynamicConfDir))
self.files = dict()
tmpDir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, tmpDir)
with open(os.path.join(tmpDir, 'nupic-default.xml-unittest'), 'w') as fp:
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
fp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/custom_configuration_test.py:68: IOError
______________ tests.unit.nupic.support.custom_configuration_test ______________
self = <tests.unit.nupic.support.custom_configuration_test.ConfigurationCustomTest testMethod=testReadConfigFileEmptyValue>
def setUp(self):
if "NTA_DYNAMIC_CONF_DIR" in os.environ:
# Remove it to make sure our in-proc tests won't accidentally
# mess with actual files
oldNtaDynamicConfDir = os.environ["NTA_DYNAMIC_CONF_DIR"]
del os.environ["NTA_DYNAMIC_CONF_DIR"]
self.addCleanup(os.environ.update,
dict(NTA_DYNAMIC_CONF_DIR=oldNtaDynamicConfDir))
self.files = dict()
tmpDir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, tmpDir)
with open(os.path.join(tmpDir, 'nupic-default.xml-unittest'), 'w') as fp:
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
fp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/custom_configuration_test.py:68: IOError
______________ tests.unit.nupic.support.custom_configuration_test ______________
self = <tests.unit.nupic.support.custom_configuration_test.ConfigurationCustomTest testMethod=testReadConfigFileEnvironmentOverride>
def setUp(self):
if "NTA_DYNAMIC_CONF_DIR" in os.environ:
# Remove it to make sure our in-proc tests won't accidentally
# mess with actual files
oldNtaDynamicConfDir = os.environ["NTA_DYNAMIC_CONF_DIR"]
del os.environ["NTA_DYNAMIC_CONF_DIR"]
self.addCleanup(os.environ.update,
dict(NTA_DYNAMIC_CONF_DIR=oldNtaDynamicConfDir))
self.files = dict()
tmpDir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, tmpDir)
with open(os.path.join(tmpDir, 'nupic-default.xml-unittest'), 'w') as fp:
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
fp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/custom_configuration_test.py:68: IOError
______________ tests.unit.nupic.support.custom_configuration_test ______________
self = <tests.unit.nupic.support.custom_configuration_test.ConfigurationCustomTest testMethod=testReadConfigFileFromPath>
def setUp(self):
if "NTA_DYNAMIC_CONF_DIR" in os.environ:
# Remove it to make sure our in-proc tests won't accidentally
# mess with actual files
oldNtaDynamicConfDir = os.environ["NTA_DYNAMIC_CONF_DIR"]
del os.environ["NTA_DYNAMIC_CONF_DIR"]
self.addCleanup(os.environ.update,
dict(NTA_DYNAMIC_CONF_DIR=oldNtaDynamicConfDir))
self.files = dict()
tmpDir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, tmpDir)
with open(os.path.join(tmpDir, 'nupic-default.xml-unittest'), 'w') as fp:
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
fp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/custom_configuration_test.py:68: IOError
______________ tests.unit.nupic.support.custom_configuration_test ______________
self = <tests.unit.nupic.support.custom_configuration_test.ConfigurationCustomTest testMethod=testReadConfigFileMalformedEnvReference>
def setUp(self):
if "NTA_DYNAMIC_CONF_DIR" in os.environ:
# Remove it to make sure our in-proc tests won't accidentally
# mess with actual files
oldNtaDynamicConfDir = os.environ["NTA_DYNAMIC_CONF_DIR"]
del os.environ["NTA_DYNAMIC_CONF_DIR"]
self.addCleanup(os.environ.update,
dict(NTA_DYNAMIC_CONF_DIR=oldNtaDynamicConfDir))
self.files = dict()
tmpDir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, tmpDir)
with open(os.path.join(tmpDir, 'nupic-default.xml-unittest'), 'w') as fp:
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
fp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/custom_configuration_test.py:68: IOError
______________ tests.unit.nupic.support.custom_configuration_test ______________
self = <tests.unit.nupic.support.custom_configuration_test.ConfigurationCustomTest testMethod=testReadConfigFileMissingDocumentRoot>
def setUp(self):
if "NTA_DYNAMIC_CONF_DIR" in os.environ:
# Remove it to make sure our in-proc tests won't accidentally
# mess with actual files
oldNtaDynamicConfDir = os.environ["NTA_DYNAMIC_CONF_DIR"]
del os.environ["NTA_DYNAMIC_CONF_DIR"]
self.addCleanup(os.environ.update,
dict(NTA_DYNAMIC_CONF_DIR=oldNtaDynamicConfDir))
self.files = dict()
tmpDir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, tmpDir)
with open(os.path.join(tmpDir, 'nupic-default.xml-unittest'), 'w') as fp:
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
fp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/custom_configuration_test.py:68: IOError
______________ tests.unit.nupic.support.custom_configuration_test ______________
self = <tests.unit.nupic.support.custom_configuration_test.ConfigurationCustomTest testMethod=testReadConfigFileMissingEnvVars>
def setUp(self):
if "NTA_DYNAMIC_CONF_DIR" in os.environ:
# Remove it to make sure our in-proc tests won't accidentally
# mess with actual files
oldNtaDynamicConfDir = os.environ["NTA_DYNAMIC_CONF_DIR"]
del os.environ["NTA_DYNAMIC_CONF_DIR"]
self.addCleanup(os.environ.update,
dict(NTA_DYNAMIC_CONF_DIR=oldNtaDynamicConfDir))
self.files = dict()
tmpDir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, tmpDir)
with open(os.path.join(tmpDir, 'nupic-default.xml-unittest'), 'w') as fp:
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
fp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/custom_configuration_test.py:68: IOError
______________ tests.unit.nupic.support.custom_configuration_test ______________
self = <tests.unit.nupic.support.custom_configuration_test.ConfigurationCustomTest testMethod=testReadConfigFileMissingNonPropertyConfigurationChildren>
def setUp(self):
if "NTA_DYNAMIC_CONF_DIR" in os.environ:
# Remove it to make sure our in-proc tests won't accidentally
# mess with actual files
oldNtaDynamicConfDir = os.environ["NTA_DYNAMIC_CONF_DIR"]
del os.environ["NTA_DYNAMIC_CONF_DIR"]
self.addCleanup(os.environ.update,
dict(NTA_DYNAMIC_CONF_DIR=oldNtaDynamicConfDir))
self.files = dict()
tmpDir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, tmpDir)
with open(os.path.join(tmpDir, 'nupic-default.xml-unittest'), 'w') as fp:
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
fp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/custom_configuration_test.py:68: IOError
______________ tests.unit.nupic.support.custom_configuration_test ______________
self = <tests.unit.nupic.support.custom_configuration_test.ConfigurationCustomTest testMethod=testReadConfigFileUnexpectedElementAtRoot>
def setUp(self):
if "NTA_DYNAMIC_CONF_DIR" in os.environ:
# Remove it to make sure our in-proc tests won't accidentally
# mess with actual files
oldNtaDynamicConfDir = os.environ["NTA_DYNAMIC_CONF_DIR"]
del os.environ["NTA_DYNAMIC_CONF_DIR"]
self.addCleanup(os.environ.update,
dict(NTA_DYNAMIC_CONF_DIR=oldNtaDynamicConfDir))
self.files = dict()
tmpDir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, tmpDir)
with open(os.path.join(tmpDir, 'nupic-default.xml-unittest'), 'w') as fp:
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
fp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/custom_configuration_test.py:68: IOError
______________ tests.unit.nupic.support.custom_configuration_test ______________
self = <tests.unit.nupic.support.custom_configuration_test.ConfigurationCustomTest testMethod=testSetAndGet>
def setUp(self):
if "NTA_DYNAMIC_CONF_DIR" in os.environ:
# Remove it to make sure our in-proc tests won't accidentally
# mess with actual files
oldNtaDynamicConfDir = os.environ["NTA_DYNAMIC_CONF_DIR"]
del os.environ["NTA_DYNAMIC_CONF_DIR"]
self.addCleanup(os.environ.update,
dict(NTA_DYNAMIC_CONF_DIR=oldNtaDynamicConfDir))
self.files = dict()
tmpDir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, tmpDir)
with open(os.path.join(tmpDir, 'nupic-default.xml-unittest'), 'w') as fp:
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
fp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/custom_configuration_test.py:68: IOError
___ ConfigurationCustomTest.testSetConfigPathsForNoneWithNTA_CONF_PATHInEnv ____
self = <tests.unit.nupic.support.custom_configuration_test.ConfigurationCustomTest testMethod=testSetConfigPathsForNoneWithNTA_CONF_PATHInEnv>
def setUp(self):
if "NTA_DYNAMIC_CONF_DIR" in os.environ:
# Remove it to make sure our in-proc tests won't accidentally
# mess with actual files
oldNtaDynamicConfDir = os.environ["NTA_DYNAMIC_CONF_DIR"]
del os.environ["NTA_DYNAMIC_CONF_DIR"]
self.addCleanup(os.environ.update,
dict(NTA_DYNAMIC_CONF_DIR=oldNtaDynamicConfDir))
self.files = dict()
tmpDir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, tmpDir)
with open(os.path.join(tmpDir, 'nupic-default.xml-unittest'), 'w') as fp:
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
fp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/custom_configuration_test.py:68: IOError
______________ tests.unit.nupic.support.custom_configuration_test ______________
self = <tests.unit.nupic.support.custom_configuration_test.ConfigurationCustomTest testMethod=testSetCustomProperties>
def setUp(self):
if "NTA_DYNAMIC_CONF_DIR" in os.environ:
# Remove it to make sure our in-proc tests won't accidentally
# mess with actual files
oldNtaDynamicConfDir = os.environ["NTA_DYNAMIC_CONF_DIR"]
del os.environ["NTA_DYNAMIC_CONF_DIR"]
self.addCleanup(os.environ.update,
dict(NTA_DYNAMIC_CONF_DIR=oldNtaDynamicConfDir))
self.files = dict()
tmpDir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, tmpDir)
with open(os.path.join(tmpDir, 'nupic-default.xml-unittest'), 'w') as fp:
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
fp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/custom_configuration_test.py:68: IOError
______________ tests.unit.nupic.support.custom_configuration_test ______________
self = <tests.unit.nupic.support.custom_configuration_test.ConfigurationCustomTest testMethod=testSetCustomProperty>
def setUp(self):
if "NTA_DYNAMIC_CONF_DIR" in os.environ:
# Remove it to make sure our in-proc tests won't accidentally
# mess with actual files
oldNtaDynamicConfDir = os.environ["NTA_DYNAMIC_CONF_DIR"]
del os.environ["NTA_DYNAMIC_CONF_DIR"]
self.addCleanup(os.environ.update,
dict(NTA_DYNAMIC_CONF_DIR=oldNtaDynamicConfDir))
self.files = dict()
tmpDir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, tmpDir)
with open(os.path.join(tmpDir, 'nupic-default.xml-unittest'), 'w') as fp:
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
fp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/custom_configuration_test.py:68: IOError
______________ tests.unit.nupic.support.custom_configuration_test ______________
self = <tests.unit.nupic.support.custom_configuration_test.ConfigurationCustomTest testMethod=testSetInvalidFile>
def setUp(self):
if "NTA_DYNAMIC_CONF_DIR" in os.environ:
# Remove it to make sure our in-proc tests won't accidentally
# mess with actual files
oldNtaDynamicConfDir = os.environ["NTA_DYNAMIC_CONF_DIR"]
del os.environ["NTA_DYNAMIC_CONF_DIR"]
self.addCleanup(os.environ.update,
dict(NTA_DYNAMIC_CONF_DIR=oldNtaDynamicConfDir))
self.files = dict()
tmpDir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, tmpDir)
with open(os.path.join(tmpDir, 'nupic-default.xml-unittest'), 'w') as fp:
> with open(resource_filename(__name__, 'conf/nupic-default.xml')) as inp:
fp.write(inp.read())
E IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/conf/nupic-default.xml'
/usr/local/lib/python2.7/dist-packages/tests/unit/nupic/support/custom_configuration_test.py:68: IOError
========= 100 failed, 673 passed, 17 skipped, 1 error in 34.33 seconds =========
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment