Use a set literal in _clean_settings (#1585)
This commit is contained in:
		
							
								
								
									
										1
									
								
								AUTHORS
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								AUTHORS
									
									
									
									
									
								
							@@ -243,3 +243,4 @@ that much better:
 | 
				
			|||||||
 * Victor Varvaryuk
 | 
					 * Victor Varvaryuk
 | 
				
			||||||
 * Stanislav Kaledin (https://github.com/sallyruthstruik)
 | 
					 * Stanislav Kaledin (https://github.com/sallyruthstruik)
 | 
				
			||||||
 * Dmitry Yantsen (https://github.com/mrTable)
 | 
					 * Dmitry Yantsen (https://github.com/mrTable)
 | 
				
			||||||
 | 
					 * Renjianxin (https://github.com/Davidrjx)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -146,13 +146,14 @@ def get_connection(alias=DEFAULT_CONNECTION_NAME, reconnect=False):
 | 
				
			|||||||
        raise MongoEngineConnectionError(msg)
 | 
					        raise MongoEngineConnectionError(msg)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def _clean_settings(settings_dict):
 | 
					    def _clean_settings(settings_dict):
 | 
				
			||||||
        irrelevant_fields = set([
 | 
					        # set literal more efficient than calling set function
 | 
				
			||||||
            'name', 'username', 'password', 'authentication_source',
 | 
					        irrelevant_fields_set = {
 | 
				
			||||||
            'authentication_mechanism'
 | 
					            'name', 'username', 'password',
 | 
				
			||||||
        ])
 | 
					            'authentication_source', 'authentication_mechanism'
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        return {
 | 
					        return {
 | 
				
			||||||
            k: v for k, v in settings_dict.items()
 | 
					            k: v for k, v in settings_dict.items()
 | 
				
			||||||
            if k not in irrelevant_fields
 | 
					            if k not in irrelevant_fields_set
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Retrieve a copy of the connection settings associated with the requested
 | 
					    # Retrieve a copy of the connection settings associated with the requested
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user