import inspect


def _filter_module_attributes(path, parent, children):
  """Filter out module attirubtes.

  This removes attributes that are a gen rule attribute.
  The custom ops that need gen rules will have their docs exposed
  from the python source file. No need to also get api docs from the generated
  files.

  Args:
    path: path to parent attribute.
    parent: the attribute (module or class).
    children: the children attributes of parent.

  Returns:
    The new, filtered, children of the current attribute.
  """
  del path
  skip_module_attributes = {
      "gen_decode_proto_sparse",
      "gen_decode_proto_map_op",
      "gen_equi_join_indices",
      "gen_parquet_dataset",
      "gen_run_length_before"
  }
  if inspect.ismodule(parent):
    children = [(name, child)
                for (name, child) in children
                if name not in skip_module_attributes]
  return children