mirror of
				https://github.com/wting/autojump
				synced 2025-06-13 12:54:07 +00:00 
			
		
		
		
	use itemgetter() in sort() instead of a lambda function
This commit is contained in:
		
							parent
							
								
									d50de9196a
								
							
						
					
					
						commit
						8a24aa89b3
					
				
							
								
								
									
										5
									
								
								autojump
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								autojump
									
									
									
									
									
								
							| @ -25,6 +25,7 @@ except ImportError: | ||||
| import getopt | ||||
| from sys import argv,exit,stderr,version_info | ||||
| from tempfile import NamedTemporaryFile | ||||
| from operator import itemgetter | ||||
| import os | ||||
| import signal | ||||
| max_keyweight=1000 | ||||
| @ -135,7 +136,7 @@ if ('-a','') in optlist: | ||||
|         save(path_dict,dic_file) | ||||
| elif ('--stat','') in optlist: | ||||
|     a=list(path_dict.items()) | ||||
|     a.sort(key=lambda e:e[1]) | ||||
|     a.sort(key=itemgetter(1)) | ||||
|     for path,count in a[-100:]: | ||||
|         print("%.1f:\t%s" % (count,path)) | ||||
|     print("Total key weight: %d. Number of stored paths: %d" % (sum(path_dict.values()),len(a))) | ||||
| @ -172,7 +173,7 @@ else: | ||||
|             if endmatch: patterns[-1]=endmatch.group(1) | ||||
| 
 | ||||
|         dirs=list(path_dict.items()) | ||||
|         dirs.sort(key=lambda e:e[1],reverse=True) | ||||
|         dirs.sort(key=itemgetter(1), reverse=True) | ||||
|         if completion or userchoice != -1: | ||||
|             max_matches = 9 | ||||
|         else: | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user