euscan: Performance improvement moving imports
Signed-off-by: volpino <fox91@anche.no>
This commit is contained in:
		@@ -28,12 +28,10 @@ from portage.output import white, yellow, turquoise, green
 | 
				
			|||||||
from portage.exception import AmbiguousPackageName
 | 
					from portage.exception import AmbiguousPackageName
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from gentoolkit import pprinter as pp
 | 
					from gentoolkit import pprinter as pp
 | 
				
			||||||
from gentoolkit.eclean.search import (port_settings)
 | 
					from gentoolkit.eclean.search import port_settings
 | 
				
			||||||
from gentoolkit.errors import GentoolkitException
 | 
					from gentoolkit.errors import GentoolkitException
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from euscan import CONFIG, output
 | 
					from euscan import CONFIG, output
 | 
				
			||||||
from euscan.scan import scan_upstream
 | 
					 | 
				
			||||||
from euscan.out import progress_bar
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Globals
 | 
					# Globals
 | 
				
			||||||
@@ -216,6 +214,7 @@ def parse_args():
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
def main():
 | 
					def main():
 | 
				
			||||||
    """Parse command line and execute all actions."""
 | 
					    """Parse command line and execute all actions."""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    CONFIG['nocolor'] = (
 | 
					    CONFIG['nocolor'] = (
 | 
				
			||||||
        port_settings["NOCOLOR"] in ('yes', 'true') or not isatty
 | 
					        port_settings["NOCOLOR"] in ('yes', 'true') or not isatty
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
@@ -242,6 +241,10 @@ def main():
 | 
				
			|||||||
            print_usage(e.value)
 | 
					            print_usage(e.value)
 | 
				
			||||||
            exit_helper(EINVAL)
 | 
					            exit_helper(EINVAL)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Importing stuff here for performance reasons
 | 
				
			||||||
 | 
					    from euscan.scan import scan_upstream
 | 
				
			||||||
 | 
					    from euscan.out import progress_bar
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if CONFIG['verbose'] > 2:
 | 
					    if CONFIG['verbose'] > 2:
 | 
				
			||||||
        HTTPConnection.debuglevel = 1
 | 
					        HTTPConnection.debuglevel = 1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user