Skip to content

Commit e79804c

Browse files
committed
style: reformat python code
1 parent 77db502 commit e79804c

File tree

136 files changed

+4229
-1664
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

136 files changed

+4229
-1664
lines changed

cliff.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ commit_parsers = [
7878
{ message = "^doc", group = "Documentation" },
7979
{ message = "^perf", group = "Performance" },
8080
{ message = "^refactor", group = "Refactor" },
81-
{ message = "^style", group = "Styling" },
81+
{ message = "^style", group = "Styling", skip = true },
8282
{ message = "^test", group = "Testing" },
8383
{ message = "^chore\\(release\\): prepare for", skip = true },
8484
{ message = "^chore\\(deps\\)", skip = true },

hatch.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ matrix.rf.dependencies = [
109109
]
110110

111111
[envs.lint]
112+
python = "3.8"
112113
#skip-install = true
113114
#extra-dependencies = ["tomli>=2.0.0"]
114115
extra-dependencies = [

packages/analyze/src/robotcode/analyze/analyzer.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@
66

77

88
class Analyzer:
9-
def __init__(self, config: AnalyzerConfig, robot_config: RobotConfig, root_folder: Path):
9+
def __init__(
10+
self,
11+
config: AnalyzerConfig,
12+
robot_config: RobotConfig,
13+
root_folder: Path,
14+
):
1015
self.config = config
1116
self.robot_config = robot_config
1217
self.root_folder = root_folder

packages/analyze/src/robotcode/analyze/cli.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@
33
import click
44
from robotcode.analyze.config import AnalyzerConfig
55
from robotcode.plugin import Application, pass_application
6-
from robotcode.robot.config.loader import load_config_from_path, load_robot_config_from_path
6+
from robotcode.robot.config.loader import (
7+
load_config_from_path,
8+
load_robot_config_from_path,
9+
)
710
from robotcode.robot.config.utils import get_config_files
811

912
from .__version__ import __version__
1013

1114

1215
@click.command(
13-
context_settings={
14-
"allow_extra_args": True,
15-
"ignore_unknown_options": True,
16-
},
16+
context_settings={"allow_extra_args": True, "ignore_unknown_options": True},
1717
add_help_option=True,
1818
)
1919
@click.version_option(
@@ -23,17 +23,17 @@
2323
)
2424
@click.argument("paths", nargs=-1, type=click.Path(exists=True, dir_okay=True))
2525
@pass_application
26-
def analyze(
27-
app: Application,
28-
paths: Tuple[str],
29-
) -> Union[str, int, None]:
26+
def analyze(app: Application, paths: Tuple[str]) -> Union[str, int, None]:
3027
"""TODO: Analyzes a Robot Framework project."""
3128

3229
config_files, root_folder, _ = get_config_files(paths, app.config.config_files, verbose_callback=app.verbose)
3330

3431
try:
3532
analizer_config = load_config_from_path(
36-
AnalyzerConfig, *config_files, tool_name="robotcode-analyze", robot_toml_tool_name="robotcode-analyze"
33+
AnalyzerConfig,
34+
*config_files,
35+
tool_name="robotcode-analyze",
36+
robot_toml_tool_name="robotcode-analyze",
3737
).evaluated()
3838

3939
robot_config = (

packages/core/src/robotcode/core/async_tools.py

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,10 @@ async def __aiter__(self) -> AsyncIterator[_TCallable]:
9090
yield r
9191

9292
async def _notify(
93-
self, *args: Any, callback_filter: Optional[Callable[[_TCallable], bool]] = None, **kwargs: Any
93+
self,
94+
*args: Any,
95+
callback_filter: Optional[Callable[[_TCallable], bool]] = None,
96+
**kwargs: Any,
9497
) -> AsyncIterator[_TResult]:
9598
for method in filter(
9699
lambda x: callback_filter(x) if callback_filter is not None else True,
@@ -118,7 +121,11 @@ async def __call__(self, *args: Any, **kwargs: Any) -> List[_TResult]:
118121

119122
class AsyncEventDescriptorBase(Generic[_TCallable, _TResult, _TEvent]):
120123
def __init__(
121-
self, _func: _TCallable, factory: Callable[..., _TEvent], *factory_args: Any, **factory_kwargs: Any
124+
self,
125+
_func: _TCallable,
126+
factory: Callable[..., _TEvent],
127+
*factory_args: Any,
128+
**factory_kwargs: Any,
122129
) -> None:
123130
self._func = _func
124131
self.__factory = factory
@@ -137,7 +144,11 @@ def __get__(self, obj: Any, objtype: Type[Any]) -> _TEvent:
137144

138145
name = f"__async_event_{self._func.__name__}__"
139146
if not hasattr(obj, name):
140-
setattr(obj, name, self.__factory(*self.__factory_args, **self.__factory_kwargs))
147+
setattr(
148+
obj,
149+
name,
150+
self.__factory(*self.__factory_args, **self.__factory_kwargs),
151+
)
141152

142153
return cast("_TEvent", getattr(obj, name))
143154

@@ -210,7 +221,9 @@ def __call__(self, *args: Any, **kwargs: Any) -> AsyncIterator[Union[_TResult, B
210221
return self._notify(*args, **kwargs)
211222

212223

213-
def _get_name_prefix(descriptor: AsyncEventDescriptorBase[Any, Any, Any]) -> str:
224+
def _get_name_prefix(
225+
descriptor: AsyncEventDescriptorBase[Any, Any, Any],
226+
) -> str:
214227
if descriptor._owner is None:
215228
return type(descriptor).__qualname__
216229

@@ -227,13 +240,19 @@ class async_tasking_event_iterator( # noqa: N801
227240
):
228241
def __init__(self, _func: _TCallable) -> None:
229242
super().__init__(
230-
_func, AsyncTaskingEventIterator[_TCallable, Any], task_name_prefix=lambda: _get_name_prefix(self)
243+
_func,
244+
AsyncTaskingEventIterator[_TCallable, Any],
245+
task_name_prefix=lambda: _get_name_prefix(self),
231246
)
232247

233248

234249
class async_tasking_event(AsyncEventDescriptorBase[_TCallable, Any, AsyncTaskingEvent[_TCallable, Any]]): # noqa: N801
235250
def __init__(self, _func: _TCallable) -> None:
236-
super().__init__(_func, AsyncTaskingEvent[_TCallable, Any], task_name_prefix=lambda: _get_name_prefix(self))
251+
super().__init__(
252+
_func,
253+
AsyncTaskingEvent[_TCallable, Any],
254+
task_name_prefix=lambda: _get_name_prefix(self),
255+
)
237256

238257

239258
async def check_canceled() -> bool:
@@ -418,7 +437,10 @@ async def __aenter__(self) -> None:
418437
await self.acquire()
419438

420439
async def __aexit__(
421-
self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]
440+
self,
441+
exc_type: Optional[Type[BaseException]],
442+
exc_val: Optional[BaseException],
443+
exc_tb: Optional[TracebackType],
422444
) -> None:
423445
self.release()
424446

@@ -568,7 +590,10 @@ def get_current_future_info() -> Optional[FutureInfo]:
568590

569591

570592
def create_sub_task(
571-
coro: Coroutine[Any, Any, _T], *, name: Optional[str] = None, loop: Optional[asyncio.AbstractEventLoop] = None
593+
coro: Coroutine[Any, Any, _T],
594+
*,
595+
name: Optional[str] = None,
596+
loop: Optional[asyncio.AbstractEventLoop] = None,
572597
) -> asyncio.Task[_T]:
573598
ct = get_current_future_info()
574599

@@ -578,7 +603,9 @@ def create_sub_task(
578603
else:
579604

580605
async def create_task(
581-
lo: asyncio.AbstractEventLoop, c: Coroutine[Any, Any, _T], n: Optional[str]
606+
lo: asyncio.AbstractEventLoop,
607+
c: Coroutine[Any, Any, _T],
608+
n: Optional[str],
582609
) -> asyncio.Task[_T]:
583610
return create_sub_task(c, name=n, loop=lo)
584611

@@ -593,7 +620,9 @@ async def create_task(
593620
return result
594621

595622

596-
def create_sub_future(loop: Optional[asyncio.AbstractEventLoop] = None) -> asyncio.Future[Any]:
623+
def create_sub_future(
624+
loop: Optional[asyncio.AbstractEventLoop] = None,
625+
) -> asyncio.Future[Any]:
597626
ct = get_current_future_info()
598627

599628
if loop is None:

packages/core/src/robotcode/core/concurrent.py

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
11
import inspect
22
from concurrent.futures import CancelledError, Future
33
from threading import Event, RLock, Thread, current_thread, local
4-
from typing import Any, Callable, Dict, Generic, List, Optional, Tuple, TypeVar, cast, overload
4+
from typing import (
5+
Any,
6+
Callable,
7+
Dict,
8+
Generic,
9+
List,
10+
Optional,
11+
Tuple,
12+
TypeVar,
13+
cast,
14+
overload,
15+
)
516

617
from typing_extensions import ParamSpec
718

@@ -70,7 +81,10 @@ def __init__(self) -> None:
7081

7182

7283
def _run_callable_in_thread_handler(
73-
future: FutureEx[_TResult], callable: Callable[..., _TResult], args: Tuple[Any, ...], kwargs: Dict[str, Any]
84+
future: FutureEx[_TResult],
85+
callable: Callable[..., _TResult],
86+
args: Tuple[Any, ...],
87+
kwargs: Dict[str, Any],
7488
) -> None:
7589
if not future.set_running_or_notify_cancel():
7690
return
@@ -106,7 +120,7 @@ def check_current_thread_canceled(at_least_seconds: Optional[float] = None, rais
106120

107121
if raise_exception:
108122
name = current_thread().name
109-
raise CancelledError(f"Thread {name+' ' if name else ' '}cancelled")
123+
raise CancelledError(f"Thread {name + ' ' if name else ' '}cancelled")
110124

111125
return True
112126

@@ -127,7 +141,9 @@ def run_in_thread(callable: Callable[_P, _TResult], *args: _P.args, **kwargs: _P
127141
future: FutureEx[_TResult] = FutureEx()
128142
with _running_callables_lock:
129143
thread = Thread(
130-
target=_run_callable_in_thread_handler, args=(future, callable, args, kwargs), name=str(callable)
144+
target=_run_callable_in_thread_handler,
145+
args=(future, callable, args, kwargs),
146+
name=str(callable),
131147
)
132148
_running_callables[future] = thread
133149
future.add_done_callback(_remove_future_from_running_callables)

packages/core/src/robotcode/core/event.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,11 @@ def __get__(self, obj: Any, objtype: Type[Any]) -> _TEvent:
138138

139139
name = f"__event_{self._func.__name__}__"
140140
if not hasattr(obj, name):
141-
setattr(obj, name, self.__factory(*self.__factory_args, **self.__factory_kwargs))
141+
setattr(
142+
obj,
143+
name,
144+
self.__factory(*self.__factory_args, **self.__factory_kwargs),
145+
)
142146

143147
return cast("_TEvent", getattr(obj, name))
144148

packages/core/src/robotcode/core/lsp/types.py

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3453,7 +3453,8 @@ class CodeLens(CamelSnakeMixin):
34533453
source text, like the number of references, a way to run tests, etc.
34543454
34553455
A code lens is _unresolved_ when no command is associated to it. For performance
3456-
reasons the creation of a code lens and resolving should be done in two stages."""
3456+
reasons the creation of a code lens and resolving should be done in two stages.
3457+
"""
34573458

34583459
range: Range
34593460
"""The range in which this code lens is valid. Should only span a single line."""
@@ -3944,27 +3945,15 @@ def __iter__(self) -> Iterator[Position]:
39443945
@staticmethod
39453946
def zero() -> Range:
39463947
return Range(
3947-
start=Position(
3948-
line=0,
3949-
character=0,
3950-
),
3951-
end=Position(
3952-
line=0,
3953-
character=0,
3954-
),
3948+
start=Position(line=0, character=0),
3949+
end=Position(line=0, character=0),
39553950
)
39563951

39573952
@staticmethod
39583953
def invalid() -> Range:
39593954
return Range(
3960-
start=Position(
3961-
line=-1,
3962-
character=-1,
3963-
),
3964-
end=Position(
3965-
line=-1,
3966-
character=-1,
3967-
),
3955+
start=Position(line=-1, character=-1),
3956+
end=Position(line=-1, character=-1),
39683957
)
39693958

39703959
def extend(
@@ -4835,7 +4824,11 @@ class ServerCapabilities(CamelSnakeMixin):
48354824
# Since: 3.16.0
48364825

48374826
linked_editing_range_provider: Optional[
4838-
Union[bool, LinkedEditingRangeOptions, LinkedEditingRangeRegistrationOptions]
4827+
Union[
4828+
bool,
4829+
LinkedEditingRangeOptions,
4830+
LinkedEditingRangeRegistrationOptions,
4831+
]
48394832
] = None
48404833
"""The server provides linked editing range support.
48414834
@@ -7164,7 +7157,10 @@ class TextDocumentColorPresentationOptions(CamelSnakeMixin):
71647157
# Since: 3.17.0
71657158

71667159

7167-
DocumentDiagnosticReport = Union[RelatedFullDocumentDiagnosticReport, RelatedUnchangedDocumentDiagnosticReport]
7160+
DocumentDiagnosticReport = Union[
7161+
RelatedFullDocumentDiagnosticReport,
7162+
RelatedUnchangedDocumentDiagnosticReport,
7163+
]
71687164
"""The result of a document diagnostic pull request. A report can
71697165
either be a full report containing all diagnostics for the
71707166
requested document or an unchanged report indicating that nothing
@@ -7198,7 +7194,8 @@ class PrepareRenameResultType2(CamelSnakeMixin):
71987194

71997195

72007196
WorkspaceDocumentDiagnosticReport = Union[
7201-
WorkspaceFullDocumentDiagnosticReport, WorkspaceUnchangedDocumentDiagnosticReport
7197+
WorkspaceFullDocumentDiagnosticReport,
7198+
WorkspaceUnchangedDocumentDiagnosticReport,
72027199
]
72037200
"""A workspace diagnostic document report.
72047201

packages/core/src/robotcode/core/uri.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,16 @@ def __iter__(self) -> Iterator[str]:
3131
yield from astuple(self)
3232

3333
def __hash__(self) -> int:
34-
return hash((self.scheme, self.netloc, self.path, self.params, self.query, self.fragment))
34+
return hash(
35+
(
36+
self.scheme,
37+
self.netloc,
38+
self.path,
39+
self.params,
40+
self.query,
41+
self.fragment,
42+
)
43+
)
3544

3645

3746
class Uri(Mapping[str, str]):

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,10 @@ def get(self, func: Callable[..., _T], *args: Any, **kwargs: Any) -> _T:
5757

5858
@staticmethod
5959
def _make_key(*args: Any, **kwargs: Any) -> Tuple[Any, ...]:
60-
return (tuple(_freeze(v) for v in args), hash(frozenset({k: _freeze(v) for k, v in kwargs.items()})))
60+
return (
61+
tuple(_freeze(v) for v in args),
62+
hash(frozenset({k: _freeze(v) for k, v in kwargs.items()})),
63+
)
6164

6265
def clear(self) -> None:
6366
with self._lock:

0 commit comments

Comments
 (0)