def matchkeyword(colitem, keywordexpr):
 mapped_names = set()
 import pytest
 for item in colitem.listchain():
  if (not isinstance(item, pytest.Instance)):
   mapped_names.add(item.name)
 for name in colitem.listextrakeywords():
  mapped_names.add(name)
 if hasattr(colitem, 'function'):
  for name in colitem.function.__dict__:
   mapped_names.add(name)
 mapping = KeywordMapping(mapped_names)
 if (' ' not in keywordexpr):
  return mapping[keywordexpr]
 elif (keywordexpr.startswith('not ') and (' ' not in keywordexpr[4:])):
  return (not mapping[keywordexpr[4:]])
 return eval(keywordexpr, {}, mapping)

def matchkeyword ( colitem , keywordexpr ) : mapped_names = set ( ) import pytest for item in colitem . listchain ( ) : if ( not isinstance ( item , pytest . Instance ) ) : mapped_names . add ( item . name ) for name in colitem . listextrakeywords ( ) : mapped_names . add ( name ) if hasattr ( colitem , 'function' ) : for name in colitem . function . __dict__ : mapped_names . add ( name ) mapping = KeywordMapping ( mapped_names ) if ( ' ' not in keywordexpr ) : return mapping [ keywordexpr ] elif ( keywordexpr . startswith ( 'not ' ) and ( ' ' not in keywordexpr [ 4 : ] ) ) : return ( not mapping [ keywordexpr [ 4 : ] ] ) return eval ( keywordexpr , { } , mapping )
tries to match given keyword expression to given collector item .