class_docstr: Provides a local mapping for keywords.
  Given a list of names, map any substring of one of these names to True.
class_docstr_tok: ["Provides","a","local","mapping","for","keywords",".","Given","a","list","of","names",",","map","any","substring","of","one","of","these","names","to","True","."]
code: def from_item(cls, item):
      mapped_names = set()
  
      # Add the names of the current item and any parent items
      import pytest
  
      for item in item.listchain():
          if not isinstance(item, pytest.Instance):
              mapped_names.add(item.name)
  
      # Add the names added as extra keywords to current or parent items
      mapped_names.update(item.listextrakeywords())
  
      # Add the names attached to the current function through direct assignment
      if hasattr(item, "function"):
          mapped_names.update(item.function.__dict__)
  
      # add the markers to the keywords as we no longer handle them correctly
      mapped_names.update(mark.name for mark in item.iter_markers())
  
      return cls(mapped_names)
  
file_path: catboost/contrib/python/pytest/py2/_pytest/mark/legacy.py
imports: import keyword
  import attr
  from _pytest.config import UsageError
label_desc: Use image node_id 2 for calling the KeywordMapping obj's underlying member method code with example usage: obj.from_item(cls, item) and returns: cls