From 5322f0a5bf40b6e3c061c51f72d126850f3dd854 Mon Sep 17 00:00:00 2001
From: "saket.agrahari" <saket.agrahari@geant.org>
Date: Wed, 30 Nov 2022 16:20:18 +0530
Subject: [PATCH] Flake 8 issue

---
 compendium_v2/routes/api.py | 44 ++++++-------------------------------
 1 file changed, 7 insertions(+), 37 deletions(-)

diff --git a/compendium_v2/routes/api.py b/compendium_v2/routes/api.py
index 75627c2a..a121e277 100644
--- a/compendium_v2/routes/api.py
+++ b/compendium_v2/routes/api.py
@@ -10,15 +10,11 @@ API Endpoints
 .. autofunction:: compendium_v2.routes.api.things
 
 """
-import binascii
-import hashlib
-import random
-import time
 import os
 import logging
 import json
 
-from flask import Blueprint, jsonify
+from flask import Blueprint
 
 from compendium_v2.routes import common
 
@@ -37,7 +33,6 @@ file_name = open(DUMMY_DATA_FILENAME)
 
 budget_matrix_response = json.loads(file_name.read())
 
-
 THING_LIST_SCHEMA = {
     '$schema': 'http://json-schema.org/draft-07/schema#',
 
@@ -61,7 +56,6 @@ THING_LIST_SCHEMA = {
     'items': {'$ref': '#/definitions/thing'}
 }
 
-
 BUDGET_MATRIX_SCHEMA = {
     '$schema': 'http://json-schema.org/draft-07/schema#',
     'type': 'object',
@@ -69,7 +63,7 @@ BUDGET_MATRIX_SCHEMA = {
         'data': {
             'type': 'object',
             'properties': {
-                'datasets':  {
+                'datasets': {
                     'type': 'array',
                     'items': {
                         'type': 'object',
@@ -79,13 +73,13 @@ BUDGET_MATRIX_SCHEMA = {
                             },
                             'data': {
                                 'type': 'array',
-                                "items": {
-                                    "anyOf": [
+                                'items': {
+                                    'anyOf': [
                                         {
-                                            "type": "number"
+                                            'type': 'number'
                                         },
                                         {
-                                            "type": "null"
+                                            'type': 'null'
                                         }
                                     ]
                                 },
@@ -94,7 +88,7 @@ BUDGET_MATRIX_SCHEMA = {
                                 'type': 'string'
                             }
                         }
-                }
+                    }
 
                 },
                 'labels': {
@@ -128,9 +122,6 @@ def after_request(resp):
     return common.after_request(resp)
 
 
-
-
-
 @routes.route('/things', methods=['GET', 'POST'])
 @common.require_accepts_json
 def things():
@@ -145,24 +136,3 @@ def things():
     :return:
     """
     return budget_matrix_response
-
-    #
-    # def _hash(s, length):
-    #     m = hashlib.sha256()
-    #     m.update(s.encode('utf-8'))
-    #     digest = binascii.b2a_hex(m.digest()).decode('utf-8')
-    #     return digest[-length:].upper()
-    #
-    # def _make_thing(idx):
-    #     six_months = 24 * 3600 * 180
-    #     return {
-    #         'id': _hash(f'id-{idx}', 4),
-    #         'time': int(time.time() + random.randint(-six_months, six_months)),
-    #         'state': bool(idx % 2),
-    #         'data1': _hash(f'data1-{idx}', 2),
-    #         'data2': _hash(f'data2-{idx}', 8),
-    #         'data3': _hash(f'data3-{idx}', 32)
-    #     }
-    #
-    # response = map(_make_thing, range(20))
-    # return jsonify(list(response))
-- 
GitLab