(
self,
loader,
properties=None,
src_label: str = "_",
dst_label: str = "_",
src_field: Union[str, int] = 0,
dst_field: Union[str, int] = 1,
load_strategy="both_out_in",
id_type: str = "int64_t",
eformat=None,
)
| 146 | """ |
| 147 | |
| 148 | def __init__( |
| 149 | self, |
| 150 | loader, |
| 151 | properties=None, |
| 152 | src_label: str = "_", |
| 153 | dst_label: str = "_", |
| 154 | src_field: Union[str, int] = 0, |
| 155 | dst_field: Union[str, int] = 1, |
| 156 | load_strategy="both_out_in", |
| 157 | id_type: str = "int64_t", |
| 158 | eformat=None, |
| 159 | ): |
| 160 | if isinstance(loader, Loader): |
| 161 | self.loader = loader |
| 162 | else: |
| 163 | self.loader = Loader(loader) |
| 164 | # raw properties passed by user parameters |
| 165 | self.raw_properties = properties |
| 166 | # finally properties for constructing graph |
| 167 | self.properties = [] |
| 168 | # type of vertex original id |
| 169 | # should be consistent with the original graph |
| 170 | self.id_type = id_type |
| 171 | self.src_label = src_label |
| 172 | self.dst_label = dst_label |
| 173 | self.src_field = src_field |
| 174 | self.dst_field = dst_field |
| 175 | # check avaiable |
| 176 | check_argument( |
| 177 | load_strategy in ("only_out", "only_in", "both_out_in"), |
| 178 | "invalid load strategy: " + load_strategy, |
| 179 | ) |
| 180 | self.load_strategy = load_strategy |
| 181 | if (isinstance(self.src_field, int) and isinstance(self.dst_field, str)) or ( |
| 182 | isinstance(self.src_field, str) and isinstance(self.dst_field, int) |
| 183 | ): |
| 184 | print("src field", self.src_field, "dst_field", self.dst_field) |
| 185 | raise SyntaxError( |
| 186 | "Source vid and destination vid must have same formats, both use name or both use index" |
| 187 | ) |
| 188 | # normalize properties |
| 189 | # add src/dst to property list |
| 190 | self.add_property(str(self.src_field), self.id_type) |
| 191 | self.add_property(str(self.dst_field), self.id_type) |
| 192 | if self.raw_properties: |
| 193 | self.add_properties(self.raw_properties) |
| 194 | elif self.loader.deduced_properties: |
| 195 | self.add_properties(self.loader.deduced_properties) |
| 196 | # set selected columns to loader |
| 197 | self.loader.select_columns( |
| 198 | self.properties, include_all=bool(self.raw_properties is None) |
| 199 | ) |
| 200 | self._eformat = eformat |
| 201 | |
| 202 | def __str__(self) -> str: |
| 203 | s = "\ntype: EdgeSubLabel" |
nothing calls this directly
no test coverage detected