@@ -665,90 +665,76 @@ void unitensor_binding(py::module &m) {
665665
666666 .def (" group_basis_" , &UniTensor::group_basis_)
667667 .def (" group_basis" , &UniTensor::group_basis)
668- .def (
669- " get_block" ,
668+ .def (" get_block" ,
670669 [](const UniTensor &self, const cytnx_uint64 &idx) { return self.get_block (idx); },
671670 py::arg (" idx" ) = (cytnx_uint64)(0 ))
672671
673- .def (
674- " get_block" ,
672+ .def (" get_block" ,
675673 [](const UniTensor &self, const std::vector<cytnx_int64> &qnum, const bool &force) {
676674 return self.get_block (qnum, force);
677675 },
678676 py::arg (" qnum" ), py::arg (" force" ) = false )
679- .def (
680- " get_block" ,
677+ .def (" get_block" ,
681678 [](const UniTensor &self, const std::vector<cytnx_uint64> &qnum, const bool &force) {
682679 return self.get_block (qnum, force);
683680 },
684681 py::arg (" qnum" ), py::arg (" force" ) = false )
685682
686- .def (
687- " get_block" ,
683+ .def (" get_block" ,
688684 [](const UniTensor &self, const std::vector<std::string> &label, const std::vector<cytnx_int64> &qnum, const bool &force) {
689685 return self.get_block (label, qnum, force);
690686 },
691687 py::arg (" labels" ), py::arg (" qnum" ), py::arg (" force" ) = false )
692- .def (
693- " get_block" ,
688+ .def (" get_block" ,
694689 [](const UniTensor &self, const std::vector<std::string> &label, const std::vector<cytnx_uint64> &qnum, const bool &force) {
695690 return self.get_block (label,qnum, force);
696691 },
697692 py::arg (" labels" ), py::arg (" qnum" ), py::arg (" force" ) = false )
698- .def (
699- " get_block_" ,
693+ .def (" get_block_" ,
700694 [](UniTensor &self, const std::vector<cytnx_int64> &qnum, const bool &force) {
701695 return self.get_block_ (qnum, force);
702696 },
703697 py::arg (" qnum" ), py::arg (" force" ) = false )
704- .def (
705- " get_block_" ,
698+ .def (" get_block_" ,
706699 [](UniTensor &self, const std::vector<cytnx_uint64> &qnum, const bool &force) {
707700 return self.get_block_ (qnum, force);
708701 },
709702 py::arg (" qnum" ), py::arg (" force" ) = false )
710703
711- .def (
712- " get_block_" ,
704+ .def (" get_block_" ,
713705 [](UniTensor &self, const std::vector<std::string> &labels, const std::vector<cytnx_int64> &qnum, const bool &force) {
714706 return self.get_block_ (labels, qnum, force);
715707 },
716708 py::arg (" labels" ), py::arg (" qnum" ), py::arg (" force" ) = false )
717- .def (
718- " get_block_" ,
709+ .def (" get_block_" ,
719710 [](UniTensor &self, const std::vector<std::string> &labels, const std::vector<cytnx_uint64> &qnum, const bool &force) {
720711 return self.get_block_ (labels,qnum, force);
721712 },
722713 py::arg (" labels" ), py::arg (" qnum" ), py::arg (" force" ) = false )
723714
724715
725- .def (
726- " get_block_" , [](UniTensor &self, const cytnx_uint64 &idx) { return self.get_block_ (idx); },
716+ .def (" get_block_" , [](UniTensor &self, const cytnx_uint64 &idx) { return self.get_block_ (idx); },
727717 py::arg (" idx" ) = (cytnx_uint64)(0 ))
728718 .def (" get_blocks" , [](const UniTensor &self) { return self.get_blocks (); })
729- .def (
730- " get_blocks_" ,
719+ .def (" get_blocks_" ,
731720 [](const UniTensor& self, py::args args, py::kwargs kwargs) {
732721 return self.get_blocks_ (parse_get_blocks_silent_arg (args, kwargs));
733722 }
734- // ,py::arg("silent") = false // Uncmment this line after removing the deprecated argument.
723+ // ,py::arg("silent") = false // Uncomment this line after removing the deprecated argument.
735724 )
736- .def (
737- " get_blocks_" ,
725+ .def (" get_blocks_" ,
738726 [](UniTensor &self, py::args args, py::kwargs kwargs) {
739727 return self.get_blocks_ (parse_get_blocks_silent_arg (args, kwargs));
740728 }
741- // ,py::arg("silent") = false // Uncmment this line after removing the deprecated argument.
729+ // ,py::arg("silent") = false // Uncomment this line after removing the deprecated argument.
742730)
743- .def (
744- " put_block" ,
731+ .def (" put_block" ,
745732 [](UniTensor &self, const cytnx::Tensor &in, const cytnx_uint64 &idx) {
746733 self.put_block (in, idx);
747734 },
748735 py::arg (" in" ), py::arg (" idx" ) = (cytnx_uint64)(0 ))
749736
750- .def (
751- " put_block" ,
737+ .def (" put_block" ,
752738 [](UniTensor &self, const cytnx::Tensor &in, const std::vector<cytnx_int64> &qnum) {
753739 self.put_block (in, qnum);
754740 },
@@ -758,8 +744,27 @@ void unitensor_binding(py::module &m) {
758744 self.put_block (in, lbls, qnum);
759745 },
760746 py::arg (" in" ), py::arg (" labels" ), py::arg (" qidx" ))
761- .def (
762- " put_block_" ,
747+
748+ // [Deprecated force argument!]
749+ .def (" put_block" ,
750+ [](UniTensor &self, const cytnx::Tensor &in, const std::vector<cytnx_int64> &qnum,
751+ const bool &force) {
752+ py::warnings::warn (" argument 'force' is deprecated and will be removed; use put_block(UniTensor &self, const cytnx::Tensor &in, const std::vector<cytnx_int64> &qnum) instead." ,
753+ PyExc_FutureWarning, 2 );
754+ self.put_block (in, qnum, force);
755+ },
756+ py::arg (" in" ), py::arg (" qidx" ), py::arg (" force" ))
757+ // [Deprecated force argument!]
758+ .def (" put_block" ,
759+ [](UniTensor &self, cytnx::Tensor &in, const std::vector<std::string> &lbls, const std::vector<cytnx_int64> &qnum,
760+ const bool &force) {
761+ py::warnings::warn (" argument 'force' is deprecated and will be removed; use put_block((UniTensor &self, cytnx::Tensor &in, const std::vector<std::string> &lbls, const std::vector<cytnx_int64> &qnum) instead" ,
762+ PyExc_FutureWarning, 2 );
763+ self.put_block (in, lbls, qnum, force);
764+ },
765+ py::arg (" in" ), py::arg (" labels" ), py::arg (" qidx" ), py::arg (" force" ))
766+
767+ .def (" put_block_" ,
763768 [](UniTensor &self, cytnx::Tensor &in, const cytnx_uint64 &idx) { self.put_block_ (in, idx); },
764769 py::arg (" in" ), py::arg (" idx" ) = (cytnx_uint64)(0 ))
765770
@@ -773,8 +778,27 @@ void unitensor_binding(py::module &m) {
773778 self.put_block_ (in, lbls, qnum);
774779 },
775780 py::arg (" in" ), py::arg (" labels" ), py::arg (" qidx" ))
776- .def (
777- " __repr__" ,
781+
782+ // [Deprecated force argument!]
783+ .def (" put_block_" ,
784+ [](UniTensor &self, cytnx::Tensor &in, const std::vector<cytnx_int64> &qnum,
785+ const bool &force) {
786+ py::warnings::warn (" argument 'force' is deprecated and will be removed; use put_block_(UniTensor &self, cytnx::Tensor &in, const std::vector<cytnx_int64> &qnum) instead." ,
787+ PyExc_FutureWarning, 2 );
788+ self.put_block_ (in, qnum, force);
789+ },
790+ py::arg (" in" ), py::arg (" qidx" ), py::arg (" force" ))
791+ // [Deprecated force argument!]
792+ .def (" put_block_" ,
793+ [](UniTensor &self, cytnx::Tensor &in, const std::vector<std::string> &lbls, const std::vector<cytnx_int64> &qnum,
794+ const bool &force) {
795+ py::warnings::warn (" argument 'force' is deprecated and will be removed; use put_block_(UniTensor &self, cytnx::Tensor &in, const std::vector<std::string> &lbls, const std::vector<cytnx_int64> &qnum) instead." ,
796+ PyExc_FutureWarning, 2 );
797+ self.put_block_ (in, lbls, qnum, force);
798+ },
799+ py::arg (" in" ), py::arg (" labels" ), py::arg (" qidx" ), py::arg (" force" ))
800+
801+ .def (" __repr__" ,
778802 [](UniTensor &self) -> std::string {
779803 std::cout << self << std::endl;
780804 return std::string (" " );
0 commit comments