Skip to content

Commit f0326d4

Browse files
committed
fix: typecheck and fix errors in glob.py
Typecheck codemcp/glob.py and fix errors. Typecheck ONLY this file (typecheck command takes a filename as argument). ```git-revs 3ffd8f2 (Base revision) 2f6e403 Add missing List[str] type annotation for result variable and import Any from typing d29a90c Add List[str] type annotation for items variable 4b4ea7f Add List[str] type annotation for processed_items variable 3ada72b Add List[str] type annotation for result variable in find function 164fff5 Replace unused dirnames variable with underscore to avoid warning HEAD Remove unused Any import ``` codemcp-id: 218-fix-typecheck-and-fix-errors-in-glob-py ghstack-source-id: 0f83054 Pull-Request-resolved: #210
1 parent 3186559 commit f0326d4

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

codemcp/glob.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def translate_pattern(
3030
editorconfig_asterisk = editorconfig
3131
editorconfig_double_asterisk = editorconfig
3232
i, n = 0, len(pattern)
33-
result = []
33+
result: List[str] = []
3434

3535
# Handle escaped characters
3636
escaped = False
@@ -178,7 +178,7 @@ def translate_pattern(
178178
else:
179179
# Handle comma-separated items {s1,s2,s3}
180180
# Split but respect any nested braces
181-
items = []
181+
items: List[str] = []
182182
start = 0
183183
nested_depth = 0
184184

@@ -200,7 +200,7 @@ def translate_pattern(
200200
i = i - len(brace_content) - 2
201201
else:
202202
# Process each item recursively to handle nested braces
203-
processed_items = []
203+
processed_items: List[str] = []
204204
for item in items:
205205
# For nested patterns, recursively translate but without the anchors
206206
if "{" in item:
@@ -324,7 +324,7 @@ def find(
324324
Returns:
325325
List of paths that match any of the patterns
326326
"""
327-
result = []
327+
result: List[str] = []
328328
matchers = [
329329
make_matcher(
330330
pattern,
@@ -341,7 +341,7 @@ def find(
341341
return result
342342

343343
# Walk filesystem
344-
for dirpath, dirnames, filenames in os.walk(root):
344+
for dirpath, _, filenames in os.walk(root):
345345
rel_dirpath = os.path.relpath(dirpath, root)
346346
if rel_dirpath == ".":
347347
rel_dirpath = ""

0 commit comments

Comments
 (0)