Skip to content

Commit 682fb61

Browse files
Make properties read-only where appropriate
1 parent cca6f53 commit 682fb61

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

src/dot.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,9 @@ render it with the `Graphviz <https://www.graphviz.org>`_
5252
installation on your system.
5353
)pbdoc");
5454
dot.def("__repr__", py::overload_cast<Dot const&>(&to_human_readable_repr));
55-
dot.def_property(
55+
dot.def_property_readonly(
5656
"colors",
5757
[](Dot const& self) { return Dot::colors; },
58-
[]() {}, // TODO raise exception
5958
R"pbdoc(
6059
An array of default HTML/hex colours.
6160
)pbdoc");
@@ -357,10 +356,9 @@ This nested class represents a node in the represented graph.
357356
)pbdoc");
358357
n.def("__repr__",
359358
py::overload_cast<Dot::Node const&>(&to_human_readable_repr));
360-
n.def_property(
359+
n.def_property_readonly(
361360
"attrs",
362361
[](Dot::Node& self) { return self.attrs; },
363-
[]() {},
364362
R"pbdoc(
365363
Read-only dictionary containing the attributes of the node.
366364
)pbdoc");
@@ -397,10 +395,9 @@ Instances of this nested class represents an edge in the represented graph.
397395
)pbdoc");
398396
e.def("__repr__",
399397
py::overload_cast<Dot::Edge const&>(&to_human_readable_repr));
400-
e.def_property(
398+
e.def_property_readonly(
401399
"attrs",
402400
[](Dot::Edge& self) { return self.attrs; },
403-
[]() {},
404401
R"pbdoc(
405402
Read-only dictionary containing containing the attributes of the :any:`Edge`.
406403
)pbdoc");

0 commit comments

Comments
 (0)