Skip to content

Commit

Permalink
Style changes for linting
Browse files Browse the repository at this point in the history
  • Loading branch information
coretl committed Jul 13, 2016
1 parent d80f6f4 commit 0093fff
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 15 deletions.
7 changes: 5 additions & 2 deletions malcolm/core/block.py
Expand Up @@ -7,6 +7,7 @@
from malcolm.core.attribute import Attribute
from malcolm.core.method import Method


class DummyLock(object):

def acquire(self):
Expand All @@ -18,21 +19,23 @@ def release(self):
def __enter__(self):
self.acquire()

def __exit__(self, type, value, traceback):
def __exit__(self, type_, value, traceback):
self.release()
return False


class LockRelease(object):
def __init__(self, lock):
self.lock = lock

def __enter__(self):
self.lock.release()

def __exit__(self, type, value, traceback):
def __exit__(self, type_, value, traceback):
self.lock.acquire()
return False


@Serializable.register_subclass("malcolm:core/Block:1.0")
class Block(Notifier):
"""Object consisting of a number of Attributes and Methods"""
Expand Down
6 changes: 3 additions & 3 deletions malcolm/core/controller.py
Expand Up @@ -89,11 +89,11 @@ def transition(self, state, message):

self.status.set_value(message)

for method in self.block._methods.values():
for method in self.block.methods.values():
if method in self.writeable_methods[state]:
self.block._methods[method].set_writeable(True)
self.block.methods[method].set_writeable(True)
else:
self.block._methods[method].set_writeable(False)
self.block.methods[method].set_writeable(False)

self.block.notify_subscribers()

Expand Down
4 changes: 2 additions & 2 deletions malcolm/core/spawnable.py
Expand Up @@ -22,14 +22,14 @@ def start(self, process=None):
if process is None:
process = self.process
self._initialize()
for (func, stop_func) in self._spawn_functions:
for (func, _) in self._spawn_functions:
self._spawned.append(process.spawn(func))

def stop(self):
"""Call registered stop functions"""

self._initialize()
for (func, stop_func) in reversed(self._spawn_functions):
for (_, stop_func) in reversed(self._spawn_functions):
if stop_func is not None:
stop_func()

Expand Down
2 changes: 1 addition & 1 deletion malcolm/wscomms/wsclientcomms.py
Expand Up @@ -58,7 +58,7 @@ def stop_recv_loop(self):
# thread
self.loop.add_callback(self.loop.stop)

def subscribe_server_blocks(self, conn):
def subscribe_server_blocks(self, _):
"""Subscribe to process blocks"""
request = Request.Subscribe(None, None, [".", "blocks", "value"])
request.set_id(self.SERVER_BLOCKS_ID)
Expand Down
5 changes: 0 additions & 5 deletions malcolm/wscomms/wsservercomms.py
@@ -1,8 +1,3 @@
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
import setup_malcolm_paths

from collections import OrderedDict
import json

Expand Down
4 changes: 2 additions & 2 deletions tests/test_core/test_controller.py
Expand Up @@ -26,10 +26,10 @@ class TestController(unittest.TestCase):

def setUp(self):
b = MagicMock()
b._methods.values.return_value = ["say_hello", "say_goodbye"]
b.methods.values.return_value = ["say_hello", "say_goodbye"]
self.m1 = MagicMock()
self.m2 = MagicMock()
b._methods.__getitem__.side_effect = [self.m1, self.m2]
b.methods.__getitem__.side_effect = [self.m1, self.m2]
self.c = DummyController(MagicMock(), b)

def test_init(self):
Expand Down

0 comments on commit 0093fff

Please sign in to comment.