From aa374239e815589519ab82e3e6a7ffbfdf893e33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Malte=20Mo=CC=88ser?= Date: Fri, 21 Feb 2020 14:13:42 -0500 Subject: [PATCH] fix: replace range::view with range::views --- blockscipy/src/blocksci_iterator_type.cpp | 4 ++-- blockscipy/src/blocksci_range_type.cpp | 4 ++-- blockscipy/src/chain/blockchain_py.cpp | 2 +- .../src/cluster/cluster/cluster_proxy_py.cpp | 2 +- blockscipy/src/generic_proxy.cpp | 4 ++-- .../src/generic_proxy/range_map_optional_impl.hpp | 4 ++-- .../src/generic_proxy/range_map_sequence_impl.hpp | 2 +- .../src/generic_proxy/range_map_simple_impl.hpp | 2 +- blockscipy/src/generic_sequence.cpp | 4 ++-- blockscipy/src/proxy_py_create.hpp | 4 ++-- blockscipy/src/python_range_conversion.cpp | 8 ++++---- .../equiv_address/equiv_address_proxy_py.cpp | 14 +++++++------- .../src/scripts/pubkey/pubkey_proxy_impl.hpp | 2 +- .../witness_unknown/witness_unknown_proxy_py.cpp | 2 +- 14 files changed, 29 insertions(+), 29 deletions(-) diff --git a/blockscipy/src/blocksci_iterator_type.cpp b/blockscipy/src/blocksci_iterator_type.cpp index 26ff7a78..c3367fe5 100644 --- a/blockscipy/src/blocksci_iterator_type.cpp +++ b/blockscipy/src/blocksci_iterator_type.cpp @@ -26,7 +26,7 @@ pybind11::object BlocksciIteratorType::toObject() const { RawIterator BlocksciIteratorType::toGeneric() { return mpark::visit([&](auto &r) -> RawIterator { - return r | ranges::view::transform([](auto && v) -> BlocksciType { + return r | ranges::views::transform([](auto && v) -> BlocksciType { return BlocksciType{std::forward(v)}; }); }, var); @@ -34,7 +34,7 @@ RawIterator BlocksciIteratorType::toGeneric() { RawIterator BlocksciIteratorType::toAnySequence() { return mpark::visit([&](auto &r) -> RawIterator { - return r | ranges::view::transform([](auto && v) -> std::any { + return r | ranges::views::transform([](auto && v) -> std::any { return std::forward(v); }); }, var); diff --git a/blockscipy/src/blocksci_range_type.cpp b/blockscipy/src/blocksci_range_type.cpp index eb615f4e..2b42e74a 100644 --- a/blockscipy/src/blocksci_range_type.cpp +++ b/blockscipy/src/blocksci_range_type.cpp @@ -38,7 +38,7 @@ BlocksciIteratorType BlocksciRangeType::toIterator() { RawRange BlocksciRangeType::toGeneric() { return mpark::visit([&](auto &r) -> RawRange { - return r | ranges::view::transform([](auto && v) -> BlocksciType { + return r | ranges::views::transform([](auto && v) -> BlocksciType { return BlocksciType{std::forward(v)}; }); }, var); @@ -46,7 +46,7 @@ RawRange BlocksciRangeType::toGeneric() { RawRange BlocksciRangeType::toAnySequence() { return mpark::visit([&](auto &r) -> RawRange { - return r | ranges::view::transform([](auto && v) -> std::any { + return r | ranges::views::transform([](auto && v) -> std::any { return std::forward(v); }); }, var); diff --git a/blockscipy/src/chain/blockchain_py.cpp b/blockscipy/src/chain/blockchain_py.cpp index 7e7b6272..9d538d82 100644 --- a/blockscipy/src/chain/blockchain_py.cpp +++ b/blockscipy/src/chain/blockchain_py.cpp @@ -29,7 +29,7 @@ namespace { struct PythonScriptRangeFunctor { static PythonScriptRangeVariant f(blocksci::DataAccess &access) { auto scriptCount = getScriptCount(type, access); - return PythonScriptRange{ranges::view::ints(uint32_t{1}, scriptCount + 1) | ranges::view::transform([&](uint32_t scriptNum) { + return PythonScriptRange{ranges::views::ints(uint32_t{1}, scriptCount + 1) | ranges::views::transform([&](uint32_t scriptNum) { return ScriptAddress(scriptNum, access); })}; } diff --git a/blockscipy/src/cluster/cluster/cluster_proxy_py.cpp b/blockscipy/src/cluster/cluster/cluster_proxy_py.cpp index 6870d720..150fdd6a 100644 --- a/blockscipy/src/cluster/cluster/cluster_proxy_py.cpp +++ b/blockscipy/src/cluster/cluster/cluster_proxy_py.cpp @@ -37,7 +37,7 @@ struct AddClusterMethods { return cluster.getInputs(); }, "Returns an iterator over all inputs spent from this cluster"); func(property_tag, "addresses", +[](const Cluster &cluster) -> RawIterator { - return ranges::any_view{ranges::view::transform(cluster.getAddresses(), [](Address && address) -> AnyScript { + return ranges::any_view{ranges::views::transform(cluster.getAddresses(), [](Address && address) -> AnyScript { return address.getScript(); })}; }, "Get a iterable over all the addresses in the cluster"); diff --git a/blockscipy/src/generic_proxy.cpp b/blockscipy/src/generic_proxy.cpp index d4d6faa3..7ff01a90 100644 --- a/blockscipy/src/generic_proxy.cpp +++ b/blockscipy/src/generic_proxy.cpp @@ -50,7 +50,7 @@ std::function(std::any &)> SimpleProxy::getGeneri std::function SimpleProxy::getGenericRange() const { return [generic = getGenericSimple()](std::any &v) -> BlocksciRangeType { return mpark::visit([](auto && val) -> BlocksciRangeType { - return BlocksciRangeType{RawRange>{ranges::view::single(std::forward(val))}}; + return BlocksciRangeType{RawRange>{ranges::views::single(std::forward(val))}}; }, generic(v).var); }; } @@ -59,4 +59,4 @@ std::function ProxyAddress::getGenericSimple() const { return [generic = getGenericScript()](std::any &val) -> BlocksciType { return BlocksciType{generic(val)}; }; - } \ No newline at end of file + } diff --git a/blockscipy/src/generic_proxy/range_map_optional_impl.hpp b/blockscipy/src/generic_proxy/range_map_optional_impl.hpp index 230c0b02..9b5d1d71 100644 --- a/blockscipy/src/generic_proxy/range_map_optional_impl.hpp +++ b/blockscipy/src/generic_proxy/range_map_optional_impl.hpp @@ -26,14 +26,14 @@ namespace { template RawIterator::value_type> flattenOptional(T && t) { - return ranges::view::transform(ranges::view::filter(std::forward(t), isOptional), derefOptional); + return ranges::views::transform(ranges::views::filter(std::forward(t), isOptional), derefOptional); } } template Proxy> mapOptional(IteratorProxy &p, Proxy> &p2) { return liftGeneric(p, [p2](auto && seq) -> RawIterator { - return flattenOptional(ranges::view::transform(std::forward(seq).toAnySequence(), p2)); + return flattenOptional(ranges::views::transform(std::forward(seq).toAnySequence(), p2)); }); } diff --git a/blockscipy/src/generic_proxy/range_map_sequence_impl.hpp b/blockscipy/src/generic_proxy/range_map_sequence_impl.hpp index a9751a1b..e284bb56 100644 --- a/blockscipy/src/generic_proxy/range_map_sequence_impl.hpp +++ b/blockscipy/src/generic_proxy/range_map_sequence_impl.hpp @@ -18,7 +18,7 @@ template Proxy> mapSequence(IteratorProxy &p, Proxy> &p2) { return liftGeneric(p, [p2](auto && seq) -> RawIterator { - return ranges::view::join(ranges::view::transform(std::forward(seq).toAnySequence(), p2)); + return ranges::views::join(ranges::views::transform(std::forward(seq).toAnySequence(), p2)); }); } diff --git a/blockscipy/src/generic_proxy/range_map_simple_impl.hpp b/blockscipy/src/generic_proxy/range_map_simple_impl.hpp index 0e2e985a..1bd940de 100644 --- a/blockscipy/src/generic_proxy/range_map_simple_impl.hpp +++ b/blockscipy/src/generic_proxy/range_map_simple_impl.hpp @@ -21,7 +21,7 @@ template Proxy> mapSimple(proxy_sequence &p, Proxy &p2) { return liftGeneric(p, [p2](auto && seq) -> ranges::any_view { - return ranges::view::transform(std::forward(seq).toAnySequence(), p2); + return ranges::views::transform(std::forward(seq).toAnySequence(), p2); }); } diff --git a/blockscipy/src/generic_sequence.cpp b/blockscipy/src/generic_sequence.cpp index 06048f2b..e3fa629a 100644 --- a/blockscipy/src/generic_sequence.cpp +++ b/blockscipy/src/generic_sequence.cpp @@ -11,7 +11,7 @@ RawIterator GenericIterator::getAllIterator() { return mpark::visit([](auto && seq) -> RawIterator { - return ranges::view::transform(std::forward(seq), [](auto && item) -> std::any { + return ranges::views::transform(std::forward(seq), [](auto && item) -> std::any { return std::forward(item); }); }, getGenericIterator().var); @@ -20,7 +20,7 @@ RawIterator GenericIterator::getAllIterator() { RawRange GenericRange::getAllRange() { return mpark::visit([](auto && seq) -> RawRange { - return ranges::view::transform(std::forward(seq), [](auto && item) -> std::any { + return ranges::views::transform(std::forward(seq), [](auto && item) -> std::any { return std::forward(item); }); }, getGenericRange().var); diff --git a/blockscipy/src/proxy_py_create.hpp b/blockscipy/src/proxy_py_create.hpp index 6db294bb..cfc52638 100644 --- a/blockscipy/src/proxy_py_create.hpp +++ b/blockscipy/src/proxy_py_create.hpp @@ -61,9 +61,9 @@ AllProxyClasses createProxyClasses(pybind11::module &m) { return {std::function(std::any &)>{[p](std::any & v) -> RawRange { auto val = p(v); if (val) { - return ranges::view::single(*val); + return ranges::views::single(*val); } else { - return ranges::view::empty(); + return ranges::views::empty; } }}, p.sourceType}; })) diff --git a/blockscipy/src/python_range_conversion.cpp b/blockscipy/src/python_range_conversion.cpp index 2883d9a3..81192b89 100644 --- a/blockscipy/src/python_range_conversion.cpp +++ b/blockscipy/src/python_range_conversion.cpp @@ -59,7 +59,7 @@ struct NumpyConverter { template pybind11::array_t>()))> convertRandomSizedNumpy(T && t) { - auto numpy_converted = ranges::view::transform(std::move(t), NumpyConverter{}); + auto numpy_converted = ranges::views::transform(std::move(t), NumpyConverter{}); auto rangeSize = static_cast(ranges::size(numpy_converted)); pybind11::array_t> ret{rangeSize}; auto retPtr = ret.mutable_data(); @@ -70,7 +70,7 @@ convertRandomSizedNumpy(T && t) { template pybind11::array_t>()))> convertInputNumpy(T && t) { - auto ret = ranges::to_vector(ranges::view::transform(std::move(t), NumpyConverter{})); + auto ret = ranges::to_vector(ranges::views::transform(std::move(t), NumpyConverter{})); return pybind11::array_t{ret.size(), ret.data()}; } @@ -98,13 +98,13 @@ py::list convertInputPy(T && t) { template Iterator>()))> convertInputBlockSci(T && t) { - return ranges::any_view>()))>{ranges::view::transform(std::forward(t), BlockSciTypeConverter{})}; + return ranges::any_view>()))>{ranges::views::transform(std::forward(t), BlockSciTypeConverter{})}; } template Range>()))> convertRandomSizedBlockSci(T && t) { - return ranges::any_view>())), random_access_sized>{ranges::view::transform(std::forward(t), BlockSciTypeConverter{})}; + return ranges::any_view>())), random_access_sized>{ranges::views::transform(std::forward(t), BlockSciTypeConverter{})}; } diff --git a/blockscipy/src/scripts/equiv_address/equiv_address_proxy_py.cpp b/blockscipy/src/scripts/equiv_address/equiv_address_proxy_py.cpp index e66761fc..c7912ab7 100644 --- a/blockscipy/src/scripts/equiv_address/equiv_address_proxy_py.cpp +++ b/blockscipy/src/scripts/equiv_address/equiv_address_proxy_py.cpp @@ -29,21 +29,21 @@ struct AddEquivAddressMethods { func(property_tag, "is_script_equiv", &EquivAddress::isScriptEquiv, "Returns whether this equiv address is script equivalent or not"); func(method_tag, "balance", &EquivAddress::calculateBalance, "Calculates the balance held by these equivalent addresses at the height (Defaults to the full chain)", py::arg("height") = -1); func(property_tag, "addresses", +[](const EquivAddress &address) -> RawIterator { - return ranges::view::ints(0, 1) | ranges::view::transform([address](int) { - return address | ranges::view::transform([](const Address &address) { + return ranges::views::ints(0, 1) | ranges::views::transform([address](int) { + return address | ranges::views::transform([](const Address &address) { return address.getScript(); }); - }) | ranges::view::join; + }) | ranges::views::join; }, "Calculate balance"); func(property_tag, "outs", +[](const EquivAddress &address) -> RawIterator { - return ranges::view::ints(0, 1) | ranges::view::transform([address](int) { + return ranges::views::ints(0, 1) | ranges::views::transform([address](int) { return address.getOutputs(); - }) | ranges::view::join; + }) | ranges::views::join; }, "Returns an iterator over all outputs sent to these equivalent addresses"); func(property_tag, "ins", +[](EquivAddress &address) -> RawIterator { - return ranges::view::ints(0, 1) | ranges::view::transform([address](int) { + return ranges::views::ints(0, 1) | ranges::views::transform([address](int) { return address.getInputs(); - }) | ranges::view::join; + }) | ranges::views::join; }, "Returns an iterator over all inputs spent from these equivalent addresses"); func(method_tag, "out_txes_count", +[](EquivAddress &address) -> int64_t { return address.getOutputTransactions().size(); diff --git a/blockscipy/src/scripts/pubkey/pubkey_proxy_impl.hpp b/blockscipy/src/scripts/pubkey/pubkey_proxy_impl.hpp index 53262209..77b526aa 100644 --- a/blockscipy/src/scripts/pubkey/pubkey_proxy_impl.hpp +++ b/blockscipy/src/scripts/pubkey/pubkey_proxy_impl.hpp @@ -26,7 +26,7 @@ struct AddPubkeyBaseMethods { void operator()(FuncApplication func) { using namespace blocksci; func(method_tag, "find_multisigs", +[](const T &script) -> RawIterator { - return script.getIncludingMultisigs() | ranges::view::transform([](Address && address) -> script::Multisig { + return script.getIncludingMultisigs() | ranges::views::transform([](Address && address) -> script::Multisig { return mpark::get(address.getScript().wrapped); }); }, "List of multisigs which include this public key"); diff --git a/blockscipy/src/scripts/witness_unknown/witness_unknown_proxy_py.cpp b/blockscipy/src/scripts/witness_unknown/witness_unknown_proxy_py.cpp index c62a181a..9a9e69b5 100644 --- a/blockscipy/src/scripts/witness_unknown/witness_unknown_proxy_py.cpp +++ b/blockscipy/src/scripts/witness_unknown/witness_unknown_proxy_py.cpp @@ -34,7 +34,7 @@ struct AddWitnessUnknownMethods { if (stack) { py::list list; RANGES_FOR(auto && item, *stack) { - auto charVector = item | ranges::view::transform([](auto && c) -> char { return c; } ) | ranges::to_vector; + auto charVector = item | ranges::views::transform([](auto && c) -> char { return c; } ) | ranges::to_vector; list.append(py::bytes(std::string{charVector.begin(), charVector.end()})); } return list;