b1a211478ccc0b407c8694b2b91c90cf23ef6306 — Emil Oppeln-Bronikowski 4 months ago 7a8fece master
Somehow working
1 files changed, 4 insertions(+), 14 deletions(-)

M __main__.py
M __main__.py => __main__.py +4 -14
@@ 53,7 53,7 @@
 
     elements[len(elements)-1] = class_element
 
-    print(elements, class_element, org_class_element)
+    #print(elements, class_element, org_class_element)
     return("\\".join(elements), class_element)
 
 def test_bool_call(func, param):


@@ 76,23 76,13 @@
             if is_line_namespaced(line) and not is_slash_quoted(line) and not has_use(line):
                 path, class_element = extract_namespace(line)
                 namespaces.append(path)
-                # print("{}\n{}".format(line, line.replace(path[:-1], "").replace("\\", "")))
                 print("Yes ", line)
-                print(path, class_element)
-                input()
-
-            else:
-                print("No ", line)
+                if input() == "":
+                    ns = "\\".join(path.split("\\")[:-1])
+                    print("NS: {}\nOld: {}\nNew: {}".format(ns, line, line.replace(ns, "").replace("\\"+class_element, class_element)))
 
     #print(set(namespaces))
     print(return_import_statements(set(namespaces)))
 
 if len(sys.argv) == 2:
     main(sys.argv[1])
-
-t = "throw new \\App\\Exceptions\\VoucherDoesNotExists($serial);"
-t2 = "function derp(\\App\\User $user) {"
-print(test_bool_call(is_line_namespaced, t2))
-print(test_bool_call(is_slash_quoted, t2))
-print(test_bool_call(has_use, t2))
-print(extract_namespace(t2))