Skip to content

Commit

Permalink
feat: python 3.13 support
Browse files Browse the repository at this point in the history
  • Loading branch information
d-biehl committed Oct 11, 2024
1 parent aa50cc7 commit 3874a9c
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-test-package-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
robot-version: ["rf41", "rf50", "rf60", "rf61", "rf70", "rf71"]
exclude:
- os: macos-latest
Expand Down
2 changes: 1 addition & 1 deletion hatch.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ post-install-commands = ["pip install -U -e {root:uri}/../robotframework"]
python = "3.8"

[[envs.devel.matrix]]
python = ["3.8", "3.9", "3.10", "3.11", "3.12"]
python = ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
rf = ["rf41", "rf50", "rf60", "rf61", "rf70", "rf71"]

[envs.devel.overrides]
Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/robotcode/core/utils/dataclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,8 @@ def add_type_signature_to_cache(t: Type[Any]) -> None:
def _get_signature_cached(t: Type[Any]) -> inspect.Signature:
r = __signature_cache.get(t, __NOT_SET)
if r is __NOT_SET:
if t is bool:
raise ValueError
r = __signature_cache[t] = inspect.signature(t)
return cast(inspect.Signature, r)

Expand Down
19 changes: 8 additions & 11 deletions packages/robot/src/robotcode/robot/utils/markdownformatter.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from __future__ import annotations

import functools
import itertools
import re
from abc import ABC, abstractmethod
Expand Down Expand Up @@ -224,7 +223,7 @@ def __init__(self) -> None:
("*", self._format_bold),
("_", self._format_italic),
("``", self._format_code),
("", functools.partial(LinkFormatter().format_link)),
("", LinkFormatter().format_link),
]

def format(self, line: str) -> str:
Expand All @@ -249,9 +248,10 @@ def _format_code(self, line: str) -> str:
return self._code.sub("\\1`\\3`", line)


class PreformattedFormatter(Formatter):
_format_line = functools.partial(LineFormatter().format)
_line_formatter = LineFormatter()


class PreformattedFormatter(Formatter):
def _handles(self, line: str) -> bool:
return line.startswith("| ") or line == "|"

Expand All @@ -261,8 +261,6 @@ def format(self, lines: List[str]) -> str:


class ParagraphFormatter(Formatter):
_format_line = functools.partial(LineFormatter().format)

def __init__(self, other_formatters: List[Formatter]) -> None:
super().__init__()
self._other_formatters = other_formatters
Expand All @@ -271,18 +269,17 @@ def _handles(self, line: str) -> bool:
return not any(other.handles(line) for other in self._other_formatters)

def format(self, lines: List[str]) -> str:
return self._format_line(" ".join(lines)) + "\n\n"
return _line_formatter.format(" ".join(lines)) + "\n\n"


class ListFormatter(Formatter):
_strip_lines = False
_format_item = functools.partial(LineFormatter().format)

def _handles(self, line: str) -> bool:
return bool(line.strip().startswith("- ") or line.startswith(" ") and self._lines)

def format(self, lines: List[str]) -> str:
items = ["- %s" % self._format_item(line) for line in self._combine_lines(lines)]
items = ["- %s" % _line_formatter.format(line) for line in self._combine_lines(lines)]
return "\n".join(items) + "\n\n"

def _combine_lines(self, lines: List[str]) -> Iterator[str]:
Expand Down Expand Up @@ -311,7 +308,7 @@ def format_line(self, line: str) -> str:
class TableFormatter(Formatter):
_table_line = re.compile(r"^\| (.* |)\|$")
_line_splitter = re.compile(r" \|(?= )")
_format_cell_content = functools.partial(LineFormatter().format)
_format_cell_content = _line_formatter.format

def _handles(self, line: str) -> bool:
return self._table_line.match(line) is not None
Expand Down Expand Up @@ -351,4 +348,4 @@ def _format_cell(self, content: str) -> str:
if content.startswith("=") and content.endswith("="):
content = content[1:-1]

return f" {self._format_cell_content(content).strip()} "
return f" {_line_formatter.format(content).strip()} "
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: Implementation :: CPython",
"Topic :: Software Development :: Testing",
"Topic :: Software Development :: Testing :: Acceptance",
Expand Down

0 comments on commit 3874a9c

Please sign in to comment.