Package jsondata
[hide private]
[frames] | no frames]

Package jsondata

source code

Modular processing of JSON data by trees and branches, pointers and patches.


Version: 0.2.21

Author: Arno-Can Uestuensoez

Copyright: Copyright (C) 2015-2016 Arno-Can Uestuensoez @Ingenieurbuero Arno-Can Uestuensoez

License: Artistic-License-2.0 + Forced-Fairplay-Constraints

Submodules [hide private]

Classes [hide private]
  JSONDataError
base Exception.
  JSONDataIndexError
Error on key.
  JSONDataKeyError
Error on key.
  JSONDataPathError
Error on key.
  JSONDataNodeError
Error on node, slightly different from key.
  JSONDataNodeTypeError
Error on NodeTypes.
  JSONDataParameterError
Erroneous parameters.
  JSONDataSourceFileError
Error on read of a source file.
  JSONDataModeError
Type error of source file content.
  JSONDataTargetFileError
Error on writing a file.
  JSONDataValueError
Error on a value.
  JSONDataAmbiguityError
Error ambiguity of provided parameters.
  JSONPointerError
Pointer error.
  JSONPointerTypeError
Pointer type error, the JSON pointer syntax does not represent a valid pointer.
  JSONTypeError
Pointer error.
  JSONDiffError
Error in JSONDiff.
  JSONSearchError
Error in JSONSearch.
  JSONDataPatchError
  JSONDataPatchItemError
Variables [hide private]
  __maintainer__ = 'Arno-Can Uestuensoez'
  __uuid__ = '63b597d6-4ada-4880-9f99-f5e0961351fb'
  appname = 'jsondata'
  _interactive = False
  V3K = False
Python3.5+
  ISSTR = (<type 'str'>, <type 'unicode'>)
string and unicode
  MJ_RFC4627 = 1
The first JSON RFC.
  MJ_RFC7493 = 2
The IJSON RFC.
  MJ_RFC7159 = 2
The JSON RFC by 'now'.
  MJ_RFC8259 = 4
The JSON RFC by 'now'.
  MJ_ECMA404 = 16
The first JSON EMCMA standard.
  MJ_RFC6901 = 32
JSONPointer first IETF RFC.
  MJ_RELPOINTERD1 = 64
JSONPointer - relative pointer Draft-1.
  MJ_RFC6902 = 128
JSONPatch first IETF RFC.
  MJ_DEFAULT = 2
  MS_OFF = 40
No validation.
  MS_DRAFT3 = 43
The first supported JSONSchema IETF-Draft.
  MS_DRAFT4 = 44
The current supported JSONSchema IETF-Draft.
  MS_ON = 44
The current when the default is activated.
  MODE_SCHEMA_DEFAULT = 40
