Procházet zdrojové kódy

Defer tempfile import, since it pulls in a lot of other modules.

Jelmer Vernooij před 4 roky
rodič
revize
bb62a537d0
1 změnil soubory, kde provedl 2 přidání a 1 odebrání
  1. 2 1
      dulwich/file.py

+ 2 - 1
dulwich/file.py

@@ -23,7 +23,6 @@
 import io
 import os
 import sys
-import tempfile
 
 
 def ensure_dir_exists(dirname):
@@ -43,6 +42,8 @@ def _fancy_rename(oldname, newname):
             raise
         return
 
+    # Defer the tempfile import since it pulls in a lot of other things.
+    import tempfile
     # destination file exists
     try:
         (fd, tmpfile) = tempfile.mkstemp(".tmp", prefix=oldname, dir=".")