Browse Source

[lint] transform list comprehension to dict comprehension, raise NotImplementedError on not implemenetd methods

Maxime Alves LIRMM@home 3 years ago
parent
commit
8b2ca8752a
4 changed files with 13 additions and 4 deletions
  1. 7
    1
      pyheatpump/config.py
  2. 4
    3
      pyheatpump/variable_types.py
  3. 1
    0
      pyheatpump/variable_values.py
  4. 1
    0
      pyheatpump/variables.py

+ 7
- 1
pyheatpump/config.py View File

@@ -82,7 +82,13 @@ mac_address_init()
82 82
 
83 83
 def get_config_dict():
84 84
     c = config
85
-    return dict([ (s, dict([ (i, j) for i, j in c.items(s) ]) ) for s in c.sections() ])
85
+    return {
86
+        s: {
87
+            i: j
88
+            for i, j in c.items(s)
89
+        }
90
+        for s in c.sections()
91
+    }
86 92
 
87 93
 
88 94
 async def get_config(request):

+ 4
- 3
pyheatpump/variable_types.py View File

@@ -13,10 +13,10 @@ from pyheatpump.models.variable_type import VariableType
13 13
 
14 14
 
15 15
 async def get_variable_types(request):
16
-    return JSONResponse(dict([
17
-        (key, val.__dict__)
16
+    return JSONResponse({
17
+        key: val.__dict__
18 18
         for key, val in VariableType.getall().items()
19
-    ]))
19
+    })
20 20
 
21 21
 
22 22
 async def set_variable_types(request):
@@ -39,6 +39,7 @@ async def variable_types_routes(request, *args, **kwargs):
39 39
         return await get_variable_types(request)
40 40
     elif request['method'] == 'POST':
41 41
         return await set_variable_types(request)
42
+    raise NotImplementedError
42 43
 
43 44
 
44 45
 ROUTES=[

+ 1
- 0
pyheatpump/variable_values.py View File

@@ -51,6 +51,7 @@ async def variable_values_routes(request, *args, **kwargs):
51 51
         return await get_variable_values(request)
52 52
     elif request['method'] == 'POST':
53 53
         return await set_variable_values(request)
54
+    raise NotImplementedError
54 55
 
55 56
 async def variable_value_routes(request, *args, **kwargs):
56 57
     if request['method'] == 'GET':

+ 1
- 0
pyheatpump/variables.py View File

@@ -47,6 +47,7 @@ async def variables_routes(request, *args, **kwargs):
47 47
         return await get_variables(request)
48 48
     elif request['method'] == 'POST':
49 49
         return await set_variables(request)
50
+    raise NotImplementedError;
50 51
 
51 52
 
52 53
 ROUTES=[

Loading…
Cancel
Save