Beispiel #1
0
 def testReuse(self):
     """Verifies that decoding results can be used and re-encoded."""
     input_image = ee.Image(13)
     output = deserializer.fromJSON(serializer.toJSON(input_image))
     self.assertEquals(
         output.addBands(42).serialize(),
         input_image.addBands(42).serialize())
 def testReuse(self):
   """Verifies that decoding results can be used and re-encoded."""
   input_image = ee.Image(13)
   output = deserializer.fromJSON(serializer.toJSON(input_image))
   self.assertEqual(
       output.addBands(42).serialize(),
       input_image.addBands(42).serialize())
 def testCast(self):
     """Verifies that decoding casts the result to the right class."""
     input_image = ee.Image(13).addBands(42)
     output = deserializer.fromJSON(serializer.toJSON(input_image))
     self.assertIsInstance(output, ee.Image)
     cloud_output = deserializer.fromCloudApiJSON(
         serializer.toJSON(input_image, for_cloud_api=True))
     self.assertIsInstance(cloud_output, ee.Image)
    def updateLayers(self):
        layers = QgsProject.instance().mapLayers().values()

        for l in filter(lambda layer: layer.customProperty('ee-layer'),
                        layers):
            ee_script = l.customProperty('ee-script')
            image = deserializer.fromJSON(ee_script)
            utils.update_ee_image_layer(image, l)
Beispiel #5
0
 def MockSend(self, path, params, *args):
     """Overridden to check for profiling-related data."""
     if path == '/value':
         value = deserializer.fromJSON(params['json'])
         hooked = ee.data._thread_locals.profile_hook is not None
         is_get_profiles = (isinstance(value, ComputedObject) and value.func
                            == ApiFunction.lookup('Profile.getProfiles'))
         return 'hooked=%s getProfiles=%s' % (hooked, is_get_profiles)
     else:
         return super(ProfilingTest, self).MockSend(path, params, *args)
Beispiel #6
0
 def MockSend(self, path, params, *args):
   """Overridden to check for profiling-related data."""
   if path == '/value':
     value = deserializer.fromJSON(params['json'])
     hooked = ee.data._profile_hook is not None
     is_get_profiles = (isinstance(value, ComputedObject) and value.func ==
                        ApiFunction.lookup('Profile.getProfiles'))
     return 'hooked=%s getProfiles=%s' % (hooked, is_get_profiles)
   else:
     return super(ProfilingTest, self).MockSend(path, params, *args)
Beispiel #7
0
 def testCast(self):
     """Verifies that decoding casts the result to the right class."""
     input_image = ee.Image(13).addBands(42)
     output = deserializer.fromJSON(serializer.toJSON(input_image))
     self.assertTrue(isinstance(output, ee.Image))
 def testCast(self):
   """Verifies that decoding casts the result to the right class."""
   input_image = ee.Image(13).addBands(42)
   output = deserializer.fromJSON(serializer.toJSON(input_image))
   self.assertTrue(isinstance(output, ee.Image))