コード例 #1
0
ファイル: mongcon.py プロジェクト: fraser-lowndes/mongcon
def write_empty_schema():
    with open(file_location, 'w') as file:
        file.write(
            json_encode(Connections(servers=[
                Server(uri='mongodb://localhost:27017', label='local')
            ]),
                        unpicklable=False))
        file.flush()
コード例 #2
0
ファイル: writers.py プロジェクト: dilawar/libNeuroML
 def __encode_as_json(cls, neuroml_document):
     neuroml_document = cls.__sanitize_doc(neuroml_document)
     from jsonpickle import encode as json_encode
     try:
         # Enable encoding of numpy arrays with recent jsonpickle versions
         import jsonpickle.ext.numpy as jsonpickle_numpy
         jsonpickle_numpy.register_handlers()
     except ImportError:
         pass  # older version of jsonpickle
     encoded = json_encode(neuroml_document)
     return encoded
コード例 #3
0
	def ship(self, computer_obj):
		try:
			computer_json = json_encode(computer_obj, unpicklable=True)
			payload = {
				'payload': computer_json
			}
			response = http_post(self._server_ship_address, data=payload, timeout=self.timeout)
			if response.status_code == 200:
				pass
			elif response.status_code == 202:
				logger.warning('The server ignored the shipped measurement')
			else:
				logger.warning(
					'Server responded with status code %i and message %s' % (response.status_code, response.text))
		except Exception as ex:
			logger.critical("Cannot ship to the server")
			logger.critical("Exception msg: [%s]" % str(ex))
コード例 #4
0
ファイル: writers.py プロジェクト: neurokernel/libNeuroML
    def __encode_as_json(cls, neuroml_document):
        neuroml_document = cls.__sanitize_doc(neuroml_document)
        from jsonpickle import encode as json_encode

        encoded = json_encode(neuroml_document)
        return encoded
コード例 #5
0
 def __encode_as_json(cls,neuroml_document):
     neuroml_document = cls.__sanitize_doc(neuroml_document)
     from jsonpickle import encode as json_encode
     encoded = json_encode(neuroml_document)
     return encoded
コード例 #6
0
ファイル: writers.py プロジェクト: cuiyi0422/libNeuroML
 def __encode_as_json(cls,neuroml_document):
     neuroml_document = cls.__sanitize_doc(neuroml_document)
     encoded = json_encode(neuroml_document)
     return encoded
コード例 #7
0
 def __encode_as_json(cls, neuroml_document):
     neuroml_document = cls.__sanitize_doc(neuroml_document)
     encoded = json_encode(neuroml_document)
     return encoded