55import pathlib
66import re
77from functools import cached_property
8- from typing import Dict , Mapping , Optional , Pattern , Set , Type
8+ from typing import Mapping , Pattern
99
1010import yaml
1111
@@ -75,7 +75,7 @@ def all_files(self) -> bool:
7575 return self .args .all_files
7676
7777 @cached_property
78- def binaries (self ) -> Dict [str , str ]:
78+ def binaries (self ) -> dict [str , str ]:
7979 return dict (
8080 binary .split (":" )
8181 for binary
@@ -93,7 +93,7 @@ def disabled_checks(self):
9393 return disabled
9494
9595 @property
96- def changed_since (self ) -> Optional [ str ] :
96+ def changed_since (self ) -> str | None :
9797 return self .args .since
9898
9999 @cached_property
@@ -105,7 +105,7 @@ def changelog(self) -> "interface.IChangelogCheck":
105105
106106 @property # type:ignore
107107 @abstracts .interfacemethod
108- def changelog_class (self ) -> Type ["interface.IChangelogCheck" ]:
108+ def changelog_class (self ) -> type ["interface.IChangelogCheck" ]:
109109 raise NotImplementedError
110110
111111 @cached_property
@@ -124,7 +124,7 @@ def config(self) -> typing.YAMLConfigDict:
124124 else {})
125125
126126 @property
127- def config_path (self ) -> Optional [ pathlib .Path ] :
127+ def config_path (self ) -> pathlib .Path | None :
128128 if not self .args .config :
129129 return None
130130 path = pathlib .Path (self .args .config )
@@ -141,8 +141,8 @@ def directory(self) -> "_directory.ADirectory":
141141 return self .project .directory .filtered (** self .directory_kwargs )
142142
143143 @property
144- def directory_kwargs (self ) -> Dict :
145- kwargs : Dict = dict (
144+ def directory_kwargs (self ) -> dict :
145+ kwargs : dict = dict (
146146 exclude_matcher = self .grep_excluding_re ,
147147 path_matcher = self .grep_matching_re ,
148148 untracked = self .all_files )
@@ -163,7 +163,7 @@ def extensions(self) -> "interface.IExtensionsCheck":
163163
164164 @property # type:ignore
165165 @abstracts .interfacemethod
166- def extensions_class (self ) -> Type ["interface.IExtensionsCheck" ]:
166+ def extensions_class (self ) -> type ["interface.IExtensionsCheck" ]:
167167 raise NotImplementedError
168168
169169 @cached_property
@@ -173,17 +173,17 @@ def flake8(self) -> "interface.IFlake8Check":
173173
174174 @property # type:ignore
175175 @abstracts .interfacemethod
176- def flake8_class (self ) -> Type ["interface.IFlake8Check" ]:
176+ def flake8_class (self ) -> type ["interface.IFlake8Check" ]:
177177 raise NotImplementedError
178178
179179 @property # type:ignore
180180 @abstracts .interfacemethod
181- def fs_directory_class (self ) -> Type ["_directory.ADirectory" ]:
181+ def fs_directory_class (self ) -> type ["_directory.ADirectory" ]:
182182 raise NotImplementedError
183183
184184 @property # type:ignore
185185 @abstracts .interfacemethod
186- def git_directory_class (self ) -> Type ["_directory.AGitDirectory" ]:
186+ def git_directory_class (self ) -> type ["_directory.AGitDirectory" ]:
187187 raise NotImplementedError
188188
189189 @cached_property
@@ -193,7 +193,7 @@ def glint(self) -> "interface.IGlintCheck":
193193
194194 @property # type:ignore
195195 @abstracts .interfacemethod
196- def glint_class (self ) -> Type ["interface.IGlintCheck" ]:
196+ def glint_class (self ) -> type ["interface.IGlintCheck" ]:
197197 raise NotImplementedError
198198
199199 @cached_property
@@ -203,15 +203,15 @@ def gofmt(self) -> "interface.IGofmtCheck":
203203
204204 @property # type:ignore
205205 @abstracts .interfacemethod
206- def gofmt_class (self ) -> Type ["interface.IGofmtCheck" ]:
206+ def gofmt_class (self ) -> type ["interface.IGofmtCheck" ]:
207207 raise NotImplementedError
208208
209209 @property
210- def grep_excluding_re (self ) -> Optional [ Pattern [str ]] :
210+ def grep_excluding_re (self ) -> Pattern [str ] | None :
211211 return self ._grep_re (self .args .excluding )
212212
213213 @property
214- def grep_matching_re (self ) -> Optional [ Pattern [str ]] :
214+ def grep_matching_re (self ) -> Pattern [str ] | None :
215215 return self ._grep_re (self .args .matching )
216216
217217 @property
@@ -225,7 +225,7 @@ def project(self) -> IProject:
225225
226226 @property # type:ignore
227227 @abstracts .interfacemethod
228- def project_class (self ) -> Type [IProject ]:
228+ def project_class (self ) -> type [IProject ]:
229229 raise NotImplementedError
230230
231231 @cached_property
@@ -237,7 +237,7 @@ def runtime_guards(self) -> "interface.IRuntimeGuardsCheck":
237237
238238 @property # type:ignore
239239 @abstracts .interfacemethod
240- def runtime_guards_class (self ) -> Type ["interface.IRuntimeGuardsCheck" ]:
240+ def runtime_guards_class (self ) -> type ["interface.IRuntimeGuardsCheck" ]:
241241 raise NotImplementedError
242242
243243 @cached_property
@@ -247,11 +247,11 @@ def shellcheck(self) -> "interface.IShellcheckCheck":
247247
248248 @property # type:ignore
249249 @abstracts .interfacemethod
250- def shellcheck_class (self ) -> Type ["interface.IShellcheckCheck" ]:
250+ def shellcheck_class (self ) -> type ["interface.IShellcheckCheck" ]:
251251 raise NotImplementedError
252252
253253 @property
254- def summary_class (self ) -> Type [CodeCheckerSummary ]:
254+ def summary_class (self ) -> type [CodeCheckerSummary ]:
255255 """CodeChecker's summary class."""
256256 return CodeCheckerSummary
257257
@@ -262,7 +262,7 @@ def yamllint(self) -> interface.IYamllintCheck:
262262
263263 @property # type:ignore
264264 @abstracts .interfacemethod
265- def yamllint_class (self ) -> Type [interface .IYamllintCheck ]:
265+ def yamllint_class (self ) -> type [interface .IYamllintCheck ]:
266266 raise NotImplementedError
267267
268268 @cached_property
@@ -272,7 +272,7 @@ def yapf(self) -> interface.IYapfCheck:
272272
273273 @property # type:ignore
274274 @abstracts .interfacemethod
275- def yapf_class (self ) -> Type [interface .IYapfCheck ]:
275+ def yapf_class (self ) -> type [interface .IYapfCheck ]:
276276 raise NotImplementedError
277277
278278 def add_arguments (self , parser : argparse .ArgumentParser ) -> None :
@@ -451,7 +451,7 @@ async def preload_yapf(self) -> None:
451451
452452 def _check_output (
453453 self ,
454- check_files : Set [str ],
454+ check_files : set [str ],
455455 problem_files : typing .ProblemDict ) -> None :
456456 # This can be slow/blocking for large result sets, run
457457 # in a separate thread
@@ -477,7 +477,7 @@ async def _code_check(self, check: "interface.IFileCodeCheck") -> None:
477477 await check .files ,
478478 await check .problem_files )
479479
480- def _grep_re (self , arg : Optional [ str ] ) -> Optional [ Pattern [str ]] :
480+ def _grep_re (self , arg : str | None ) -> Pattern [str ] | None :
481481 # When using system `grep` we want to filter out at least some
482482 # of the files that .gitignore would.
483483 # TODO: use globs on cli and covert to re here
0 commit comments