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
13 changes: 9 additions & 4 deletions src/aho-corasick.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,17 @@ Construct an :any:`AhoCorasick` containing only the root that corresponds to
the empty word :math:`\varepsilon`.)pbdoc");

thing.def(
"__copy__",
[](const AhoCorasick& that) { return AhoCorasick(that); },
"copy",
[](AhoCorasick const& self) { return AhoCorasick(self); },
R"pbdoc(
Default copy constructor.
:sig=(self: AhoCorasick) -> AhoCorasick:

Default copy constructor)pbdoc");
Copy a :any:`AhoCorasick` object.

:returns: A copy.
:rtype: AhoCorasick)pbdoc");
thing.def("__copy__",
[](AhoCorasick const& self) { return AhoCorasick(self); });

thing.def("child",
&AhoCorasick::child,
Expand Down
3 changes: 0 additions & 3 deletions src/bmat8.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,6 @@ lists in ``rows``.
R"pbdoc(
Copy a BMat8.

:param other: the BMat8 to copy.
:type other: BMat8

:returns: A copy of the argument.
:rtype: BMat8
)pbdoc");
Expand Down
11 changes: 11 additions & 0 deletions src/dot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,17 @@ Default constructor that constructs an empty :any:`Dot` object with no nodes,
edges, attributes, or subgraphs.
)pbdoc");
dot.def("__copy__", [](Dot const& d) { return Dot(d); });
dot.def(
"copy",
[](Dot const& d) { return Dot(d); },
R"pbdoc(
:sig=(self: Dot) -> Dot:

Copy a :any:`Dot` object.

:returns: A copy.
:rtype: Dot
)pbdoc");

dot.def("add_node",
&Dot::add_node<std::string const&>,
Expand Down
6 changes: 3 additions & 3 deletions src/froidure-pin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,8 @@ instance and ``False`` if it does not.

Copy and add a list of generators.

This function is equivalent to copy constructing a new :any:`FroidurePin`
instance and then calling :any:`FroidurePin.add_generators` on the copy.
This function is equivalent to copying a :any:`FroidurePin`
instance and then calling :any:`FroidurePin.add_generators` on the copy.
But this function avoids copying the parts of the initial instance that are
immediately invalidated by :any:`FroidurePin.add_generators`.

Expand Down Expand Up @@ -403,7 +403,7 @@ immediately invalidated by :any:`FroidurePin.add_generators`.

Copy and add non-redundant generators.

This function is equivalent to copy constructing a new :any:`FroidurePin`
This function is equivalent to copying a :any:`FroidurePin`
instance and then calling :any:`closure` on the copy. But this function
avoids copying the parts of the initial :any:`FroidurePin` instance that are
immediately discarded by :any:`closure`.
Expand Down
11 changes: 11 additions & 0 deletions src/gabow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,17 @@ at most :math:`O(mn)` where ``m`` is :any:`WordGraph.number_of_nodes()` and
thing.def("__repr__",
[](Gabow_ const& g) { return to_human_readable_repr(g); });
thing.def("__copy__", [](Gabow_ const& g) { return Gabow_(g); });
thing.def(
"copy",
[](Gabow_ const& self) { return Gabow_(self); },
R"pbdoc(
:sig=(self: Gabow) -> Gabow:

Copy a :any:`Gabow` object.

:returns: A copy.
:rtype: Gabow
)pbdoc");
thing.def(py::init<WordGraph<node_type> const&>(),
py::arg("wg"),
R"pbdoc(
Expand Down
15 changes: 13 additions & 2 deletions src/knuth-bendix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -359,9 +359,20 @@ redundant in this way, then ``None`` is returned.
return to_human_readable_repr(nfr);
});

