original_docstring: Return list of columns filtered with any of: semantic tags, LogicalTypes, column names
  
          Args:
              include (str or LogicalType or list[str or LogicalType]): parameter or list of parameters to
                  filter columns by. Can be Logical Types or Semantic Tags. Columns that match will be
                  included in the returned list of columns.
              exclude (str or LogicalType or list[str or LogicalType]): parameter or list of parameters to
                  filter columns by. Can be Logical Types or Semantic Tags. Columns that match will be
                  excluded from the returned list of columns.
  
              col_names (bool): Specifies whether to filter columns by name. Defaults to False.
  
          Returns:
              List[str] of column names that fit into filter.
          
docstring: Return list of columns filtered with any of: semantic tags, LogicalTypes, column names
docstring_tokens: Return list of columns filtered with any of : semantic tags LogicalTypes column names
code: def _filter_cols(self, include=None, exclude=None, col_names=False):
          """Return list of columns filtered with any of: semantic tags, LogicalTypes, column names
  
          Args:
              include (str or LogicalType or list[str or LogicalType]): parameter or list of parameters to
                  filter columns by. Can be Logical Types or Semantic Tags. Columns that match will be
                  included in the returned list of columns.
              exclude (str or LogicalType or list[str or LogicalType]): parameter or list of parameters to
                  filter columns by. Can be Logical Types or Semantic Tags. Columns that match will be
                  excluded from the returned list of columns.
  
              col_names (bool): Specifies whether to filter columns by name. Defaults to False.
  
          Returns:
              List[str] of column names that fit into filter.
          """
          assert not (include and exclude), "Cannot specify both include and exclude"
          if include and not isinstance(include, list):
              include = [include]
          elif exclude and not isinstance(exclude, list):
              exclude = [exclude]
  
          if include is not None:
              selectors = include
          elif exclude is not None:
              selectors = exclude
  
          ltypes_used = set()
          ltypes_in_schema = {type(col.logical_type) for col in self.columns.values()}
  
          tags_used = set()
          tags_in_schema = {
              tag for col in self.columns.values() for tag in col.semantic_tags
          }
  
          col_name_matches = set()
  
          for selector in selectors:
              # Determine if the selector is a registered, uninstantiated LogicalType
              maybe_ltype = selector
              if isinstance(selector, str):
                  # Convert possible string to LogicalType - unregistered LogicalTypes return None
                  maybe_ltype = ww.type_system.str_to_logical_type(
                      selector, raise_error=False
                  )
              # Get the class - unregistered LogicalTypes return LogicalTypeMetaClass
              maybe_ltype_class = _get_ltype_class(maybe_ltype)
  
              if maybe_ltype_class in ww.type_system.registered_types:
                  if maybe_ltype not in ww.type_system.registered_types:
                      raise TypeError(
                          f"Invalid selector used in include: {maybe_ltype} cannot be instantiated"
                      )
                  if maybe_ltype in ltypes_in_schema:
                      ltypes_used.add(maybe_ltype)
              elif maybe_ltype_class == ww.logical_types.LogicalType.__class__:
                  raise TypeError(
                      f"Specified LogicalType selector {maybe_ltype} is not registered in Woodwork's type system."
                  )
  
              # Hashability as a proxy for whether a selector is possibly a semantic tag or column name
              if not isinstance(selector, Hashable):
                  raise TypeError(
                      f"Invalid selector used in include: {selector} must be a "
                      "string, uninstantiated and registered LogicalType, or valid column name"
                  )
              # Determine if the selector is a semantic tag
              if selector in tags_in_schema:
                  tags_used.add(selector)
              # Determine if the selector is a column name
              if col_names and selector in self.columns:
                  col_name_matches.add(selector)
  
          cols_to_return = []
          cols_seen = set()
          for col_name, col in self.columns.items():
              is_match = (
                  type(col.logical_type) in ltypes_used
                  or col.semantic_tags.intersection(tags_used)
                  or col_name in col_name_matches
              )
              if include is not None and is_match and col_name not in cols_seen:
                  cols_to_return.append(col_name)
                  cols_seen.add(col_name)
              elif exclude is not None and not is_match and col_name not in cols_seen:
                  cols_to_return.append(col_name)
                  cols_seen.add(col_name)
  
          return cols_to_return
