コード例 #1
0
ファイル: __init__.py プロジェクト: jubbynox/googlegadets
def decode(string):
    """Converts the JSON string into a Python object.
    
    >>> str(decode('"my string"'))
    'my string'
    >>> decode('36')
    36
    """
    j = Unpickler()
    return j.restore(json.decode(string))
コード例 #2
0
ファイル: __init__.py プロジェクト: wolfhesse/saikogallery
def loads(string):
    """Converts the JSON string into a Python object.
    
    >>> loads('"my string"')
    u'my string'
    >>> loads('36')
    36
    """
    j = Unpickler()
    return j.restore(json.loads(string))
コード例 #3
0
 def test_unpickle_dict(self):
     expected = {
         1: {
             "1ID": "A23",
             "Gender": "Male",
             "Age": 22,
             "Sales": 2445,
             "BMI": "normal",
             "salary": 20,
             "Birthday": "24/06/1995"
         },
         2: {
             "IhD": "A2f3",
             "Gender": "Male",
             "Age": 23,
             "Sales": 2565,
             "BMI": "normal",
             "salary": 20,
             "Birthday": "24/06/1995"
         },
         3: {
             "IjD": "Aa23",
             "Gender": "Female",
             "Age": 25,
             "Sales": 25,
             "BMI": "normal",
             "salary": 20,
             "Birthday": "24/06/1995"
         },
         4: {
             "IgD": "A23",
             "Gender": "Female",
             "Age": 26,
             "Sales": 225,
             "BMI": "normal",
             "salary": 20,
             "Birthday": "24/06/1995"
         }
     }
     pickle = Pickler.pickle_dictionary_values(expected)
     self.local.insert_dictionary(pickle)
     result = Unpickler.unpickle_dictionary(self.local.get_db())
     self.assertEqual(expected, result)
コード例 #4
0
ファイル: __init__.py プロジェクト: wolfhesse/saikogallery
def load(file):
    """Converts the JSON string in file into a Python object
    """
    j = Unpickler()
    return j.restore(json.load(file))
コード例 #5
0
 def get_remote(self):
     unpickle = Unpickler.unpickle_dictionary(self.remote.get_db())
     return unpickle
コード例 #6
0
 def get_local(self):
     unpickle = Unpickler.unpickle_dictionary(self.local.get_db())
     return unpickle