Răsfoiți Sursa

클래스 밖으로 뺌

Surplus_Up (2DU) 6 ani în urmă
părinte
comite
e093276a44
1 a modificat fișierele cu 13 adăugiri și 13 ștergeri
  1. 13 13
      route/edit.py

+ 13 - 13
route/edit.py

@@ -1,5 +1,18 @@
 from .tool.func import *
 from .tool.func import *
 
 
+class run_count_section:
+    def __init__(self, key, change):
+        self.counter = key
+        self.change = change
+
+    def __call__(self, match):
+        self.counter -= 1
+
+        if self.counter == 0:
+            return '\n' + self.change + '\n'
+        else:
+            return '\n' + match[1]
+
 def edit_2(conn, name):
 def edit_2(conn, name):
     curs = conn.cursor()
     curs = conn.cursor()
 
 
@@ -49,19 +62,6 @@ def edit_2(conn, name):
             o_data = old[0][0].replace('\r\n', '\n')
             o_data = old[0][0].replace('\r\n', '\n')
 
 
             if section:
             if section:
-                class run_count_section:
-                    def __init__(self, key, change):
-                        self.counter = key
-                        self.change = change
-
-                    def __call__(self, match):
-                        self.counter -= 1
-
-                        if self.counter == 0:
-                            return '\n' + self.change + '\n'
-                        else:
-                            return '\n' + match[1]
-
                 run_count = run_count_section(section, content)
                 run_count = run_count_section(section, content)
 
 
                 c_data = html.escape('\n' + o_data)
                 c_data = html.escape('\n' + o_data)