code_tokens: def _filter_cols ( self , include = None , exclude = None , col_names = False ) : assert not ( include and exclude ) , "Cannot specify both include and exclude" if include and not isinstance ( include , list ) : include = [ include ] elif exclude and not isinstance ( exclude , list ) : exclude = [ exclude ] if include is not None : selectors = include elif exclude is not None : selectors = exclude ltypes_used = set ( ) ltypes_in_schema = { type ( col . logical_type ) for col in self . columns . values ( ) } tags_used = set ( ) tags_in_schema = { tag for col in self . columns . values ( ) for tag in col . semantic_tags } col_name_matches = set ( ) for selector in selectors : maybe_ltype = selector if isinstance ( selector , str ) : maybe_ltype = ww . type_system . str_to_logical_type ( selector , raise_error = False ) maybe_ltype_class = _get_ltype_class ( maybe_ltype ) if maybe_ltype_class in ww . type_system . registered_types : if maybe_ltype not in ww . type_system . registered_types : raise TypeError ( f"Invalid selector used in include: {maybe_ltype} cannot be instantiated" ) if maybe_ltype in ltypes_in_schema : ltypes_used . add ( maybe_ltype ) elif maybe_ltype_class == ww . logical_types . LogicalType . __class__ : raise TypeError ( f"Specified LogicalType selector {maybe_ltype} is not registered in Woodwork's type system." ) if not isinstance ( selector , Hashable ) : raise TypeError ( f"Invalid selector used in include: {selector} must be a " "string, uninstantiated and registered LogicalType, or valid column name" ) if selector in tags_in_schema : tags_used . add ( selector ) if col_names and selector in self . columns : col_name_matches . add ( selector ) cols_to_return = [ ] cols_seen = set ( ) for col_name , col in self . columns . items ( ) : is_match = ( type ( col . logical_type ) in ltypes_used or col . semantic_tags . intersection ( tags_used ) or col_name in col_name_matches ) if include is not None and is_match and col_name not in cols_seen : cols_to_return . append ( col_name ) cols_seen . add ( col_name ) elif exclude is not None and not is_match and col_name not in cols_seen : cols_to_return . append ( col_name ) cols_seen . add ( col_name ) return cols_to_return
short_docstring: Return list of columns filtered with any of: semantic tags, LogicalTypes, column names
short_docstring_tokens: Return list of columns filtered with any of : semantic tags LogicalTypes column names
comment: """Return list of columns filtered with any of: semantic tags, LogicalTypes, column names
  
          Args:
              include (str or LogicalType or list[str or LogicalType]): parameter or list of parameters to
                  filter columns by. Can be Logical Types or Semantic Tags. Columns that match will be
                  included in the returned list of columns.
              exclude (str or LogicalType or list[str or LogicalType]): parameter or list of parameters to
                  filter columns by. Can be Logical Types or Semantic Tags. Columns that match will be
                  excluded from the returned list of columns.
  
              col_names (bool): Specifies whether to filter columns by name. Defaults to False.
  
          Returns:
              List[str] of column names that fit into filter.
          """$SEP$# Determine if the selector is a registered, uninstantiated LogicalType$SEP$# Convert possible string to LogicalType - unregistered LogicalTypes return None$SEP$# Get the class - unregistered LogicalTypes return LogicalTypeMetaClass$SEP$# Hashability as a proxy for whether a selector is possibly a semantic tag or column name$SEP$# Determine if the selector is a semantic tag$SEP$# Determine if the selector is a column name