@@ -539,7 +539,6 @@ def __init__(
539
539
aligned_by : Optional [str ],
540
540
prefix : Optional [str ],
541
541
file_type : Optional [FileType ],
542
- property_groups : Optional [Sequence [PropertyGroup ]],
543
542
jvm_obj : Optional [JavaObject ],
544
543
) -> None :
545
544
"""One should not use this constructor directly, please use `from_scala` or `from_python`."""
@@ -552,9 +551,6 @@ def __init__(
552
551
jvm_adj_list .setAligned_by (aligned_by )
553
552
jvm_adj_list .setPrefix (prefix )
554
553
jvm_adj_list .setFile_type (file_type .value )
555
- jvm_adj_list .setProperty_groups (
556
- [py_property_group .to_scala () for py_property_group in property_groups ],
557
- )
558
554
self ._jvm_adj_list_obj = jvm_adj_list
559
555
560
556
def get_ordered (self ) -> bool :
@@ -615,25 +611,6 @@ def set_file_type(self, file_type: FileType) -> None:
615
611
"""
616
612
self ._jvm_adj_list_obj .setFile_type (file_type .value )
617
613
618
- def get_property_groups (self ) -> Sequence [PropertyGroup ]:
619
- """Get property groups from the corresponding JVM object.
620
-
621
- :returns: property groups
622
- """
623
- return [
624
- PropertyGroup .from_scala (jvm_property_group )
625
- for jvm_property_group in self ._jvm_adj_list_obj .getProperty_groups ()
626
- ]
627
-
628
- def set_property_groups (self , property_groups : Sequence [PropertyGroup ]) -> None :
629
- """Mutate the corresponding JVM object.
630
-
631
- :param property_groups: new property groups
632
- """
633
- self ._jvm_adj_list_obj .setProperty_groups (
634
- [p_group .to_scala () for p_group in property_groups ],
635
- )
636
-
637
614
def get_adj_list_type (self ) -> AdjListType :
638
615
"""Get adj list type.
639
616
@@ -658,7 +635,7 @@ def from_scala(
658
635
:param jvm_obj: scala object in JVM.
659
636
:returns: instance of Python Class.
660
637
"""
661
- return AdjList (None , None , None , None , None , jvm_obj )
638
+ return AdjList (None , None , None , None , jvm_obj )
662
639
663
640
@classmethod
664
641
def from_python (
@@ -667,19 +644,17 @@ def from_python(
667
644
aligned_by : str ,
668
645
prefix : str ,
669
646
file_type : FileType ,
670
- property_groups : Sequence [PropertyGroup ],
671
647
) -> AdjListClassType :
672
648
"""Create an instance of the class from python arguments.
673
649
674
650
:param ordered: ordered flag
675
651
:param aligned_by: recommended values are "src" or "dst"
676
652
:param prefix: path prefix
677
653
:param file_type: file type
678
- :param property_groups: sequence of PropertyGroup objects
679
654
"""
680
655
if not prefix .endswith (os .sep ):
681
656
prefix += os .sep
682
- return AdjList (ordered , aligned_by , prefix , file_type , property_groups , None )
657
+ return AdjList (ordered , aligned_by , prefix , file_type , None )
683
658
684
659
def __eq__ (self , other : object ) -> bool :
685
660
if not isinstance (other , AdjList ):
@@ -690,14 +665,6 @@ def __eq__(self, other: object) -> bool:
690
665
and (self .get_aligned_by () == other .get_aligned_by ())
691
666
and (self .get_prefix () == other .get_prefix ())
692
667
and (self .get_file_type () == other .get_file_type ())
693
- and (len (self .get_property_groups ()) == len (other .get_property_groups ()))
694
- and all (
695
- left_pg == right_pg
696
- for left_pg , right_pg in zip (
697
- self .get_property_groups (),
698
- other .get_property_groups (),
699
- )
700
- )
701
668
)
702
669
703
670
@@ -719,6 +686,7 @@ def __init__(
719
686
directed : Optional [bool ],
720
687
prefix : Optional [str ],
721
688
adj_lists : Sequence [AdjList ],
689
+ property_groups : Optional [Sequence [PropertyGroup ]],
722
690
version : Optional [str ],
723
691
jvm_edge_info_obj : JavaObject ,
724
692
) -> None :
@@ -739,6 +707,9 @@ def __init__(
739
707
edge_info .setAdj_lists (
740
708
[py_adj_list .to_scala () for py_adj_list in adj_lists ],
741
709
)
710
+ edge_info .setProperty_groups (
711
+ [py_property_group .to_scala () for py_property_group in property_groups ],
712
+ )
742
713
edge_info .setVersion (version )
743
714
self ._jvm_edge_info_obj = edge_info
744
715
@@ -873,6 +844,27 @@ def set_adj_lists(self, adj_lists: Sequence[AdjList]) -> None:
873
844
[py_adj_list .to_scala () for py_adj_list in adj_lists ],
874
845
)
875
846
847
+ def get_property_groups (self ) -> Sequence [PropertyGroup ]:
848
+ """Get the property groups of adj list type.
849
+
850
+ WARNING! Exceptions from the JVM are not checked inside, it is just a proxy-method!
851
+
852
+ :returns: property groups of edge info.
853
+ """
854
+ return [
855
+ PropertyGroup .from_scala (jvm_property_group )
856
+ for jvm_property_group in self ._jvm_edge_info_obj .getProperty_groups ()
857
+ ]
858
+
859
+ def set_property_groups (self , property_groups : Sequence [PropertyGroup ]) -> None :
860
+ """Mutate the corresponding JVM object.
861
+
862
+ :param property_groups: the new property groups, sequence of PropertyGroup
863
+ """
864
+ self ._jvm_edge_info_obj .setProperty_groups (
865
+ [py_property_group .to_scala () for py_property_group in property_groups ],
866
+ )
867
+
876
868
def get_version (self ) -> str :
877
869
"""Get GAR version from the corresponding JVM object.
878
870
@@ -912,6 +904,7 @@ def from_scala(cls: type[EdgeInfoType], jvm_obj: JavaObject) -> EdgeInfoType:
912
904
None ,
913
905
None ,
914
906
None ,
907
+ None ,
915
908
jvm_obj ,
916
909
)
917
910
@@ -927,6 +920,7 @@ def from_python(
927
920
directed : bool ,
928
921
prefix : str ,
929
922
adj_lists : Sequence [AdjList ],
923
+ property_groups : Sequence [PropertyGroup ],
930
924
version : str ,
931
925
) -> EdgeInfoType :
932
926
"""Create an instance of the class from python arguments.
@@ -940,6 +934,7 @@ def from_python(
940
934
:param directed: directed graph flag
941
935
:param prefix: path prefix
942
936
:param adj_lists: sequence of AdjList objects
937
+ :property_groups: sequence of of PropertyGroup objects
943
938
:param version: version of GAR format
944
939
"""
945
940
if not prefix .endswith (os .sep ):
@@ -955,6 +950,7 @@ def from_python(
955
950
directed ,
956
951
prefix ,
957
952
adj_lists ,
953
+ property_groups ,
958
954
version ,
959
955
None ,
960
956
)
@@ -990,41 +986,18 @@ def get_adj_list_file_type(self, adj_list_type: AdjListType) -> FileType:
990
986
self ._jvm_edge_info_obj .getAdjListFileType (adj_list_type .to_scala ()),
991
987
)
992
988
993
- def get_property_groups (
994
- self ,
995
- adj_list_type : AdjListType ,
996
- ) -> Sequence [PropertyGroup ]:
997
- """Get the property groups of adj list type.
998
-
999
- WARNING! Exceptions from the JVM are not checked inside, it is just a proxy-method!
1000
-
1001
- :param adj_list_type: the input adj list type.
1002
- :returns: property group of the input adj list type, if edge info not support the adj list type,
1003
- raise an IllegalArgumentException error.
1004
- """
1005
- return [
1006
- PropertyGroup .from_scala (property_group )
1007
- for property_group in self ._jvm_edge_info_obj .getPropertyGroups (
1008
- adj_list_type .to_scala (),
1009
- )
1010
- ]
1011
-
1012
989
def contain_property_group (
1013
990
self ,
1014
991
property_group : PropertyGroup ,
1015
- adj_list_type : AdjListType ,
1016
992
) -> bool :
1017
- """Check if the edge info contains the property group in certain adj list structure .
993
+ """Check if the edge info contains the property group.
1018
994
1019
995
:param property_group: the property group to check.
1020
- :param adj_list_type: the type of adj list structure.
1021
996
:returns: true if the edge info contains the property group in certain adj list
1022
- structure. If edge info not support the given adj list type or not
1023
- contains the property group in the adj list structure, return false.
997
+ structure.
1024
998
"""
1025
999
return self ._jvm_edge_info_obj .containPropertyGroup (
1026
1000
property_group .to_scala (),
1027
- adj_list_type .to_scala (),
1028
1001
)
1029
1002
1030
1003
def contain_property (self , property_name : str ) -> bool :
@@ -1038,23 +1011,17 @@ def contain_property(self, property_name: str) -> bool:
1038
1011
def get_property_group (
1039
1012
self ,
1040
1013
property_name : str ,
1041
- adj_list_type : AdjListType ,
1042
1014
) -> PropertyGroup :
1043
1015
"""Get property group that contains property with adj list type.
1044
1016
1045
1017
WARNING! Exceptions from the JVM are not checked inside, it is just a proxy-method!
1046
1018
1047
1019
:param property_name: name of the property.
1048
- :param adj_list_type: the type of adj list structure.
1049
- :returns: property group that contains the property. If edge info not support the
1050
- adj list type, or not find the property group that contains the property,
1051
- return false.
1020
+ :returns: property group that contains the property. If edge info not find the property group that contains the property,
1021
+ raise error.
1052
1022
"""
1053
1023
return PropertyGroup .from_scala (
1054
- self ._jvm_edge_info_obj .getPropertyGroup (
1055
- property_name ,
1056
- adj_list_type .to_scala (),
1057
- ),
1024
+ self ._jvm_edge_info_obj .getPropertyGroup (property_name ),
1058
1025
)
1059
1026
1060
1027
def get_property_type (self , property_name : str ) -> GarType :
0 commit comments