From e9638064644c9a94f8ea7edcf3e2daea91b90671 Mon Sep 17 00:00:00 2001
From: dm1sh <me@dmitriy.icu>
Date: Wed, 18 Oct 2023 22:10:32 +0300
Subject: [PATCH] Applied formatter

---
 GraphWidget/Graph.py       | 82 ++++++++++++++++++++++----------------
 GraphWidget/GraphWidget.py |  9 +++--
 2 files changed, 53 insertions(+), 38 deletions(-)

diff --git a/GraphWidget/Graph.py b/GraphWidget/Graph.py
index f6a9812..f81dccc 100644
--- a/GraphWidget/Graph.py
+++ b/GraphWidget/Graph.py
@@ -2,16 +2,18 @@ from matplotlib.figure import Figure
 
 
 class Graph:
-    def __init__(self,x, y,labels,mult_subplots=0,xl="x",yl="y",linetype='k',lims=False):
-        #словарь из настроек?
-        self.labels=labels
-        self.__x=x
-        self.__y=y
-        self.__fig =Figure(figsize=(5,4),dpi=100)
-        self.__chb=mult_subplots
-        self.__ax=self.__fig.add_subplot()
+    def __init__(
+        self, x, y, labels, mult_subplots=0, xl="x", yl="y", linetype="k", lims=False
+    ):
+        # словарь из настроек?
+        self.labels = labels
+        self.__x = x
+        self.__y = y
+        self.__fig = Figure(figsize=(5, 4), dpi=100)
+        self.__chb = mult_subplots
+        self.__ax = self.__fig.add_subplot()
 
-        #сделать отслеживание за состояние кнопок потом
+        # сделать отслеживание за состояние кнопок потом
         """
         if self.__chb==0:
             if len(self.__x)>1:
@@ -39,38 +41,50 @@ class Graph:
         self.draw_n_func_plot()
         self.draw_one_func()
         self.draw_subplots()
-        
+
         self.__ax.set_xlabel(xl)
         self.__ax.set_ylabel(yl)
         self.__ax.legend()
-        self.figure.tight_layout()        
+        self.figure.tight_layout()
 
-    def add_vline( ax,x=0, ymin=0, ymax=1):
-        ax.axvline(x,ymin,ymax)
-        #принимаем плот и на нем же рисуем
-    
-    def add_hline(ax,y=0, xmin=0, xmax=1,):
+    def add_vline(ax, x=0, ymin=0, ymax=1):
+        ax.axvline(x, ymin, ymax)
+        # принимаем плот и на нем же рисуем
+
+    def add_hline(
+        ax,
+        y=0,
+        xmin=0,
+        xmax=1,
+    ):
         ax.axhline(y, xmin, xmax)
-        
-    def draw_n_func_plot(self,): #много графиков на одном холсте
-        if self.__chb==0 and len(self.__x)>1:
-            for i in range(len(self.__x)):
-                self.__ax.plot(self.__x[i],self.__y[i],label=self.labels[i])
 
-    def draw_one_func(self,):
-        if len(self.__x)==1:
-            
-            self.__ax.plot(self.__x[0],self.__y[0],label=self.labels[0])#
-
-    def draw_subplots(self,):        
-        if self.__chb==1 and len(self.__x)>1:
+    def draw_n_func_plot(
+        self,
+    ):  # много графиков на одном холсте
+        if self.__chb == 0 and len(self.__x) > 1:
             for i in range(len(self.__x)):
-                n=int(f"{len(self.__x)}1{i+1}")
-            
-                axes=self.__fig.add_subplot(n)
+                self.__ax.plot(self.__x[i], self.__y[i], label=self.labels[i])
+
+    def draw_one_func(
+        self,
+    ):
+        if len(self.__x) == 1:
+            self.__ax.plot(self.__x[0], self.__y[0], label=self.labels[0])  #
+
+    def draw_subplots(
+        self,
+    ):
+        if self.__chb == 1 and len(self.__x) > 1:
+            for i in range(len(self.__x)):
+                n = int(f"{len(self.__x)}1{i+1}")
+
+                axes = self.__fig.add_subplot(n)
                 axes.set_title(f"График №{i+1}")
-                axes.plot(self.__x[i],self.__y[i],label=self.labels[i])
+                axes.plot(self.__x[i], self.__y[i], label=self.labels[i])
 
     @property
-    def figure(self,):
-        return self.__fig            
+    def figure(
+        self,
+    ):
+        return self.__fig
diff --git a/GraphWidget/GraphWidget.py b/GraphWidget/GraphWidget.py
index 4274bb5..5405e98 100644
--- a/GraphWidget/GraphWidget.py
+++ b/GraphWidget/GraphWidget.py
@@ -1,15 +1,16 @@
+import Graph
 import matplotlib
-matplotlib.use('Qt5Agg')
-import Graph 
+from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg
+from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolbar
 from PyQt5 import QtWidgets
 
-from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg, NavigationToolbar2QT as NavigationToolbar
+matplotlib.use("Qt5Agg")
 
 
 class GraphWidget(QtWidgets.QWidget):
     def __init__(self, x, y, labels, mult_plots=False):
         super().__init__()
-        graph = Graph.Graph(x,y,labels, mult_subplots=mult_plots)
+        graph = Graph.Graph(x, y, labels, mult_subplots=mult_plots)
 
         sc = FigureCanvasQTAgg(graph.figure)