Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 0 additions & 28 deletions stackone_ai/toolset.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,34 +253,6 @@ def __init__(
self.base_url = base_url or DEFAULT_BASE_URL
self._account_ids: list[str] = []

def _matches_filter(self, tool_name: str, filter_pattern: str | list[str]) -> bool:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this not used for glob filtering at all?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we use _filter_by_action function instead

"""Check if a tool name matches the filter pattern

Args:
tool_name: Name of the tool to check
filter_pattern: String or list of glob patterns to match against.
Patterns starting with ! are treated as negative matches.

Returns:
True if the tool name matches any positive pattern and no negative patterns,
False otherwise
"""
patterns = [filter_pattern] if isinstance(filter_pattern, str) else filter_pattern

# Split into positive and negative patterns
positive_patterns = [p for p in patterns if not p.startswith("!")]
negative_patterns = [p[1:] for p in patterns if p.startswith("!")]

# If no positive patterns, treat as match all
matches_positive = (
any(fnmatch.fnmatch(tool_name, p) for p in positive_patterns) if positive_patterns else True
)

# If any negative pattern matches, exclude the tool
matches_negative = any(fnmatch.fnmatch(tool_name, p) for p in negative_patterns)

return matches_positive and not matches_negative

def set_accounts(self, account_ids: list[str]) -> StackOneToolSet:
"""Set account IDs for filtering tools

Expand Down
Loading