|
2 | 2 | import json
|
3 | 3 | import logging
|
4 | 4 | from typing import Any, Dict, Iterable, List, Optional, Set, TextIO
|
5 |
| -import stringcase # type: ignore |
6 | 5 |
|
7 | 6 | from followthemoney.export.csv import CSVMixin, CSVWriter
|
8 | 7 | from followthemoney.export.graph import GraphExporter, DEFAULT_EDGE_TYPES
|
9 | 8 | from followthemoney.graph import Edge, Node
|
10 | 9 | from followthemoney.schema import Schema
|
11 |
| -from followthemoney.util import PathLike |
| 10 | +from followthemoney.util import PathLike, const_case |
12 | 11 |
|
13 | 12 | log = logging.getLogger(__name__)
|
14 | 13 | NEO4J_ADMIN_PATH = os.environ.get("NEO4J_ADMIN_PATH", "neo4j-admin")
|
@@ -72,12 +71,12 @@ def write_node(self, node: Node, extra: List[str]) -> None:
|
72 | 71 |
|
73 | 72 | def write_edge(self, edge: Edge, extra: List[str]) -> None:
|
74 | 73 | if edge.prop is not None:
|
75 |
| - type_ = stringcase.constcase(edge.prop.name) |
| 74 | + type_ = const_case(edge.prop.name) |
76 | 75 | row = [type_, edge.source_id, edge.target_id, edge.weight]
|
77 | 76 | self.links_writer.writerow(row)
|
78 | 77 | if edge.proxy is not None:
|
79 | 78 | proxy = edge.proxy
|
80 |
| - type_ = stringcase.constcase(proxy.schema.name) |
| 79 | + type_ = const_case(proxy.schema.name) |
81 | 80 | # That potentially may lead to multiple edges with same id
|
82 | 81 | cells = [proxy.id, type_, edge.source_id, edge.target_id]
|
83 | 82 | cells.extend(extra or [])
|
@@ -174,7 +173,7 @@ def write_graph(self) -> None:
|
174 | 173 | % {
|
175 | 174 | "source": self._to_map({"id": edge.source_id}),
|
176 | 175 | "target": self._to_map({"id": edge.target_id}),
|
177 |
| - "type": stringcase.constcase(edge.type_name), |
| 176 | + "type": const_case(edge.type_name), |
178 | 177 | "map": self._to_map(attributes),
|
179 | 178 | }
|
180 | 179 | )
|
|
0 commit comments