Add pre-commit support for sanity checks

Use pre-commit framework [1] to run black and flake8 before the commit.
black and flake8 are managed by the pre-commit framework and they can be
run manually by the user using `pre-commit run` command.

Fix the code base with the help of black and flake8.
Fix import statements according to PEP8 guidelines [1]
Both tools have the following settings (specified in the pre-commit
configuration file):
* line length: 120 characters
* directory to exclude: ethosu/vela/tflite/ and ethosu/vela/ethos_u55_regs

Updated README.md on how to install pre-commit and how to run sanity checks.
Pipenv files have been updated including new dependencies for pre-commit.

[1]: https://www.python.org/dev/peps/pep-0008/#imports
[2]: https://github.com/pre-commit/pre-commit

Change-Id: I304d9fffdf019d390ffa396a529c8a7c2437f63d
Signed-off-by: Diego Russo <diego.russo@arm.com>
diff --git a/ethosu/vela/driver_actions.py b/ethosu/vela/driver_actions.py
index 86c4a36..bd15af2 100644
--- a/ethosu/vela/driver_actions.py
+++ b/ethosu/vela/driver_actions.py
@@ -18,9 +18,11 @@
 # Description:
 # Creates driver actions that are embedded in the custom operator payload.
 
-import numpy as np
 from typing import List
-from .ethos_u55_regs.ethos_u55_regs import *
+
+import numpy as np
+
+from .ethos_u55_regs.ethos_u55_regs import config_r, id_r, ARCH_VER
 
 
 class DACommands:
@@ -43,8 +45,8 @@
 
 
 def emit_fourcc(data: List[int], fourcc: str):
-    assert data != None
-    assert fourcc != None
+    assert data is not None
+    assert fourcc is not None
     assert len(fourcc) == 4
     value: int = 0
     value = fourcc[0].encode()[0]
@@ -75,14 +77,14 @@
 
 
 def emit_config(data: List[int], rel: int, patch: int, arch):
-    assert data != None
+    assert data is not None
     data.append(make_da_tag(DACommands.Config, 0, (patch << DACommands.Config_PatchShift) | rel))
     data.append(build_config_word(arch))
     data.append(build_id_word())
 
 
 def emit_cmd_stream_header(data: List[int], length: int):
-    assert data != None
+    assert data is not None
     # Insert NOPs to align start of command stream to 16 bytes
     num_nops = 4 - ((len(data) + 1) % 4)
     for _ in range(num_nops):
@@ -95,7 +97,7 @@
 
 
 def emit_reg_read(data: List[int], reg_index: int, reg_count: int = 1):
-    assert data != None
+    assert data is not None
     assert reg_index >= 0
     assert reg_count >= 1
     payload: int = (reg_index & DACommands.ReadAPB_IndexMask) | ((reg_count << DACommands.ReadAPB_CountShift) - 1)
@@ -103,5 +105,5 @@
 
 
 def emit_dump_shram(data: List[int]):
-    assert data != None
+    assert data is not None
     data.append(make_da_tag(DACommands.DumpSHRAM, 0, 0))