Skip to content

Commit e62becd

Browse files
Remove redundant explicit type for from_int
1 parent bd098ce commit e62becd

10 files changed

Lines changed: 16 additions & 27 deletions

src/action.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ Returns an iterator yielding the generators.
232232
thing.def(
233233
"position",
234234
[](Action_& self, const_reference_point_type pt) {
235-
return from_int<index_type>(self.position(pt));
235+
return from_int(self.position(pt));
236236
},
237237
py::arg("pt"),
238238
R"pbdoc(

src/aho-corasick.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,7 @@ Copy a :any:`AhoCorasick` object.
9090
"child",
9191
[](AhoCorasick const& self,
9292
AhoCorasick::index_type parent,
93-
letter_type letter) {
94-
return from_int<AhoCorasick::index_type>(self.child(parent, letter));
95-
},
93+
letter_type letter) { return from_int(self.child(parent, letter)); },
9694
py::arg("parent"),
9795
py::arg("letter"),
9896
R"pbdoc(

src/cong-common.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -409,9 +409,7 @@ Copy a :any:`{name}` object.
409409
doc extra_doc) {
410410
thing.def(
411411
"number_of_classes",
412-
[](Thing& self) {
413-
return from_int<uint64_t>(self.number_of_classes());
414-
},
412+
[](Thing& self) { return from_int(self.number_of_classes()); },
415413
make_doc(R"pbdoc(
416414
:sig=(self: {name}) -> int | PositiveInfinity:
417415
{only_document_once}

src/froidure-pin.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ See :any:`add_generator` for a detailed description.
206206
thing.def(
207207
"current_position",
208208
[](FroidurePin_ const& self, Element const& x) {
209-
return from_int<uint32_t>(self.current_position(x));
209+
return from_int(self.current_position(x));
210210
},
211211
py::arg("x").noconvert(),
212212
R"pbdoc(
@@ -713,7 +713,7 @@ elements are sorted, or :any:`UNDEFINED` if *i* is greater than
713713
m.def(
714714
"froidure_pin_current_position",
715715
[](FroidurePinBase const& fpb, word_type const& w) {
716-
return from_int<uint32_t>(froidure_pin::current_position(fpb, w));
716+
return from_int(froidure_pin::current_position(fpb, w));
717717
},
718718
py::arg("fpb"),
719719
py::arg("w"),

src/paths.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ are no more paths in the range, and ``False`` otherwise.
150150
"count",
151151
[](Paths_& p) {
152152
p.throw_if_source_undefined();
153-
return from_int<uint64_t>(p.count());
153+
return from_int(p.count());
154154
},
155155
R"pbdoc(
156156
:sig=(self: Paths) -> int | PositiveInfinity:
@@ -200,9 +200,7 @@ Get the current path in the range.
200200
)pbdoc");
201201
thing1.def(
202202
"max",
203-
[](Paths_ const& self) {
204-
return from_int<decltype(self.max())>(self.max());
205-
},
203+
[](Paths_ const& self) { return from_int(self.max()); },
206204
R"pbdoc(
207205
:sig=(self: Paths) -> int | PositiveInfinity:
208206
:only-document-once:

src/present.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -823,8 +823,7 @@ If no such word can be found, then a word of length :math:`0` is returned.
823823
m.def(
824824
"make_semigroup",
825825
[](Presentation_& p) {
826-
using letter_type = Presentation_::letter_type;
827-
return from_int<letter_type>(presentation::make_semigroup<Word>(p));
826+
return from_int(presentation::make_semigroup<Word>(p));
828827
},
829828
py::arg("p"),
830829
R"pbdoc(

src/stephen.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -397,8 +397,7 @@ This function triggers the algorithm implemented in this class (if it hasn't bee
397397
m.def(
398398
"stephen_number_of_left_factors",
399399
[](Stephen_& s, size_t min, size_t max) {
400-
return from_int<uint64_t>(
401-
stephen::number_of_left_factors(s, min, max));
400+
return from_int(stephen::number_of_left_factors(s, min, max));
402401
},
403402
py::arg("s"),
404403
py::arg("min") = 0,
@@ -440,8 +439,7 @@ in the range *min* to *max*.
440439
m.def(
441440
"stephen_number_of_words_accepted",
442441
[](Stephen_& s, size_t min, size_t max) {
443-
return from_int<uint64_t>(
444-
stephen::number_of_words_accepted(s, min, max));
442+
return from_int(stephen::number_of_words_accepted(s, min, max));
445443
},
446444
py::arg("s"),
447445
py::arg("min") = 0,

src/todd-coxeter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ semigroup.
242242
thing.def(
243243
"current_index_of",
244244
[](ToddCoxeter_ const& self, Word const& w) {
245-
return from_int<uint32_t>(todd_coxeter::current_index_of(self, w));
245+
return from_int(todd_coxeter::current_index_of(self, w));
246246
},
247247
py::arg("w"),
248248
R"pbdoc(

src/ukkonen.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ namespace libsemigroups {
4141
uk.def(
4242
"index",
4343
[](Ukkonen const& self, Word const& w) {
44-
return from_int<Ukkonen::index_type>(self.index(w.begin(), w.end()));
44+
return from_int(self.index(w.begin(), w.end()));
4545
},
4646
py::arg("w"),
4747
R"pbdoc(
@@ -378,7 +378,7 @@ contained in *u*. If no such suffix exists, then an empty word is returned.
378378
m.def(
379379
"number_of_pieces",
380380
[](Ukkonen const& u, Word const& w) {
381-
return from_int<size_t>(ukkonen::number_of_pieces(u, w));
381+
return from_int(ukkonen::number_of_pieces(u, w));
382382
},
383383
py::arg("u"),
384384
py::arg("w"),
@@ -621,9 +621,7 @@ The index of the first letter in the edge leading to the node.
621621
// TODO should the others here also be def_property_readonly?
622622
node.def_property_readonly(
623623
"parent",
624-
[](Ukkonen::Node const& node) {
625-
return from_int<decltype(node.parent)>(node.parent);
626-
},
624+
[](Ukkonen::Node const& node) { return from_int(node.parent); },
627625
R"pbdoc(
628626
The index of the parent node.
629627
)pbdoc");

src/word-graph.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ the word graph.
200200
[](WordGraph_ const& self, node_type source) {
201201
auto result
202202
= (self.targets(source) | rx::transform([](node_type target) {
203-
return from_int<node_type>(target);
203+
return from_int(target);
204204
}));
205205
return py::make_iterator(rx::begin(result), rx::end(result));
206206
},
@@ -552,7 +552,7 @@ out_degree())`` , then this function adds an edge from *a* to *b* labelled *a*.
552552
thing.def(
553553
"target",
554554
[](WordGraph_ const& self, node_type source, label_type a) {
555-
return from_int<node_type>(self.target(source, a));
555+
return from_int(self.target(source, a));
556556
},
557557
py::arg("source"),
558558
py::arg("a"),

0 commit comments

Comments
 (0)