import numpy as np
from IPython.parallel import Client
from distarray.client import DistArrayContext
from distarray import odin

import unittest


c = Client()
dv = c[:]
dac = DistArrayContext(dv)


@odin.local(dac)
def localsin(da):
    return np.sin(da)


@odin.local(dac)
def localadd50(da):
    return da + 50


@odin.local(dac)
def localsum(da):
    return np.sum(da)


class TestLocal(unittest.TestCase):

    def setUp(self):
        dv.execute('import numpy as np')
        self.da = dac.empty((1024, 1024))
        self.da.fill(2 * np.pi)

    def test_localsin(self):
        db = localsin(self.da)

    def test_localadd(self):
        dc = localadd50(self.da)

    def test_localsum(self):
        dd = localsum(self.da)
        #assert_allclose(db, 0)


if __name__ == '__main__':
    unittest.main()

import numpy as np
from IPython.parallel import Client
from distarray.client import DistArrayContext
from distarray import odin

import unittest


c = Client()
dv = c[:]
dac = DistArrayContext(dv)


@odin.local(dac)
def local_sin(da):
    return np.sin(da)


@odin.local(dac)
def local_add50(da):
    return da + 50


@odin.local(dac)
def local_sum(da):
    return np.sum(da)


class TestLocal(unittest.TestCase):

    def setUp(self):
        dv.execute('import numpy as np')
        self.da = dac.empty((1024, 1024))
        self.da.fill(2 * np.pi)

    def test_local_sin(self):
        db = local_sin(self.da)

    def test_local_add(self):
        dc = local_add50(self.da)

    def test_local_sum(self):
        dd = local_sum(self.da)


if __name__ == '__main__':
    unittest.main()

Refactor names a bit for PEP8.
Refactor names a bit for PEP8.
  import numpy as np
  from IPython.parallel import Client
  from distarray.client import DistArrayContext
  from distarray import odin
  
  import unittest
  
  
  c = Client()
  dv = c[:]
  dac = DistArrayContext(dv)
  
  
  @odin.local(dac)
- def localsin(da):
+ def local_sin(da):
      return np.sin(da)
  
  
  @odin.local(dac)
- def localadd50(da):
+ def local_add50(da):
      return da + 50
  
  
  @odin.local(dac)
- def localsum(da):
+ def local_sum(da):
      return np.sum(da)
  
  
  class TestLocal(unittest.TestCase):
  
      def setUp(self):
          dv.execute('import numpy as np')
          self.da = dac.empty((1024, 1024))
          self.da.fill(2 * np.pi)
  
-     def test_localsin(self):
+     def test_local_sin(self):
-         db = localsin(self.da)
+         db = local_sin(self.da)
  
-     def test_localadd(self):
+     def test_local_add(self):
-         dc = localadd50(self.da)
+         dc = local_add50(self.da)
  
-     def test_localsum(self):
+     def test_local_sum(self):
-         dd = localsum(self.da)
+         dd = local_sum(self.da)
-         #assert_allclose(db, 0)
  
  
  if __name__ == '__main__':
      unittest.main()
  
Refactor names a bit for PEP8.
## Code Before:
import numpy as np
from IPython.parallel import Client
from distarray.client import DistArrayContext
from distarray import odin

import unittest


c = Client()
dv = c[:]
dac = DistArrayContext(dv)


@odin.local(dac)
def localsin(da):
    return np.sin(da)


@odin.local(dac)
def localadd50(da):
    return da + 50


@odin.local(dac)
def localsum(da):
    return np.sum(da)


class TestLocal(unittest.TestCase):

    def setUp(self):
        dv.execute('import numpy as np')
        self.da = dac.empty((1024, 1024))
        self.da.fill(2 * np.pi)

    def test_localsin(self):
        db = localsin(self.da)

    def test_localadd(self):
        dc = localadd50(self.da)

    def test_localsum(self):
        dd = localsum(self.da)
        #assert_allclose(db, 0)


if __name__ == '__main__':
    unittest.main()

## Instruction:
Refactor names a bit for PEP8.
## Code After:
import numpy as np
from IPython.parallel import Client
from distarray.client import DistArrayContext
from distarray import odin

import unittest


c = Client()
dv = c[:]
dac = DistArrayContext(dv)


@odin.local(dac)
def local_sin(da):
    return np.sin(da)


@odin.local(dac)
def local_add50(da):
    return da + 50


@odin.local(dac)
def local_sum(da):
    return np.sum(da)


class TestLocal(unittest.TestCase):

    def setUp(self):
        dv.execute('import numpy as np')
        self.da = dac.empty((1024, 1024))
        self.da.fill(2 * np.pi)

    def test_local_sin(self):
        db = local_sin(self.da)

    def test_local_add(self):
        dc = local_add50(self.da)

    def test_local_sum(self):
        dd = local_sum(self.da)


if __name__ == '__main__':
    unittest.main()
