summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSunil Shetye2024-03-04 12:58:23 +0530
committerSunil Shetye2024-03-04 12:58:23 +0530
commitc7618f10cf93bfffed0a5d075031b79ff84e9a3e (patch)
tree0202fa59942e516d00ed741249737088017f13ab
parent11e526d5f3775cc9a407a1a8854ff0504a53e729 (diff)
downloadCommon-Interface-Project-c7618f10cf93bfffed0a5d075031b79ff84e9a3e.tar.gz
Common-Interface-Project-c7618f10cf93bfffed0a5d075031b79ff84e9a3e.tar.bz2
Common-Interface-Project-c7618f10cf93bfffed0a5d075031b79ff84e9a3e.zip
fix flake8 errors
-rw-r--r--blocks/.flake83
-rw-r--r--blocks/Makefile2
-rw-r--r--blocks/blocks/xcosblocks/admin.py2
-rw-r--r--blocks/blocks/xcosblocks/serializers.py2
-rw-r--r--blocks/blocks/xcosblocks/tests.py9
-rw-r--r--blocks/frontend/urls.py2
-rw-r--r--blocks/frontend/views.py4
-rw-r--r--blocks/instructions/views.py6
-rw-r--r--blocks/simulationAPI/admin.py2
-rw-r--r--blocks/simulationAPI/helpers/parse.py10
-rw-r--r--blocks/simulationAPI/models.py9
-rw-r--r--blocks/simulationAPI/views.py1
12 files changed, 24 insertions, 28 deletions
diff --git a/blocks/.flake8 b/blocks/.flake8
index 0795f08d..9dc33eb7 100644
--- a/blocks/.flake8
+++ b/blocks/.flake8
@@ -1,2 +1,3 @@
[flake8]
-max-line-length = 82
+extend-exclude = docs,env*,migrations,node_modules,Xcos
+max-line-length = 100
diff --git a/blocks/Makefile b/blocks/Makefile
index 2f934d6f..bb01ec10 100644
--- a/blocks/Makefile
+++ b/blocks/Makefile
@@ -33,7 +33,7 @@ $(TARGET) : $(SRCFILES)
done > $@
flake8 : $(TARGET)
- flake8 --statistics $(TARGET)
+ flake8 --statistics
.xcosblocks.txt : $(TARGET) Xcos/parsexcosblocks.awk
@echo Making $@ ...
diff --git a/blocks/blocks/xcosblocks/admin.py b/blocks/blocks/xcosblocks/admin.py
index 8c38f3f3..4185d360 100644
--- a/blocks/blocks/xcosblocks/admin.py
+++ b/blocks/blocks/xcosblocks/admin.py
@@ -1,3 +1,3 @@
-from django.contrib import admin
+# from django.contrib import admin
# Register your models here.
diff --git a/blocks/blocks/xcosblocks/serializers.py b/blocks/blocks/xcosblocks/serializers.py
index ae313bdc..6ee0d4ad 100644
--- a/blocks/blocks/xcosblocks/serializers.py
+++ b/blocks/blocks/xcosblocks/serializers.py
@@ -360,7 +360,7 @@ class ErrorSerializer(serializers.Serializer):
class SetBlockParameterSerializer(serializers.Serializer):
block = serializers.CharField(max_length=100, required=True,
- allow_blank=False, trim_whitespace=True)
+ allow_blank=False, trim_whitespace=True)
p000_value = serializers.CharField(max_length=100, required=False,
allow_blank=True, trim_whitespace=True)
p001_value = serializers.CharField(max_length=100, required=False,
diff --git a/blocks/blocks/xcosblocks/tests.py b/blocks/blocks/xcosblocks/tests.py
index 78910471..d9ece393 100644
--- a/blocks/blocks/xcosblocks/tests.py
+++ b/blocks/blocks/xcosblocks/tests.py
@@ -29,8 +29,7 @@ class CategoryTestCase(TestCase):
print()
categories = Category.objects.all().order_by('sort_order')
- allblocks = Block.objects.all() \
- .order_by('name')
+ allblocks = Block.objects.all().order_by('name')
for category in categories:
blocks = allblocks.filter(categories=category)
print(category.id, category, len(blocks))
@@ -43,11 +42,9 @@ class CategoryTestCase(TestCase):
namestring = 'A'
allblocks = Block.objects.filter(name__istartswith=namestring)
- categories = Category.objects.filter(block__in=allblocks).distinct() \
- .order_by('sort_order')
+ categories = Category.objects.filter(block__in=allblocks).distinct().order_by('sort_order')
for category in categories:
- blocks = allblocks.filter(categories=category) \
- .order_by('name')
+ blocks = allblocks.filter(categories=category).order_by('name')
print(category.id, category, len(blocks))
if PRINT_BLOCKS:
for block in blocks:
diff --git a/blocks/frontend/urls.py b/blocks/frontend/urls.py
index 88dca623..c173cabb 100644
--- a/blocks/frontend/urls.py
+++ b/blocks/frontend/urls.py
@@ -3,5 +3,5 @@ from . import views
urlpatterns = [
- path('name', views.get_name ),
+ path('name', views.get_name),
]
diff --git a/blocks/frontend/views.py b/blocks/frontend/views.py
index daf7fc70..cd5d11ed 100644
--- a/blocks/frontend/views.py
+++ b/blocks/frontend/views.py
@@ -1,5 +1,4 @@
from django.shortcuts import render
-from django.http import JsonResponse
import requests
from .forms import NameForm
@@ -14,7 +13,8 @@ def get_name(request):
if form.is_valid():
# process the data in form.cleaned_data as required
print(form.cleaned_data)
- r = requests.post('http://127.0.0.1:8000/api/set_block_parameters/', data=form.cleaned_data)
+ r = requests.post('http://127.0.0.1:8000/api/set_block_parameters/',
+ data=form.cleaned_data)
json = r.json()
print(json)
# redirect to a new URL:
diff --git a/blocks/instructions/views.py b/blocks/instructions/views.py
index 947c1b1f..46816ecf 100644
--- a/blocks/instructions/views.py
+++ b/blocks/instructions/views.py
@@ -40,11 +40,13 @@ class Instructions(APIView):
xMax = xMin + randrange(10, 20)
yMin = randrange(-10, 10)
yMax = yMin + randrange(10, 20)
- idDict = { 'chartType': chartType, 'xMin': xMin, 'yMin': yMin, 'xMax': xMax, 'yMax': yMax, 'xNext': xMin }
+ idDict = {'chartType': chartType,
+ 'xMin': xMin, 'yMin': yMin, 'xMax': xMax, 'yMax': yMax, 'xNext': xMin}
allChartIds.append(chartId)
allIdDicts[chartId] = idDict
event = 'instruction'
- data = 'addChart id=%s type=%s xMin=%s xMax=%s yMin=%s yMax=%s' % (chartId, chartType, xMin, xMax, yMin, yMax)
+ data = 'addChart id=%s type=%s xMin=%s xMax=%s yMin=%s yMax=%s' % (
+ chartId, chartType, xMin, xMax, yMin, yMax)
elif number < 100 - 2 * (1 + resets) * len(allChartIds):
chartId = choice(allChartIds)
idDict = allIdDicts[chartId]
diff --git a/blocks/simulationAPI/admin.py b/blocks/simulationAPI/admin.py
index 8c38f3f3..4185d360 100644
--- a/blocks/simulationAPI/admin.py
+++ b/blocks/simulationAPI/admin.py
@@ -1,3 +1,3 @@
-from django.contrib import admin
+# from django.contrib import admin
# Register your models here.
diff --git a/blocks/simulationAPI/helpers/parse.py b/blocks/simulationAPI/helpers/parse.py
index 9929021d..2695d1d4 100644
--- a/blocks/simulationAPI/helpers/parse.py
+++ b/blocks/simulationAPI/helpers/parse.py
@@ -14,10 +14,10 @@ def extract_data_from_ngspice_output(pathToFile):
curernt_headers = []
total_number_of_tables = 0
- if('=' in f_contents[0]):
+ if '=' in f_contents[0]:
graph = False
- if(not graph):
+ if not graph:
json_data = {"data": [], "graph": "false"}
for line in f_contents:
contents_of_line = line.split()
@@ -28,12 +28,12 @@ def extract_data_from_ngspice_output(pathToFile):
for line in f_contents:
contents_of_line = line.split()
- if('Index' in contents_of_line):
+ if 'Index' in contents_of_line:
# line_set = remove_duplicate_items_from_list(
# contents_of_line)
line_set = contents_of_line
- if(line_set != curernt_headers):
+ if line_set != curernt_headers:
curernt_headers = line_set
json_data["data"].append(
{"labels": [], "x": [], "y": []})
@@ -48,7 +48,7 @@ def extract_data_from_ngspice_output(pathToFile):
else:
m = re.match('[0-9]+', line)
- if(m):
+ if m:
index = len(json_data["data"]) - 1
data = json_data["data"][index]
data["x"].append(contents_of_line[1])
diff --git a/blocks/simulationAPI/models.py b/blocks/simulationAPI/models.py
index 2124fd47..fb8f860e 100644
--- a/blocks/simulationAPI/models.py
+++ b/blocks/simulationAPI/models.py
@@ -18,17 +18,14 @@ class Task(models.Model):
class TaskFile(models.Model):
- file_id = models.UUIDField(
- primary_key=True, default=uuid.uuid4, editable=False)
- file = models.FileField(
- storage=FileSystemStorage(location=settings.MEDIA_ROOT))
+ file_id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
+ file = models.FileField(storage=FileSystemStorage(location=settings.MEDIA_ROOT))
app_name = models.CharField(max_length=100, blank=True, null=True)
parameters = models.TextField(blank=True, null=True)
upload_time = models.DateTimeField(auto_now=True)
log_name = models.CharField(max_length=500, blank=True, null=True)
returncode = models.IntegerField(blank=True, null=True)
- task = models.OneToOneField(Task, on_delete=models.CASCADE,
- related_name='file')
+ task = models.OneToOneField(Task, on_delete=models.CASCADE, related_name='file')
def save(self, *args, **kwargs):
super(TaskFile, self).save(*args, **kwargs)
diff --git a/blocks/simulationAPI/views.py b/blocks/simulationAPI/views.py
index 4205aff9..f593da80 100644
--- a/blocks/simulationAPI/views.py
+++ b/blocks/simulationAPI/views.py
@@ -117,7 +117,6 @@ def parse_line(line, lineno):
return (None, NOLINE)
-
def get_line_and_state(file, figure_list, lineno, incomplete_line):
'''
Function to get a new line from file