urclib.fuzzylogic.settings
Classes for loading and saving FuzzyLogic classes to JSON files.
- Authors:
Patrick Wingo
Version: 0.1
Module Contents
Classes
Class for encoding GeomUtils and FuzzyLogic types. |
|
Class for decoding GeomUtils and FuzzyLogic types. |
Functions
|
Save a FuzzyLogicSet object to disk. |
|
Load a FuzzyLogicSet object from disk. |
- class urclib.fuzzylogic.settings.FLEncoder(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)
Bases:
json.JSONEncoderClass for encoding GeomUtils and FuzzyLogic types.
- default(o)
json.JSONEncoder overload.
- Parameters:
o (object) – See json.JSONEncoder documentation.
- Returns:
See json.JSONEncoder documentation.
- Return type:
object
- static _serialize_pt2d(o)
Serialize Pt2D objects.
- Parameters:
o (components.fuzzylogic.geomutils.Pt2D) – The Pt2D object to serialize.
- Returns:
Objects to be encoded as JSON.
- Return type:
dict
- static _serialize_segment(o)
Serialize BaseSegment-subclass objects.
- Parameters:
o (components.fuzzylogic.geomutils.BaseSegments) – The BaseSegment-subclass object to serialize.
- Returns:
Objects to be encoded as JSON.
- Return type:
dict
- static _serialize_fuzzyvalue(o)
Serialize FuzzyValue objects.
- Parameters:
o (components.fuzzylogic.fuzzylogic.FuzzyValue) – The FuzzyValue object to serialize.
- Returns:
Objects to be encoded as JSON.
- Return type:
dict
- static _serialize_piecewise_curve(o)
Serialize FuzzyCurve objects.
- Parameters:
o (components.fuzzylogic.fuzzyCurves.PiecewiseCurve) – The PiecewiseCurve object to serialize.
- Returns:
Objects to be encoded as JSON.
- Return type:
dict
- static _serialize_template_curve(o)
Serialize FuzzyCurve objects.
- Parameters:
o (components.fuzzylogic.fuzzyCurves.FuzzyCurve) – The FuzzyCurve subclass object to serialize.
- Returns:
Objects to be encoded as JSON.
- Return type:
dict
- static _serialize_fuzzyrule(o)
Serialize FuzzyRule objects.
- Parameters:
o (components.fuzzylogic.fuzzylogic.FuzzyRule) – The FuzzyRule object to serialize.
- Returns:
Objects to be encoded as JSON.
- Return type:
dict
- static _serialize_fuzzyinput(o)
Serialize FuzzyInput objects.
- Parameters:
o (components.fuzzylogic.fuzzylogic.FuzzyInput) – The FuzzyInput object to serialize.
- Returns:
Objects to be encoded as JSON.
- Return type:
dict
- static _serialize_fuzzyimplication(o)
Serialize FuzzyImplication objects.
- Parameters:
o (components.fuzzylogic.fuzzylogic.FuzzyImplication) – The FuzzyImplication object to serialize.
- Returns:
Objects to be encoded as JSON.
- Return type:
dict
- static _serialize_fuzzylogicset(o)
Serialize FuzzyLogicSet objects.
- Parameters:
o (components.fuzzylogic.fuzzylogic.FuzzyLogicSet) – The FuzzyLogicSet object to serialize.
- Returns:
Objects to be encoded as JSON.
- Return type:
dict
- class urclib.fuzzylogic.settings.FLDecoder(*args, **kwargs)
Bases:
json.JSONDecoderClass for decoding GeomUtils and FuzzyLogic types.
- Parameters:
*args – Variable-length arguments passed to the parent constructor.
**kwargs – Keyword arguments passed to the parent constructor.
- static _dict_to_pt2d(d)
Decode a Pt2D object from a dictonary.
- Parameters:
d (dict) – Description of the Pt2D object.
- Returns:
A newly constructed Pt2D object, or None if d is None.
- Return type:
components.fuzzylogic.geomutils.Pt2D
- static _dict_to_segment(d)
Decode a BaseSegment-subclass object from a dictonary.
- Parameters:
d (dict) – Description of the BaseSegment-subclass object.
- Returns:
- A newly constructed BaseSegment-subclass object, or
None if d is None.
- Return type:
components.fuzzylogic.geomutils.BaseSegment
- static _dict_to_fuzzyvalue(d)
Decode a FuzzyValue object from a dictonary.
- Parameters:
d (dict) – Description of the FuzzyValue object.
- Returns:
A newly constructed FuzzyValue object, or None if d is None.
- Return type:
components.fuzzylogic.fuzzylogic.FuzzyValue
- static _dict_to_piecewise_curve(d)
Decode a PiecewiseCurve object from a dictonary.
- Parameters:
d (dict) – Description of the FuzzyCurve object.
- Returns:
A newly constructed FuzzyCurve object, or None if d is None.
- Return type:
components.fuzzylogic.fuzzylogic.PiecewiseCurve
- static _dict_to_template_curve(tstr, d)
Decode a FuzzyCurve object from a dictonary.
- Parameters:
d (dict) – Description of the FuzzyCurve object.
- Returns:
A newly constructed FuzzyCurve subclass object, or None if d is None.
- Return type:
components.fuzzylogic.fuzzylogic.FuzzyCurve
- static _dict_to_fuzzyrule(d)
Decode a FuzzyRule object from a dictonary.
- Parameters:
d (dict) – Description of the FuzzyRule object.
- Returns:
A newly constructed FuzzyRule object, or None if d is None.
- Return type:
components.fuzzylogic.fuzzylogic.FuzzyRule
- static _dict_to_fuzzyinput(d)
Decode a FuzzyInput object from a dictonary.
- Parameters:
d (dict) – Description of the FuzzyInput object.
- Returns:
A newly constructed FuzzyInput object, or None if d is None.
- Return type:
components.fuzzylogic.fuzzylogic.FuzzyInput
- static _dict_to_fuzzyimplication(d)
Decode a FuzzyImplication object from a dictonary.
- Parameters:
d (dict) – Description of the FuzzyImplication object.
- Returns:
- A newly constructed FuzzyImplication object, or
None if d is None.
- Return type:
components.fuzzylogic.fuzzylogic.FuzzyImplication
- static _dict_to_fuzzylogicset(d)
Decode a FuzzyLogicSet object from a dictonary.
- Parameters:
d (dict) – Description of the FuzzyLogicSet object.
- Returns:
- A newly constructed FuzzyLogicSet object, or
None if d is None.
- Return type:
components.fuzzylogic.fuzzylogic.FuzzyLogicSet
- object_hook(indict)
json.JSONDecoder overload.
- Parameters:
indict (dict) – See json.JSONDecoder documentation.
- Returns:
See json.JSONDecoder documentation.
- Return type:
object
- urclib.fuzzylogic.settings.save_settings(fset, path)
Save a FuzzyLogicSet object to disk.
- Parameters:
fset (components.fuzzylogic.fuzzylogic.FuzzyLogicSet) – The FuzzyLogicSet object to save.
path (str) – Path to the file to write.
- urclib.fuzzylogic.settings.load_settings(path)
Load a FuzzyLogicSet object from disk.
- Parameters:
path (str) – Path to the file to load.
- Returns:
A FuzzyLogicSet object populated with the contents of the file.
- Return type:
components.fuzzylogic.fuzzylogic.FuzzyLogicSet