Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ jobs:
experimental: true
steps:
- name: Checkout
uses: actions/checkout@v7.0.0
uses: actions/checkout@v7.0.1
with:
fetch-depth: 0

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6.3.0
uses: actions/setup-python@v7.0.0
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
echo "VERSION=${GITHUB_REF_NAME#v}" | tee -a $GITHUB_ENV

- name: Set up Python
uses: actions/setup-python@v6.3.0
uses: actions/setup-python@v7.0.0
with:
python-version: "3.x"

Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.20
rev: v0.16.1
hooks:
- id: ruff-format
- id: ruff-check
Expand Down
1 change: 1 addition & 0 deletions changes/217.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Updated the dependencies group with 3 updates.
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@

with open("../src/colosseum/__init__.py", encoding="utf8") as version_file:
version_match = re.search(
r"^__version__ = ['\"]([^'\"]*)['\"]", version_file.read(), re.M
r"^__version__ = ['\"]([^'\"]*)['\"]", version_file.read(), re.MULTILINE
)
if version_match:
release = version_match.group(1)
Expand Down
17 changes: 13 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[build-system]
requires = [
"setuptools==83.0.0",
"setuptools_scm==10.2.0",
"setuptools_scm==10.2.1",
]
build-backend = "setuptools.build_meta"

Expand Down Expand Up @@ -42,7 +42,7 @@ classifiers=[
# Extras used by developers *of* colosseum are pinned to specific versions to
# ensure environment consistency.
pre-commit = [
"pre-commit == 4.6.0",
"pre-commit == 4.6.1",
]

test = [
Expand All @@ -54,11 +54,11 @@ towncrier = [
]

tox-uv = [
"tox-uv == 1.35.2",
"tox-uv == 1.36.0",
]

dev = [
"setuptools_scm == 10.0.5",
"setuptools_scm == 10.2.1",
{include-group = "pre-commit"},
{include-group = "test"},
{include-group = "tox-uv"},
Expand Down Expand Up @@ -110,6 +110,15 @@ ignore = [

[tool.ruff.lint.per-file-ignores]
"docs/conf.py" = ["F401"]
# Ignores needed to pass the Ruff 0.16 update.
"src/colosseum/declaration.py" = ["TRY004"]
"src/colosseum/engine.py" = ["TRY002"]
"src/colosseum/parser.py" = ["TRY004"]
"src/colosseum/units.py" = ["RUF012"]
"src/colosseum/wrappers.py" = ["BLE001", "PLC0206", "RUF012"]
"tests/web_platform/css_flexbox_1/*.py" = ["N999"]
"utils/w3c.py" = ["EXE001", "SIM115"]

[tool.setuptools_scm]
# To enable SCM versioning, we need an empty tool configuration for setuptools_scm

Expand Down
6 changes: 2 additions & 4 deletions src/colosseum/colors.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class hsl(Color):
def __init__(self, h, s, l, a=1.0): # noqa: E741
self.h = h
self.s = s
self.l = l # noqa
self.l = l
self.a = a

def __repr__(self):
Expand All @@ -44,9 +44,7 @@ def rgb(self):
r, g, b = x + m, c + m, m
elif h < 3.0:
r, g, b = m, c + m, x + m
elif h < 4.0:
r, g, b = m, x + m, c + m
elif h < 5.0:
elif h < 4.0 or h < 5.0:
r, g, b = m, x + m, c + m
else:
r, g, b = c + m, m, x + m
Expand Down
9 changes: 3 additions & 6 deletions src/colosseum/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,12 +413,10 @@ def calculate_block_non_replaced_normal_flow_width(node, context):
content_width = node.style.width.px(**context)
if node.style.max_width is not None: # 10.4 Maximum width
content_max_width = node.style.max_width.px(**context)
if content_width > content_max_width:
content_width = content_max_width
content_width = min(content_width, content_max_width)
if node.style.min_width is not AUTO: # 10.4 Minimum width
content_min_width = node.style.min_width.px(**context)
if content_width < content_min_width:
content_width = content_min_width
content_width = max(content_width, content_min_width)
size = (
node.layout.border_left_width
+ node.layout.padding_left
Expand Down Expand Up @@ -696,8 +694,7 @@ def calculate_block_non_replaced_normal_flow_height(node, context):
content_height = node.style.height.px(**context)
if node.style.max_height is not None: # 10.7 Maximum height
content_max_height = node.style.max_height.px(**context)
if content_height > content_max_height:
content_height = content_max_height
content_height = min(content_height, content_max_height)

node.layout.content_height = content_height
node.layout.content_top += node.layout.border_top_width + node.layout.padding_top
Expand Down
6 changes: 3 additions & 3 deletions src/colosseum/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def border_spacing(value):
vertical = units(values[1])
return BorderSpacing(horizontal, vertical)

raise ValueError(f"Unknown border spacing {str(value)}")
raise ValueError(f"Unknown border spacing {value!s}")


def rect(value):
Expand Down Expand Up @@ -249,7 +249,7 @@ def quotes(value):
##############################################################################
def _parse_outline_property_part(value, outline_dict):
"""Parse outline shorthand property part for known properties."""
from .constants import ( # noqa
from .constants import (
OUTLINE_COLOR_CHOICES,
OUTLINE_STYLE_CHOICES,
OUTLINE_WIDTH_CHOICES,
Expand Down Expand Up @@ -315,7 +315,7 @@ def outline(value):
##############################################################################
def _parse_border_property_part(value, border_dict, direction=None):
"""Parse border shorthand property part for known properties."""
from .constants import ( # noqa
from .constants import (
BORDER_COLOR_CHOICES,
BORDER_STYLE_CHOICES,
BORDER_WIDTH_CHOICES,
Expand Down
8 changes: 4 additions & 4 deletions src/colosseum/units.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@
__all__ = [
"ch",
"cm",
"deg",
"em",
"ex",
"grad",
"inch",
"mm",
"pc",
"percent",
"pt",
"px",
"rad",
"turn",
"vh",
"vmax",
"vmin",
"vw",
"deg",
"rad",
"grad",
"turn",
]

LU_PER_PIXEL = 64
Expand Down
8 changes: 4 additions & 4 deletions src/colosseum/wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ def __init__(self, horizontal, vertical=None):

def __repr__(self):
if self._vertical is None:
string = f"BorderSpacing({repr(self._horizontal)})"
string = f"BorderSpacing({self._horizontal!r})"
else:
string = f"BorderSpacing({repr(self._horizontal)}, {repr(self._vertical)})"
string = f"BorderSpacing({self._horizontal!r}, {self._vertical!r})"
return string

def __str__(self):
Expand Down Expand Up @@ -106,7 +106,7 @@ def __repr__(self):
items = []
properties = self.to_dict()
for key, value in properties.items():
items.append(f"{key}={repr(value)}")
items.append(f"{key}={value!r}")

class_name = self.__class__.__name__
string = "{class_name}({items})".format(
Expand All @@ -116,7 +116,7 @@ def __repr__(self):

def __str__(self):
parts = []
for key, value in self.to_dict().items():
for value in self.to_dict().values():
parts.append(str(value))

return " ".join(parts)
Expand Down
2 changes: 1 addition & 1 deletion tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def __init__(self, name=None, style=None, children=None):
self.style = style.copy(self) if style else CSS()

def __repr__(self):
return f"<{self.name}:{id(self)} {str(self.layout)}>"
return f"<{self.name}:{id(self)} {self.layout!s}>"


def build_document(data, parent=None):
Expand Down
2 changes: 1 addition & 1 deletion utils/w3c.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def startup(self):
filenames = [
os.path.join(self.root, "css", self.path, f)
for f in os.listdir(os.path.join(self.root, "css", self.path))
if f.endswith(".xht") or f.endswith(".htm") or f.endswith(".html")
if f.endswith((".xht", ".htm", ".html"))
]

loader = Loader.alloc().init()
Expand Down