Skip to content

Commit 37e20e3

Browse files
committed
fix: correction of some type hints that prevent robot code from running with older Python versions
1 parent 5a0ee39 commit 37e20e3

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

.vscode/launch.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,11 @@
4646
//"config", "info", "list",
4747
// "analyze",
4848

49-
"discover",
50-
"suites",
51-
// "discover", "tests", "--tags"
52-
"."
49+
// "discover",
50+
// "suites",
51+
// // "discover", "tests", "--tags"
52+
// "."
53+
"language-server"
5354
]
5455
},
5556
{

packages/core/src/robotcode/core/utils/glob_path.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def _glob_pattern_to_re(pattern: str) -> str:
6161

6262

6363
@functools.lru_cache(maxsize=256)
64-
def _compile_glob_pattern(pattern: str) -> re.Pattern[str]:
64+
def _compile_glob_pattern(pattern: str) -> "re.Pattern[str]":
6565
return re.compile(_glob_pattern_to_re(pattern))
6666

6767

@@ -82,7 +82,7 @@ def __init__(self, pattern: str) -> None:
8282
else:
8383
self.re_pattern = None
8484

85-
def matches(self, path: Union[PurePath, str, os.PathLike[str]]) -> bool:
85+
def matches(self, path: Union[PurePath, str, "os.PathLike[str]"]) -> bool:
8686
if isinstance(path, PurePath):
8787
path = path.as_posix()
8888
else:
@@ -99,14 +99,14 @@ def __repr__(self) -> str:
9999
return f"{type(self).__qualname__}(pattern={self.pattern!r}"
100100

101101

102-
def globmatches(pattern: str, path: Union[PurePath, str, os.PathLike[Any]]) -> bool:
102+
def globmatches(pattern: str, path: Union[PurePath, str, "os.PathLike[Any]"]) -> bool:
103103
return Pattern(pattern).matches(path)
104104

105105

106106
FILE_ATTRIBUTE_HIDDEN = 2
107107

108108

109-
def _is_hidden(entry: os.DirEntry[str]) -> bool:
109+
def _is_hidden(entry: "os.DirEntry[str]") -> bool:
110110
if entry.name.startswith("."):
111111
return True
112112

@@ -119,7 +119,7 @@ def _is_hidden(entry: os.DirEntry[str]) -> bool:
119119

120120

121121
def iter_files(
122-
path: Union[PurePath, str, os.PathLike[str]],
122+
path: Union[PurePath, str, "os.PathLike[str]"],
123123
patterns: Union[Sequence[Union[Pattern, str]], Pattern, str, None] = None,
124124
ignore_patterns: Union[Sequence[Union[Pattern, str]], Pattern, str, None] = None,
125125
*,

0 commit comments

Comments
 (0)