The current default validation mode.
  str2mj = {1: 1, 2: 2, 16: 16, 32: 32, 40: 40, 128: 128, '1': 1...
  mj2str = {1: 'rfc4627', 2: 'rfc7159', 4: 'rfc8259', 16: 'ecma4...
  MATCH_INSERT = 0
for dicts
  MATCH_NO = 1
negates the whole set
  MATCH_KEY = 2
for dicts
  MATCH_CHLDATTR = 3
for dicts and lists
  MATCH_INDEX = 4
for lists
  MATCH_MEM = 5
for dicts(value) and lists
  MATCH_NEW = 6
If not present create a new, else ignore and keep present untouched.
  MATCH_PRESENT = 7
Check all are present, else fails.
  B_ALL = 0
OP-On-Branches: process in any case.
  B_AND = 1
OP-On-Branches: process only when both present.
  B_OR = 2
OP-On-Branches: process if one at all is present.
  B_XOR = 4
OP-On-Branches: process if only one is present.
  B_ADD = 8
OP-On-Branches: add in accordance to RFC6902
  B_MOD = 16
OP-On-Branches: modulo of branches.
  B_SUB = 32
OP-On-Branches: subtract branches.
  C_REF = 0
OP-Copy: Copy reference.
  C_DEEP = 1
OP-Copy: Copy deep.
  C_SHALLOW = 2
OP-Copy: Copy shallow.
  C_DEFAULT = 0
Default value.
  SC_DATA = 0
OP-Scope: the managed JSON data only
  SC_SCHEMA = 1
OP-Scope: the managed JSON schema only
  SC_JSON = 2
OP-Scope: the managed JSON data and schema only.
  SC_OBJ = 3
OP-Scope: the attributes of current instance.
  SC_ALL = 4
OP-Scope: the complete object, including data.
  SD_BOTH = 0
Apply on mixed input and output data.
  SD_INPUT = 1
Apply on input data.
  SD_OUTPUT = 2
Apply on output data.
  S_NONE = 0
  S_SIMPLE = 1
  R_OBJ = 0
Return object of type self.
  R_DATA = 1
Return self.data.
  R_JDATA = 2
Return object of type JSONData.
  RT_STR = 1
string - 'str' or 'unicode'
  RT_DICT = 2
dict
  RT_LST = 4
list
  RT_JSONPOINTER = 8
JSONPointer
  RT_JSONPATCH = 16
JSONPatch
  RT_JSONDATA = 32
JSONData
  RT_DEFAULT = 8
default
  rtypes2num = {None: 8, 1: 1, 2: 2, 4: 4, 8: 8, 16: 16, 32: 32,...
  M_FIRST = 1
First match only.
  M_LAST = 2
Last match only.
  M_ALL = 4
All matches.
  V_NONE = 1
no checks at all
  V_FINAL = 2
checks final result only
  V_STEPS = 4
checks each intermediate directory
  V_DEFAULT = 1
default
  verify2num = {None: 1, 1: 1, 2: 2, 4: 4, 'V_DEFAULT': 1, 'V_FI...
  DF_SUMUP = 0
  DF_CSV = 1
  DF_JSON = 3
  DF_TABLE = 4
  DF_REVIEW = 5
  DF_REPR = 6
  DF_STR = 7
  str2df = {0: 0, 1: 1, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, '0': 0, '1...
  df2str = {0: 'sumup', 1: 'csv', 3: 'json', 4: 'tabble', 5: 're...
  PJ_TREE = 0
tree view JSON syntax
  PJ_FLAT = 1
flat print JSON syntax
  PJ_PYTREE = 2
tree view Python syntax
  PJ_PYFLAT = 3
flat print Python syntax
  PJ_REPR = 4
repr() - raw string, Python syntax
  PJ_STR = 5
str() - formatted string, Python syntax
  str2pj = {0: 0, 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, '0': 0, '1': 1, ...
  pj2str = {0: 'tree', 1: 'flat', 2: 'pytree', 3: 'pyflat', 4: '...
  NOTATION_NATIVE = 0
JSON notation in accordance to RFC7159
  NOTATION_JSON = 1
JSON notation in accordance to RFC7159
  NOTATION_JSON_REL = 2
JSON notation as relative pointer
  NOTATION_HTTP_FRAGMENT = 3
JSON notation in accordance to RFC7159 with RFC3986.
  CHARS_RAW = 0
display character set as raw
  CHARS_STR = 1
display character set as str
  CHARS_UTF = 2
display character set as utf
  LINE_CUT = 0
force line fit
  LINE_WRAP = 1
wrap line in order to fit to length
  SEARCH_FIRST = 0
Break display after first match.
  SEARCH_ALL = 1
List all matches.
  PT_PATH = 0
Displays a list of items.
  PT_RFC6901 = 1
Displays rfc6901 strings.
  PT_NODE = 2
Displays the node.
  JSYN_NATIVE = 1
Literally in accordance to standards.
  JSYN_PYTHON = 2
Python in-memory syntax representation.
  match2match = {1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 'chil...
  mode2mj = {1: 1, 2: 2, 4: 4, 16: 4, 'default': 2, 'ecma404': 4...
  validator2ms = {40: 40, 43: 43, 44: 44, 'default': 44, 'draft3...
  copy2c = {0: 0, 1: 1, 2: 2, 'deep': 1, 'default': 0, 'ref': 0,...
  consolewidth = 80
  _verbose = 0
  _debug = 0
  __package__ = 'jsondata'
Variables Details [hide private]

str2mj

Value:
{1: 1,
 2: 2,
 16: 16,
 32: 32,
 40: 40,
 128: 128,
 '1': 1,
 '128': 128,
...

mj2str

Value:
{1: 'rfc4627',
 2: 'rfc7159',
 4: 'rfc8259',
 16: 'ecma404',
 32: 'rfc6901',
 40: 'off',
 64: 'relpointerD1',
 128: 'rfc6902'}

rtypes2num

Value:
{None: 8,
 1: 1,
 2: 2,
 4: 4,
 8: 8,
 16: 16,
 32: 32,
 'RT_DICT': 2,
...

verify2num

Value:
{None: 1,
 1: 1,
 2: 2,
 4: 4,
 'V_DEFAULT': 1,
 'V_FINAL': 2,
 'V_NONE': 1,
 'V_STEPS': 4,
...

str2df

Value:
{0: 0,
 1: 1,
 3: 3,
 4: 4,
 5: 5,
 6: 6,
 7: 7,
 '0': 0,
...

df2str

Value:
{0: 'sumup',
 1: 'csv',
 3: 'json',
 4: 'tabble',
 5: 'review',
 6: 'repr',
 7: 'str'}

str2pj

Value:
{0: 0,
 1: 1,
 2: 2,
 3: 3,
 4: 4,
 5: 5,
 '0': 0,
 '1': 1,
...

pj2str

Value:
{0: 'tree', 1: 'flat', 2: 'pytree', 3: 'pyflat', 4: 'repr', 5: 'str'}

match2match

Value:
{1: 1,
 2: 2,
 3: 3,
 4: 4,
 5: 5,
 6: 6,
 7: 7,
 'child_attr_list': 3,
...

mode2mj

Value:
{1: 1,
 2: 2,
 4: 4,
 16: 4,
 'default': 2,
 'ecma404': 4,
 'rfc4627': 1,
 'rfc7159': 2,
...

validator2ms

Value:
{40: 40, 43: 43, 44: 44, 'default': 44, 'draft3': 43, 'off': 40}

copy2c

Value:
{0: 0, 1: 1, 2: 2, 'deep': 1, 'default': 0, 'ref': 0, 'shallow': 2}