thing.def("__copy__", [](NormalFormRange const& nfr) {
return NormalFormRange(nfr);
thing.def("__copy__", [](NormalFormRange const& self) {
return NormalFormRange(self);
});
thing.def(
"copy",
[](NormalFormRange const& self) { return NormalFormRange(self); },
R"pbdoc(
:sig=(self: NormalFormRange) -> NormalFormRange:

Copy a :any:`NormalFormRange` object.

:returns: A copy.
:rtype: NormalFormRange
)pbdoc");
// __len__ is not allowed to return anything other than an int, hence
// __len__ and count don't have the same behaviour.
thing.def("__len__", [](NormalFormRange const& nfr) {
Expand Down
3 changes: 0 additions & 3 deletions src/konieczny.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,6 @@ the size, partial order of :math:`\mathscr{D}`-classes, and frames for each
:sig=(self: Konieczny) -> Konieczny:
Copy a Konieczny.

:param other: the Konieczny to copy.
:type other: Konieczny

:returns: A copy of the argument.
:rtype: Konieczny
)pbdoc");
Expand Down
11 changes: 11 additions & 0 deletions src/paths.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,17 @@ paths in a :any:`WordGraph` from a given :any:`source` (to a possible
thing1.def("__repr__",
[](Paths_ const& p) { return to_human_readable_repr(p); });
thing1.def("__copy__", [](Paths_ const& p) { return Paths_(p); });
thing1.def(
"copy",
[](Paths_ const& self) { return Paths_(self); },
R"pbdoc(
:sig=(self: Paths) -> Paths:

Copy a :any:`Paths` object.

:returns: A copy.
:rtype: Paths
)pbdoc");
thing1.def("__or__", [](Paths_ const& p, ToString const& to_str) {
using rx::operator|;
return p | to_str;
Expand Down
32 changes: 23 additions & 9 deletions src/present.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,18 @@ Default constructor.

Constructs an empty presentation with no rules and no alphabet.)pbdoc");
thing.def(
"__copy__",
[](const Presentation_& that) { return Presentation_(that); },
"copy",
[](Presentation_ const& self) { return Presentation_(self); },
R"pbdoc(
Default copy constructor.
:sig=(self: Presentation) -> Presentation:

Copy a :any:`Presentation` object.

Default copy constructor)pbdoc");
:returns: A copy.
:rtype: Presentation
)pbdoc");
thing.def("__copy__",
[](Presentation_ const& that) { return Presentation_(that); });
thing.def(
"alphabet",
[](Presentation_ const& self) { return self.alphabet(); },
Expand Down Expand Up @@ -1289,14 +1295,22 @@ Default constructor.
Constructs an empty :any:`InversePresentation` with no rules, no alphabet and
no inverses.)pbdoc");
thing.def(
"__copy__",
[](const InversePresentation_& that) {
return InversePresentation_(that);
"copy",
[](InversePresentation_ const& self) {
return InversePresentation_(self);
},
R"pbdoc(
Default copy constructor.
:sig=(self: InversePresentation) -> InversePresentation:

Copy a :any:`InversePresentation` object.

:returns: A copy.
:rtype: InversePresentation
)pbdoc");
thing.def("__copy__", [](InversePresentation_ const& that) {
return InversePresentation_(that);
});

Default copy constructor)pbdoc");
thing.def("inverse",
&InversePresentation_::inverse,
py::arg("x"),
Expand Down
13 changes: 11 additions & 2 deletions src/runner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,18 @@ Default construct a :any:`Reporter` object such that the following hold:
- :any:`last_report()` is now;
- :any:`start_time()` is now.
)pbdoc");
thing.def(py::init<Reporter const&>(), R"pbdoc(
Default copy constructor.
thing.def(
"copy",
[](Reporter const& self) { return Reporter(self); },
R"pbdoc(
:sig=(self: Reporter) -> Reporter:

Copy a :any:`Reporter` object.

:returns: A copy.
:rtype: Reporter
)pbdoc");
thing.def("__copy__", [](Reporter const& self) { return Reporter(self); });
thing.def(
"init",
[](Reporter& r) -> Reporter& { return r.init(); },
Expand Down
9 changes: 3 additions & 6 deletions src/schreier-sims.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,19 +79,16 @@ the list *gens*.
)pbdoc");

thing.def("__copy__",
[](const SchreierSims_& that) { return SchreierSims_(that); });
[](SchreierSims_ const& self) { return SchreierSims_(self); });
thing.def(
"copy",
[](SchreierSims_ const& S) { return SchreierSims_(S); },
[](SchreierSims_ const& self) { return SchreierSims_(self); },
R"pbdoc(
:sig=(self: SchreierSims) -> SchreierSims:

Copy a :any:`SchreierSims`.

:param other: the :any:`SchreierSims` to copy.
:type other: SchreierSims

:returns: A copy of the argument.
:returns: A copy.
:rtype: SchreierSims
)pbdoc");
thing.def("add_base_point",
Expand Down
19 changes: 9 additions & 10 deletions src/sims.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -589,17 +589,16 @@ Default constructor.
Constructs a :any:`SimsStats` object with all statistics set to zero.
)pbdoc");

st.def(py::init<SimsStats const&>(),
py::arg("that"),
R"pbdoc(
Copy constructor.

This function returns a :any:`SimsStats` object that is a copy of *that*. The
state of the new :any:`SimsStats` object is the same as *that*. This triggers
an atomic load on the member variables of *that*.
st.def("__copy__", [](SimsStats const& self) { return SimsStats(self); });
st.def(
"copy",
[](SimsStats const& self) { return SimsStats(self); },
R"pbdoc(
Copy a :any:`SimsStats` object.

:param that: the :any:`SimsStats` to copy.
:type that: SimsStats
This function returns a :any:`SimsStats` object that is a copy of *self*. The
state of the new :any:`SimsStats` object is the same as *self*. This triggers
an atomic load on the member variables of *self*.
)pbdoc");

st.def(
Expand Down
6 changes: 3 additions & 3 deletions src/stephen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ This function constructs :any:`Stephen` from a presentation.
R"pbdoc(
:sig=(self: Stephen) -> Stephen:

This function costructs a :any:`Stephen` object by copying another :any:`Stephen` object.
This function returns a copy of a :any:`Stephen` object.

:param s: the :any:`Stephen` object to copy.
:type s: Stephen
:returns: A copy.
:rtype: Stephen
)pbdoc");
thing.def("accept_state",
&Stephen_::accept_state,
Expand Down
3 changes: 0 additions & 3 deletions src/transf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,6 @@ the image of the point ``i`` under the {0} is ``imgs[i]``.
:sig=(self: {1}) -> {1}:
Copy a {0}.

:param self: the {0} to copy.
:type self: {1}

:returns: A copy of the argument.
:rtype: {1}
)pbdoc",
Expand Down
39 changes: 32 additions & 7 deletions src/ukkonen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -581,8 +581,17 @@ Construct from index and position.
:param ppos: the position in the edge leading to vv.
:type ppos: int
)pbdoc");
state.def(py::init<Ukkonen::State const&>(), R"pbdoc(
Default copy constructor.)pbdoc");
state.def(
"copy",
[](Ukkonen::State const& self) { return Ukkonen::State(self); },
R"pbdoc(
:sig=(self: Ukkonen.State) -> Ukkonen.State:

Copy a :any:`Ukkonen.State` object.

:returns: A copy.
:rtype: Ukkonen.State
)pbdoc");
state.def("__copy__",
[](Ukkonen::State const& that) { return Ukkonen::State(that); });
state.def(py::self == py::self, py::arg("that"));
Expand Down Expand Up @@ -639,8 +648,16 @@ Construct a node from left most index, right most index, and parent.
)pbdoc");
node.def("__copy__",
[](Ukkonen::Node const& that) { return Ukkonen::Node(that); });
node.def(py::init<Ukkonen::Node const&>(), R"pbdoc(
Default copy constructor.
node.def(
"copy",
[](Ukkonen::Node const& self) { return Ukkonen::Node(self); },
R"pbdoc(
:sig=(self: Ukkonen.Node) -> Ukkonen.Node:

Copy a :any:`Ukkonen.Node` object.

:returns: A copy.
:rtype: Ukkonen.Node
)pbdoc");
node.def(
"child",
Expand Down Expand Up @@ -697,10 +714,18 @@ The length of the edge leading into the current node.
uk.def(py::init<>(), R"pbdoc(
Constructs an empty generalised suffix tree.
)pbdoc");
uk.def(py::init<Ukkonen const&>(), R"pbdoc(
Default copy constructor.
uk.def(
"copy",
[](Ukkonen const& self) { return Ukkonen(self); },
R"pbdoc(
:sig=(self: Ukkonen) -> Ukkonen:

Copy a :any:`Ukkonen` object.

:returns: A copy.
:rtype: Ukkonen
)pbdoc");
uk.def("__copy__", [](Ukkonen const& that) { return Ukkonen(that); });
uk.def("__copy__", [](Ukkonen const& self) { return Ukkonen(self); });
uk.def("__iter__", [](Ukkonen const& self) {
return py::make_iterator(self.begin(), self.end());
});
Expand Down
Loading