Package tlslite :: Package utils :: Module lists
[hide private]
[frames] | no frames]

Source Code for Module tlslite.utils.lists

 1  # Authors: 
 2  #   Hubert Kario (2016) 
 3  # 
 4  # See the LICENSE file for legal information regarding use of this file. 
 5   
 6  """Helper functions for handling lists""" 
 7   
 8   
9 -def getFirstMatching(values, matches):
10 """ 11 Return the first element in values that is also in matches. 12 13 Return None if values is None, empty or no element in values is also in 14 matches. 15 16 @type values: collections.abc.Iterable 17 @param values: list of items to look through, can be None 18 @type matches: collections.abc.Container 19 @param matches: list of items to check against 20 """ 21 assert matches is not None 22 if not values: 23 return None 24 return next((i for i in values if i in matches), None)
25