Update pre-commit hooks
This commit is contained in:
parent
736b390427
commit
0d2a9a9fbc
@ -1,23 +1,23 @@
|
||||
repos:
|
||||
- repo: https://github.com/pre-commit/mirrors-mypy
|
||||
rev: v1.8.0
|
||||
rev: d4911cfb7f1010759fde68da196036feeb25b99d # frozen: v1.11.2
|
||||
hooks:
|
||||
- id: mypy
|
||||
additional_dependencies:
|
||||
- types-docutils
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v4.5.0
|
||||
rev: cef0300fd0fc4d2a87a85fa2093c6b283ea36f4b # frozen: v5.0.0
|
||||
hooks:
|
||||
- id: check-yaml
|
||||
exclude: '.\.gaphor'
|
||||
- id: trailing-whitespace
|
||||
- repo: https://github.com/shellcheck-py/shellcheck-py
|
||||
rev: v0.9.0.6
|
||||
rev: a23f6b85d0fdd5bb9d564e2579e678033debbdff # frozen: v0.10.0.1
|
||||
hooks:
|
||||
- id: shellcheck
|
||||
args: [--exclude, SC1017]
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
rev: 'v0.1.14'
|
||||
rev: '75b98813cfb7e663870a28c74366a1e99d7bfe79' # frozen: v0.6.9
|
||||
hooks:
|
||||
- id: ruff
|
||||
args: [--fix, --preview]
|
||||
|
@ -1,4 +1,5 @@
|
||||
"""The action definition for the C4 Model toolbox."""
|
||||
|
||||
from functools import partial
|
||||
|
||||
from gaphas.item import SE
|
||||
|
@ -1,4 +1,5 @@
|
||||
"""The action definition for the RAAML toolbox."""
|
||||
|
||||
from gaphor.diagram.diagramtoolbox import (
|
||||
DiagramType,
|
||||
DiagramTypes,
|
||||
|
@ -1,6 +1,5 @@
|
||||
"""Property item."""
|
||||
|
||||
|
||||
from gaphor import UML
|
||||
from gaphor.core.modeling.properties import attribute
|
||||
from gaphor.diagram.presentation import ElementPresentation, Named
|
||||
|
@ -1,4 +1,5 @@
|
||||
"""The definition for the actions section of the toolbox."""
|
||||
|
||||
from functools import partial
|
||||
|
||||
from gaphas.item import SE
|
||||
|
@ -148,6 +148,7 @@ class ActivityPage(PropertyPageBase):
|
||||
signal_handlers=text_field_handlers("parameter"),
|
||||
),
|
||||
],
|
||||
strict=False,
|
||||
):
|
||||
column.set_factory(factory)
|
||||
|
||||
|
@ -4,7 +4,6 @@ Contains also implementation to split flows using activity edge
|
||||
connectors.
|
||||
"""
|
||||
|
||||
|
||||
from gaphor import UML
|
||||
from gaphor.diagram.presentation import LinePresentation, Named, text_name
|
||||
from gaphor.diagram.shapes import Box, CssNode, Text, draw_arrow_tail
|
||||
|
@ -1,6 +1,5 @@
|
||||
"""Activity Partition item."""
|
||||
|
||||
|
||||
from gaphas.geometry import Rectangle
|
||||
from gaphas.item import NW, SE
|
||||
from gaphas.types import Pos
|
||||
|
@ -1,6 +1,5 @@
|
||||
"""Flow item connection adapters tests."""
|
||||
|
||||
|
||||
import pytest as pytest
|
||||
|
||||
from gaphor import UML
|
||||
|
@ -116,7 +116,7 @@ class AssociationConnect(RelationshipConnect):
|
||||
if relation:
|
||||
relation.memberEnd[0].type = head_subject
|
||||
relation.memberEnd[1].type = tail_subject
|
||||
for end, nav in zip(relation.memberEnd, self._navigabilities):
|
||||
for end, nav in zip(relation.memberEnd, self._navigabilities, strict=False):
|
||||
UML.recipes.set_navigability(relation, end, nav)
|
||||
else:
|
||||
relation = self.new_relation(head_subject, tail_subject)
|
||||
|
@ -276,6 +276,7 @@ class AttributesPage(PropertyPageBase):
|
||||
signal_handlers=check_button_handlers("static"),
|
||||
),
|
||||
],
|
||||
strict=False,
|
||||
):
|
||||
column.set_factory(factory)
|
||||
|
||||
@ -466,6 +467,7 @@ class OperationsPage(PropertyPageBase):
|
||||
signal_handlers=check_button_handlers("static"),
|
||||
),
|
||||
],
|
||||
strict=False,
|
||||
):
|
||||
column.set_factory(factory)
|
||||
|
||||
|
@ -130,6 +130,7 @@ class EnumerationPage(PropertyPageBase):
|
||||
signal_handlers=text_field_handlers("enumeration"),
|
||||
),
|
||||
],
|
||||
strict=False,
|
||||
):
|
||||
column.set_factory(factory)
|
||||
|
||||
|
@ -5,7 +5,6 @@ possible to folded interface, see `gaphor.diagram.classes.interface`
|
||||
documentation for details.
|
||||
"""
|
||||
|
||||
|
||||
from gaphor.diagram.connectors import Connector
|
||||
from gaphor.UML.classes.classconnect import DependencyConnect
|
||||
from gaphor.UML.classes.dependency import DependencyItem
|
||||
|
@ -1,6 +1,5 @@
|
||||
"""Implementation of interface."""
|
||||
|
||||
|
||||
from gaphor import UML
|
||||
from gaphor.core.styling import Style
|
||||
from gaphor.diagram.presentation import LinePresentation, Named, text_name
|
||||
|
@ -1,6 +1,5 @@
|
||||
"""Test connector item connectors."""
|
||||
|
||||
|
||||
from gaphor import UML
|
||||
from gaphor.diagram.tests.fixtures import allow, connect, disconnect
|
||||
from gaphor.UML.classes.component import ComponentItem
|
||||
|
@ -20,6 +20,7 @@ What's the difference?
|
||||
Stick with BehaviorExecutionSpecification, since it has a [0..1] relation to
|
||||
behavior, whereas ActionExecutionSpecification has a [1] relation to action.
|
||||
"""
|
||||
|
||||
from gaphas import Handle
|
||||
from gaphas.connector import Position
|
||||
from gaphas.constraint import constraint
|
||||
@ -123,7 +124,7 @@ class ExecutionSpecificationItem(
|
||||
def load(self, name, value):
|
||||
if name == "points":
|
||||
points = literal_eval(value)
|
||||
for h, p in zip(self._handles, points):
|
||||
for h, p in zip(self._handles, points, strict=False):
|
||||
h.pos = p
|
||||
elif name == "head-connection":
|
||||
self._load_head_connection = value
|
||||
|
@ -1,4 +1,5 @@
|
||||
"""Test messages."""
|
||||
|
||||
import pytest
|
||||
from gaphas.item import SE
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
"""Stereotype property page."""
|
||||
|
||||
from unicodedata import normalize
|
||||
|
||||
from gi.repository import Gdk, Gio, GLib, GObject, Gtk
|
||||
@ -102,6 +103,7 @@ def stereotype_set_model_with_interaction(stereotype_list, model):
|
||||
signal_handlers=text_field_handlers("slot_value"),
|
||||
),
|
||||
],
|
||||
strict=False,
|
||||
):
|
||||
column.set_factory(factory)
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
"""The Sanitize module is dedicated to adapters (stuff) that keeps the model
|
||||
clean and in sync with diagrams."""
|
||||
|
||||
|
||||
from typing import Iterable
|
||||
|
||||
from gaphor import UML
|
||||
|
@ -88,7 +88,7 @@ class StateItem(ElementPresentation[UML.State], Named):
|
||||
def region_at_point(self, pos: Pos) -> Element | None:
|
||||
region_offset = self.height - sum(self._region_heights)
|
||||
_x, y = pos
|
||||
for region, h in zip(self.subject.region, self._region_heights):
|
||||
for region, h in zip(self.subject.region, self._region_heights, strict=False):
|
||||
region_offset += h
|
||||
if y < region_offset:
|
||||
return region
|
||||
|
@ -68,7 +68,7 @@ class StateMachineItem(Classified, ElementPresentation[UML.StateMachine]):
|
||||
def region_at_point(self, pos: Pos) -> Element | None:
|
||||
region_offset = self.height - sum(self._region_heights)
|
||||
_x, y = pos
|
||||
for region, h in zip(self.subject.region, self._region_heights):
|
||||
for region, h in zip(self.subject.region, self._region_heights, strict=False):
|
||||
region_offset += h
|
||||
if y < region_offset:
|
||||
return region
|
||||
|
@ -1,4 +1,5 @@
|
||||
"""Test transition item and state vertices connections."""
|
||||
|
||||
import pytest
|
||||
|
||||
from gaphor import UML
|
||||
|
@ -6,7 +6,6 @@ operations. The regular expressions are constructed based on a series of
|
||||
attribute/operation.
|
||||
"""
|
||||
|
||||
|
||||
import contextlib
|
||||
|
||||
__all__ = ["parse_property", "parse_operation"]
|
||||
|
@ -78,7 +78,7 @@ class ActorItem(Classified, ElementPresentation):
|
||||
|
||||
def update(self, context):
|
||||
super().update(context)
|
||||
_xs, ys = list(zip(*self.shape.sizes))
|
||||
_xs, ys = list(zip(*self.shape.sizes, strict=False))
|
||||
self.text_height = sum(ys)
|
||||
|
||||
def point(self, x: float, y: float) -> float:
|
||||
|
@ -103,9 +103,11 @@ def main(
|
||||
)
|
||||
overrides = Overrides(overridesfile) if overridesfile else None
|
||||
|
||||
with open(outfile, "w", encoding="utf-8") if outfile else contextlib.nullcontext(
|
||||
sys.stdout
|
||||
) as out: # type: ignore[attr-defined]
|
||||
with (
|
||||
open(outfile, "w", encoding="utf-8")
|
||||
if outfile
|
||||
else contextlib.nullcontext(sys.stdout) as out # type: ignore[attr-defined]
|
||||
):
|
||||
for line in coder(model, super_models, overrides):
|
||||
print(line, file=out)
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
Everything is about services so the Case can define it's required
|
||||
services and start off.
|
||||
"""
|
||||
|
||||
# ruff: noqa: I001
|
||||
from __future__ import annotations
|
||||
|
||||
|
@ -29,12 +29,10 @@ class collection(Generic[T]):
|
||||
self.remove(key)
|
||||
|
||||
@overload
|
||||
def __getitem__(self, key: int) -> T:
|
||||
...
|
||||
def __getitem__(self, key: int) -> T: ...
|
||||
|
||||
@overload # Literal[slice(None, None, None)]
|
||||
def __getitem__(self, key: slice) -> recurseproxy[T]:
|
||||
...
|
||||
def __getitem__(self, key: slice) -> recurseproxy[T]: ...
|
||||
|
||||
def __getitem__(self, key):
|
||||
if key == _recurseproxy_trigger:
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
Diagrams can be visualized and edited.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
@ -390,16 +391,13 @@ class Diagram(Element):
|
||||
@overload
|
||||
def select(
|
||||
self, expression: Callable[[Presentation], bool]
|
||||
) -> Iterator[Presentation]:
|
||||
...
|
||||
) -> Iterator[Presentation]: ...
|
||||
|
||||
@overload
|
||||
def select(self, expression: type[P]) -> Iterator[P]:
|
||||
...
|
||||
def select(self, expression: type[P]) -> Iterator[P]: ...
|
||||
|
||||
@overload
|
||||
def select(self, expression: None) -> Iterator[Presentation]:
|
||||
...
|
||||
def select(self, expression: None) -> Iterator[Presentation]: ...
|
||||
|
||||
def select(self, expression=None):
|
||||
"""Return an iterator of all canvas items that match expression."""
|
||||
@ -503,5 +501,4 @@ class Diagram(Element):
|
||||
|
||||
@runtime_checkable
|
||||
class PresentationRepositoryProtocol(Protocol):
|
||||
def create_as(self, type: type[P], id: str, diagram: Diagram) -> P:
|
||||
...
|
||||
def create_as(self, type: type[P], id: str, diagram: Diagram) -> P: ...
|
||||
|
@ -257,42 +257,34 @@ Handler = Callable[[ElementUpdated], None]
|
||||
|
||||
|
||||
class RepositoryProtocol(Protocol):
|
||||
def create(self, type: type[T]) -> T:
|
||||
...
|
||||
def create(self, type: type[T]) -> T: ...
|
||||
|
||||
def create_as(self, type: type[T], id: str) -> T:
|
||||
...
|
||||
def create_as(self, type: type[T], id: str) -> T: ...
|
||||
|
||||
@overload
|
||||
def select(self, expression: Callable[[Element], bool]) -> Iterator[Element]:
|
||||
...
|
||||
def select(self, expression: Callable[[Element], bool]) -> Iterator[Element]: ...
|
||||
|
||||
@overload
|
||||
def select(self, type_: type[T]) -> Iterator[T]:
|
||||
...
|
||||
def select(self, type_: type[T]) -> Iterator[T]: ...
|
||||
|
||||
@overload
|
||||
def select(self, expression: None) -> Iterator[Element]:
|
||||
...
|
||||
def select(self, expression: None) -> Iterator[Element]: ...
|
||||
|
||||
def lookup(self, id: str) -> Element | None:
|
||||
...
|
||||
def lookup(self, id: str) -> Element | None: ...
|
||||
|
||||
def watcher(
|
||||
self, element: Element, default_handler: Handler | None = None
|
||||
) -> EventWatcherProtocol:
|
||||
...
|
||||
) -> EventWatcherProtocol: ...
|
||||
|
||||
def handle(self, event: object) -> None:
|
||||
...
|
||||
def handle(self, event: object) -> None: ...
|
||||
|
||||
|
||||
class EventWatcherProtocol(Protocol):
|
||||
def watch(self, path: str, handler: Handler | None = None) -> EventWatcherProtocol:
|
||||
...
|
||||
def watch(
|
||||
self, path: str, handler: Handler | None = None
|
||||
) -> EventWatcherProtocol: ...
|
||||
|
||||
def unsubscribe_all(self) -> None:
|
||||
...
|
||||
def unsubscribe_all(self) -> None: ...
|
||||
|
||||
|
||||
def swap_element_type(element: Element, new_class: type[Element]) -> None:
|
||||
|
@ -31,8 +31,7 @@ P = TypeVar("P", bound=Presentation)
|
||||
|
||||
|
||||
class EventHandler(Protocol):
|
||||
def handle(self, *events):
|
||||
...
|
||||
def handle(self, *events): ...
|
||||
|
||||
|
||||
class RecordingEventManager:
|
||||
@ -134,16 +133,13 @@ class ElementFactory(Service):
|
||||
return self.lookup(element.id) is element
|
||||
|
||||
@overload
|
||||
def select(self, expression: Callable[[Element], bool]) -> Iterator[Element]:
|
||||
...
|
||||
def select(self, expression: Callable[[Element], bool]) -> Iterator[Element]: ...
|
||||
|
||||
@overload
|
||||
def select(self, expression: type[T]) -> Iterator[T]:
|
||||
...
|
||||
def select(self, expression: type[T]) -> Iterator[T]: ...
|
||||
|
||||
@overload
|
||||
def select(self, expression: None) -> Iterator[Element]:
|
||||
...
|
||||
def select(self, expression: None) -> Iterator[Element]: ...
|
||||
|
||||
def select(self, expression=None):
|
||||
"""Iterate elements that comply with expression."""
|
||||
|
@ -65,53 +65,39 @@ E = TypeVar("E")
|
||||
|
||||
|
||||
class relation_one(Protocol[E]):
|
||||
def get(self, obj) -> E | None:
|
||||
...
|
||||
def get(self, obj) -> E | None: ...
|
||||
|
||||
def set(self, obj, value: E | None) -> None:
|
||||
...
|
||||
def set(self, obj, value: E | None) -> None: ...
|
||||
|
||||
def delete(self, obj, value: E | None) -> None:
|
||||
...
|
||||
def delete(self, obj, value: E | None) -> None: ...
|
||||
|
||||
@overload
|
||||
def __get__(self, obj: None, class_=None) -> relation_one[E]:
|
||||
...
|
||||
def __get__(self, obj: None, class_=None) -> relation_one[E]: ...
|
||||
|
||||
@overload
|
||||
def __get__(self, obj, class_=None) -> E:
|
||||
...
|
||||
def __get__(self, obj, class_=None) -> E: ...
|
||||
|
||||
def __set__(self, obj, value: E | None) -> None:
|
||||
...
|
||||
def __set__(self, obj, value: E | None) -> None: ...
|
||||
|
||||
def __delete__(self, obj) -> None:
|
||||
...
|
||||
def __delete__(self, obj) -> None: ...
|
||||
|
||||
|
||||
class relation_many(Protocol[E]):
|
||||
def get(self, obj) -> collection[E]:
|
||||
...
|
||||
def get(self, obj) -> collection[E]: ...
|
||||
|
||||
def set(self, obj, value: E) -> None:
|
||||
...
|
||||
def set(self, obj, value: E) -> None: ...
|
||||
|
||||
def delete(self, obj, value: E) -> None:
|
||||
...
|
||||
def delete(self, obj, value: E) -> None: ...
|
||||
|
||||
@overload
|
||||
def __get__(self, obj: None, class_=None) -> relation_many[E]:
|
||||
...
|
||||
def __get__(self, obj: None, class_=None) -> relation_many[E]: ...
|
||||
|
||||
@overload
|
||||
def __get__(self, obj, class_=None) -> collection[E]:
|
||||
...
|
||||
def __get__(self, obj, class_=None) -> collection[E]: ...
|
||||
|
||||
def __set__(self, obj, value: E) -> None:
|
||||
...
|
||||
def __set__(self, obj, value: E) -> None: ...
|
||||
|
||||
def __delete__(self, obj) -> None:
|
||||
...
|
||||
def __delete__(self, obj) -> None: ...
|
||||
|
||||
|
||||
relation = Union[relation_one, relation_many]
|
||||
|
@ -78,14 +78,11 @@ class StyleNode(Hashable, Protocol):
|
||||
pseudo: str | None
|
||||
dark_mode: bool | None
|
||||
|
||||
def name(self) -> str:
|
||||
...
|
||||
def name(self) -> str: ...
|
||||
|
||||
def parent(self) -> StyleNode | None:
|
||||
...
|
||||
def parent(self) -> StyleNode | None: ...
|
||||
|
||||
def children(self) -> Iterator[StyleNode]:
|
||||
...
|
||||
def children(self) -> Iterator[StyleNode]: ...
|
||||
|
||||
def attribute(self, name: str) -> str | None:
|
||||
"""Obtain a string representation of an attribute.
|
||||
@ -93,8 +90,7 @@ class StyleNode(Hashable, Protocol):
|
||||
If the attribute does not exist, ``None`` is returned.
|
||||
"""
|
||||
|
||||
def state(self) -> Sequence[str]:
|
||||
...
|
||||
def state(self) -> Sequence[str]: ...
|
||||
|
||||
|
||||
def merge_styles(*styles: Style) -> Style:
|
||||
|
@ -314,7 +314,13 @@ class CompoundSelector:
|
||||
def specificity(self):
|
||||
if self.simple_selectors:
|
||||
return tuple(
|
||||
map(sum, zip(*(sel.specificity for sel in self.simple_selectors)))
|
||||
map(
|
||||
sum,
|
||||
zip(
|
||||
*(sel.specificity for sel in self.simple_selectors),
|
||||
strict=False,
|
||||
),
|
||||
)
|
||||
)
|
||||
return 0, 0, 0
|
||||
|
||||
|
@ -30,17 +30,13 @@ class ConnectorProtocol(Protocol):
|
||||
self,
|
||||
element: Presentation,
|
||||
line: Presentation,
|
||||
) -> None:
|
||||
...
|
||||
) -> None: ...
|
||||
|
||||
def allow(self, handle: Handle, port: Port) -> bool:
|
||||
...
|
||||
def allow(self, handle: Handle, port: Port) -> bool: ...
|
||||
|
||||
def connect(self, handle: Handle, port: Port) -> bool:
|
||||
...
|
||||
def connect(self, handle: Handle, port: Port) -> bool: ...
|
||||
|
||||
def disconnect(self, handle: Handle) -> None:
|
||||
...
|
||||
def disconnect(self, handle: Handle) -> None: ...
|
||||
|
||||
|
||||
class BaseConnector:
|
||||
|
@ -210,7 +210,7 @@ def _paste(copy_data: Opaque, diagram: Diagram, full: bool) -> set[Presentation]
|
||||
model = diagram.model
|
||||
|
||||
# Map the original diagram ids to our new target diagram
|
||||
new_elements: dict[Id, Element] = {ref: diagram for ref in copy_data.diagram_refs}
|
||||
new_elements: dict[Id, Element] = dict.fromkeys(copy_data.diagram_refs, diagram)
|
||||
|
||||
def element_lookup(ref: Id):
|
||||
if ref in new_elements:
|
||||
|
@ -1,6 +1,5 @@
|
||||
"""CommentItem diagram item."""
|
||||
|
||||
|
||||
from gaphor.core.modeling import Comment
|
||||
from gaphor.diagram.presentation import ElementPresentation
|
||||
from gaphor.diagram.shapes import Box, CssNode, Text, stroke
|
||||
|
@ -197,11 +197,9 @@ def rectangle_shrink(rect: Rectangle | None, padding: Padding) -> Rectangle:
|
||||
class Shape(Iterable, Protocol):
|
||||
def size(
|
||||
self, context: UpdateContext, bounding_box: Rectangle | None = None
|
||||
) -> tuple[Number, Number]:
|
||||
...
|
||||
) -> tuple[Number, Number]: ...
|
||||
|
||||
def draw(self, context: DrawContext, bounding_box: Rectangle) -> None:
|
||||
...
|
||||
def draw(self, context: DrawContext, bounding_box: Rectangle) -> None: ...
|
||||
|
||||
|
||||
DEFAULT_PADDING = (0, 0, 0, 0)
|
||||
@ -249,7 +247,7 @@ class Box:
|
||||
self.sizes = sizes = [
|
||||
c.size(child_context, new_bounds) for c in self.children
|
||||
]
|
||||
widths, heights = list(zip(*sizes))
|
||||
widths, heights = list(zip(*sizes, strict=False))
|
||||
is_vertical = self._orientation == Orientation.VERTICAL
|
||||
padding_top, padding_right, padding_bottom, padding_left = padding
|
||||
return (
|
||||
@ -322,7 +320,7 @@ class Box:
|
||||
x = bounding_box.x + padding_left
|
||||
w = bounding_box.width - padding_right - padding_left
|
||||
last_child = self.children[-1]
|
||||
for c, (_w, h) in zip(self.children, sizes):
|
||||
for c, (_w, h) in zip(self.children, sizes, strict=False):
|
||||
if c is last_child and justify_content is JustifyContent.START:
|
||||
h = bounding_box.height - y
|
||||
elif h < avg_height:
|
||||
@ -371,7 +369,7 @@ class Box:
|
||||
y = bounding_box.y + padding_top
|
||||
h = bounding_box.height - padding_bottom - padding_top
|
||||
last_child = self.children[-1]
|
||||
for c, (w, _h) in zip(self.children, sizes):
|
||||
for c, (w, _h) in zip(self.children, sizes, strict=False):
|
||||
if c is last_child and justify_content is JustifyContent.START:
|
||||
w = bounding_box.width - x
|
||||
elif w < avg_width:
|
||||
@ -429,7 +427,7 @@ class IconBox:
|
||||
vertical_align = style.get("vertical-align", VerticalAlign.BOTTOM)
|
||||
vertical_spacing = style.get("vertical-spacing", 0) # should be margin?
|
||||
|
||||
ws, hs = list(zip(*self.sizes))
|
||||
ws, hs = list(zip(*self.sizes, strict=False))
|
||||
max_w = max(ws)
|
||||
total_h = sum(hs)
|
||||
|
||||
@ -465,7 +463,7 @@ class IconBox:
|
||||
style={k: v for k, v in context.style.items() if k != "padding"}, # type: ignore[arg-type]
|
||||
)
|
||||
cx, cy, max_w, _total_h = self.child_pos(style, bounding_box)
|
||||
for c, (cw, ch) in zip(self.children, self.sizes):
|
||||
for c, (cw, ch) in zip(self.children, self.sizes, strict=False):
|
||||
c.draw(child_context, Rectangle(cx + (max_w - cw) / 2, cy, cw, ch))
|
||||
cy += ch
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
"""Support classes for dealing with text."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from gaphas.canvas import instant_cairo_context
|
||||
|
@ -1,7 +1,6 @@
|
||||
"""Magnet tool pulls or pushes the right or bottom side depending on mouse
|
||||
movement."""
|
||||
|
||||
|
||||
import contextlib
|
||||
|
||||
from gaphas.canvas import ancestors
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
Translate text in to your native language using the gettext() function.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import functools
|
||||
|
@ -15,6 +15,7 @@ Plugins can be registered in Gaphor by declaring them as service entry point::
|
||||
There is a thin line between a service and a plugin. A service typically performs some basic need for the applications (such as the element factory or the undo mechanism). A plugin is more of an add-on. For example a plugin can depend on external libraries or provide a cross-over function between two applications.
|
||||
|
||||
"""
|
||||
|
||||
import contextlib
|
||||
import importlib.abc
|
||||
import importlib.machinery
|
||||
|
@ -180,7 +180,7 @@ class AutoLayout:
|
||||
assert len(points) == len(presentation.handles())
|
||||
|
||||
matrix = presentation.matrix_i2c.inverse()
|
||||
for handle, point in zip(presentation.handles(), points):
|
||||
for handle, point in zip(presentation.handles(), points, strict=False):
|
||||
handle.pos = matrix.transform_point(*point)
|
||||
|
||||
for handle in (presentation.head, presentation.tail):
|
||||
|
@ -4,7 +4,6 @@ system.
|
||||
These are things like preferences.
|
||||
"""
|
||||
|
||||
|
||||
import ast
|
||||
import logging
|
||||
import pprint
|
||||
|
@ -5,6 +5,7 @@
|
||||
* Variables
|
||||
* Solver: add_constraint, remove_constraint
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from gaphas.connector import Handle
|
||||
from gaphas.segment import Segment
|
||||
|
@ -26,13 +26,13 @@ def loader(element_factory, modeling_language):
|
||||
def test_upgrade_metaclass_item_to_class_item(loader):
|
||||
item = loader(element(id="2", type="MetaclassItem"))[0]
|
||||
|
||||
assert type(item) == diagramitems.ClassItem
|
||||
assert type(item) is diagramitems.ClassItem
|
||||
|
||||
|
||||
def test_upgrade_subsystem_item_to_class_item(loader):
|
||||
item = loader(element(id="2", type="SubsystemItem"))[0]
|
||||
|
||||
assert type(item) == diagramitems.ComponentItem
|
||||
assert type(item) is diagramitems.ComponentItem
|
||||
|
||||
|
||||
def test_rename_stereotype_attrs_field(loader):
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
(help browser anyone?)
|
||||
"""
|
||||
|
||||
import logging
|
||||
import sys
|
||||
import webbrowser
|
||||
|
@ -6,6 +6,7 @@ Install our schema:
|
||||
glib-compile-schemas ~/.local/share/glib-2.0/schemas/
|
||||
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import shutil
|
||||
import subprocess
|
||||
|
@ -1,6 +1,5 @@
|
||||
"""Defines a status window class for displaying the progress of a queue."""
|
||||
|
||||
|
||||
from gaphas.decorators import g_async
|
||||
from gi.repository import Gtk, Pango
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
Usage:
|
||||
python -m gaphor.ui.uipreview <ui file>
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
@ -240,6 +240,7 @@ ignore_errors = true
|
||||
|
||||
[tool.ruff]
|
||||
line-length = 88
|
||||
target-version = "py311"
|
||||
|
||||
[tool.ruff.lint]
|
||||
exclude = [
|
||||
@ -251,7 +252,11 @@ exclude = [
|
||||
"gaphor/SysML/sysml.py",
|
||||
"gaphor/UML/uml.py",
|
||||
]
|
||||
ignore = ["E501"]
|
||||
ignore = [
|
||||
"E501",
|
||||
"B909",
|
||||
"C419",
|
||||
]
|
||||
select = [
|
||||
"B",
|
||||
"B9",
|
||||
|
@ -1,7 +1,6 @@
|
||||
"""Diagram could not be loaded due to JuggleError (presumed cyclic resolving of
|
||||
diagram items)."""
|
||||
|
||||
|
||||
from gaphor import UML
|
||||
from gaphor.storage.storage import load
|
||||
from gaphor.UML.classes.association import (
|
||||
|
Loading…
Reference in New Issue
Block a user