followthemoney 4.3.0__py3-none-any.whl → 4.3.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of followthemoney might be problematic. Click here for more details.
- followthemoney/__init__.py +1 -1
- followthemoney/compare.py +19 -0
- followthemoney/property.py +6 -0
- followthemoney/proxy.py +1 -1
- followthemoney/schema/Thing.yaml +1 -1
- followthemoney/types/identifier.py +5 -5
- {followthemoney-4.3.0.dist-info → followthemoney-4.3.1.dist-info}/METADATA +2 -2
- {followthemoney-4.3.0.dist-info → followthemoney-4.3.1.dist-info}/RECORD +11 -11
- {followthemoney-4.3.0.dist-info → followthemoney-4.3.1.dist-info}/WHEEL +0 -0
- {followthemoney-4.3.0.dist-info → followthemoney-4.3.1.dist-info}/entry_points.txt +0 -0
- {followthemoney-4.3.0.dist-info → followthemoney-4.3.1.dist-info}/licenses/LICENSE +0 -0
followthemoney/__init__.py
CHANGED
|
@@ -9,7 +9,7 @@ from followthemoney.statement import Statement, StatementEntity, SE
|
|
|
9
9
|
from followthemoney.dataset import Dataset, DefaultDataset, DS
|
|
10
10
|
from followthemoney.util import set_model_locale
|
|
11
11
|
|
|
12
|
-
__version__ = "4.3.
|
|
12
|
+
__version__ = "4.3.1"
|
|
13
13
|
|
|
14
14
|
# Data model singleton
|
|
15
15
|
model = Model.instance()
|
followthemoney/compare.py
CHANGED
|
@@ -71,12 +71,31 @@ def _compare(scores: Scores, weights: Weights, n_std: int = 1) -> float:
|
|
|
71
71
|
return 1.0 / (1.0 + math.exp(-prob))
|
|
72
72
|
|
|
73
73
|
|
|
74
|
+
def entity_is_same(left: EntityProxy, right: EntityProxy) -> bool:
|
|
75
|
+
"""Check if two entities are the same apart from their ID."""
|
|
76
|
+
if left.schema != right.schema:
|
|
77
|
+
return False
|
|
78
|
+
|
|
79
|
+
props = set(left.properties.keys()).union(right.properties.keys())
|
|
80
|
+
if 0 == len(props):
|
|
81
|
+
return False
|
|
82
|
+
|
|
83
|
+
for prop in props:
|
|
84
|
+
left_vals = sorted(left.get(prop))
|
|
85
|
+
right_vals = sorted(right.get(prop))
|
|
86
|
+
if left_vals != right_vals:
|
|
87
|
+
return False
|
|
88
|
+
return True
|
|
89
|
+
|
|
90
|
+
|
|
74
91
|
def compare(
|
|
75
92
|
left: EntityProxy,
|
|
76
93
|
right: EntityProxy,
|
|
77
94
|
weights: Weights = COMPARE_WEIGHTS,
|
|
78
95
|
) -> float:
|
|
79
96
|
"""Compare two entities and return a match score."""
|
|
97
|
+
if entity_is_same(left, right):
|
|
98
|
+
return 1.0
|
|
80
99
|
scores = compare_scores(left, right)
|
|
81
100
|
return _compare(scores, weights)
|
|
82
101
|
|
followthemoney/property.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import re
|
|
2
2
|
from banal import is_mapping, as_bool
|
|
3
|
+
from rigour.ids import get_identifier_format
|
|
3
4
|
from typing import TYPE_CHECKING, Any, List, Optional, TypedDict
|
|
4
5
|
|
|
5
6
|
from followthemoney.exc import InvalidModel
|
|
@@ -157,6 +158,11 @@ class Property:
|
|
|
157
158
|
raise InvalidModel("Invalid reverse: %s" % self)
|
|
158
159
|
self.reverse = self.range._add_reverse(model, self._reverse, self)
|
|
159
160
|
|
|
161
|
+
if self.type == registry.identifier and self.format is not None:
|
|
162
|
+
format_ = get_identifier_format(self.format)
|
|
163
|
+
if format_ is None or format_.NAME != self.format:
|
|
164
|
+
raise InvalidModel("Invalid identifier format: %s" % self.format)
|
|
165
|
+
|
|
160
166
|
@property
|
|
161
167
|
def label(self) -> str:
|
|
162
168
|
"""User-facing title for this property."""
|
followthemoney/proxy.py
CHANGED
followthemoney/schema/Thing.yaml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import re
|
|
2
2
|
from typing import Optional, TYPE_CHECKING
|
|
3
|
-
from rigour.ids import
|
|
3
|
+
from rigour.ids import get_identifier_format
|
|
4
4
|
|
|
5
5
|
from followthemoney.types.common import PropertyType
|
|
6
6
|
from followthemoney.util import dampen, shortest, longest
|
|
@@ -35,8 +35,8 @@ class IdentifierType(PropertyType):
|
|
|
35
35
|
format: Optional[str] = None,
|
|
36
36
|
proxy: Optional["EntityProxy"] = None,
|
|
37
37
|
) -> Optional[str]:
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
format_ = get_identifier_format(format)
|
|
39
|
+
if format_ is not None:
|
|
40
40
|
return format_.normalize(text)
|
|
41
41
|
return text
|
|
42
42
|
|
|
@@ -61,7 +61,7 @@ class IdentifierType(PropertyType):
|
|
|
61
61
|
return f"id:{value}"
|
|
62
62
|
|
|
63
63
|
def caption(self, value: str, format: Optional[str] = None) -> str:
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
format_ = get_identifier_format(format)
|
|
65
|
+
if format_ is not None:
|
|
66
66
|
return format_.format(value)
|
|
67
67
|
return value
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: followthemoney
|
|
3
|
-
Version: 4.3.
|
|
3
|
+
Version: 4.3.1
|
|
4
4
|
Summary: A data model for anti corruption data modeling and analysis.
|
|
5
5
|
Project-URL: Documentation, https://followthemoney.tech/
|
|
6
6
|
Project-URL: Repository, https://github.com/opensanctions/followthemoney.git
|
|
@@ -50,7 +50,7 @@ Requires-Dist: pytz>=2021.1
|
|
|
50
50
|
Requires-Dist: pyyaml<7.0.0,>=5.0.0
|
|
51
51
|
Requires-Dist: rdflib<7.3.0,>=6.2.0
|
|
52
52
|
Requires-Dist: requests<3.0.0,>=2.21.0
|
|
53
|
-
Requires-Dist: rigour<2.0.0,>=1.
|
|
53
|
+
Requires-Dist: rigour<2.0.0,>=1.4.0
|
|
54
54
|
Requires-Dist: sqlalchemy[mypy]<3.0.0,>=2.0.0
|
|
55
55
|
Provides-Extra: dev
|
|
56
56
|
Requires-Dist: build; extra == 'dev'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
followthemoney/__init__.py,sha256=
|
|
2
|
-
followthemoney/compare.py,sha256=
|
|
1
|
+
followthemoney/__init__.py,sha256=9UJzMQUcqjQ4kWQIDMF1GB0ji8ph-GQlXa3e_X2uuX4,856
|
|
2
|
+
followthemoney/compare.py,sha256=frgumsDv4Ru9UkNof62jDjKCxxpCgV1Rusfu8s20uGA,6327
|
|
3
3
|
followthemoney/entity.py,sha256=bBiX7hNquXemS3vYCUHKtWI_IqX43Z6i8RQDbZ7gXsg,3449
|
|
4
4
|
followthemoney/exc.py,sha256=GyMgwY4QVm87hLevDfV7gM1MJsDqfNCi_UQw7F_A8X8,858
|
|
5
5
|
followthemoney/graph.py,sha256=7X1CGHGvmktS2LSZqld2iXWzG7B831eCNYyBqamqEJ8,10921
|
|
@@ -9,8 +9,8 @@ followthemoney/model.py,sha256=bWFVNa-DhYzc8BdSXBZdG2ev6Nh9uHx6i4tin8DvEEU,7374
|
|
|
9
9
|
followthemoney/names.py,sha256=LODQqExKEHdH4z6Mmbhlm0KeKRzGcptaSWzYXZ7lONI,1120
|
|
10
10
|
followthemoney/namespace.py,sha256=utggu9IGA8bhgEYom3OUB1KxkAJR_TrMNbY5MUF_db8,4536
|
|
11
11
|
followthemoney/ontology.py,sha256=WWY_PYQGl5Ket4zZBuZglzQxD2Bh9UqHok6GJNNX7GA,3001
|
|
12
|
-
followthemoney/property.py,sha256=
|
|
13
|
-
followthemoney/proxy.py,sha256=
|
|
12
|
+
followthemoney/property.py,sha256=6FoKoUloDoQVM4XMnjjolKArlV4yBq9KOYxv8Os8WGQ,8234
|
|
13
|
+
followthemoney/proxy.py,sha256=nahd9lLZzum_-QEchqydinDa1Zg5_Ffl0fyo35BNncQ,19707
|
|
14
14
|
followthemoney/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
15
15
|
followthemoney/schema.py,sha256=WYnPE4Lego0pJHlojECEv0aO9Miw_YIvEb35HoDo4Zk,18087
|
|
16
16
|
followthemoney/util.py,sha256=LoCSp1iE6VwXjotCkBXFRppeQs55726GzOuNIu3CvRE,4409
|
|
@@ -104,7 +104,7 @@ followthemoney/schema/Similar.yaml,sha256=gD8rZEaPQWzU-rEfsKdn62uEucF3KxYBcPMoSd
|
|
|
104
104
|
followthemoney/schema/Succession.yaml,sha256=RMJQqZ4Fv88N1RvWTAgjYg9BB5cELSj5CCAjM681Fpg,749
|
|
105
105
|
followthemoney/schema/Table.yaml,sha256=GcsIAgSO9t2tvObA9zU2HhxlSqTe9CePmUnagu1Z0vI,641
|
|
106
106
|
followthemoney/schema/TaxRoll.yaml,sha256=ugMzaaS7uyq2OLD50eGLcfvd6Cg0cSt65-T9GVqpRSA,746
|
|
107
|
-
followthemoney/schema/Thing.yaml,sha256=
|
|
107
|
+
followthemoney/schema/Thing.yaml,sha256=xqGtSzyfE_EWx5PrxETKftF-9NSlsTYIbXrNqhdx9jw,2721
|
|
108
108
|
followthemoney/schema/Trip.yaml,sha256=nLQD_ApmVJ8D56Czl7K700hhNZjzFV9FOQ3NBSQDLiM,771
|
|
109
109
|
followthemoney/schema/UnknownLink.yaml,sha256=lneS_HZNgeLyJxwzWnLx0ZoyY3MXt99I_K2X_o9z5g8,682
|
|
110
110
|
followthemoney/schema/UserAccount.yaml,sha256=2bbPKNtt1R3zWSSkaq_SVzRPfFzX74kAxwtIxTymHA8,840
|
|
@@ -150,7 +150,7 @@ followthemoney/types/date.py,sha256=PjcaEyW6CBzf0-gHWKUsKjWIaD3AVBEl0zLSRQOVXxc,
|
|
|
150
150
|
followthemoney/types/email.py,sha256=L3RTYrMABlNQF7hCynXGfzoj6YNEHW5JAY_BwuhoZdA,3375
|
|
151
151
|
followthemoney/types/entity.py,sha256=oDxVEhuxyU1ScpOpebPpUm3o0I9j_p7Qrq-t5yNpluQ,2338
|
|
152
152
|
followthemoney/types/gender.py,sha256=fi9iKLbjAUxDCLBtU1MxWidxv7KgCY2eH5746FYlEGk,1725
|
|
153
|
-
followthemoney/types/identifier.py,sha256=
|
|
153
|
+
followthemoney/types/identifier.py,sha256=7YET9mdYAktMup_kTvnxLu9SJzEU7ZJgN3KImzjfT-Y,2219
|
|
154
154
|
followthemoney/types/ip.py,sha256=mMFTODFiXAJROCUYJvoLAShyIiTIWVmMBh5zT_GquYM,1300
|
|
155
155
|
followthemoney/types/json.py,sha256=V3qJD5RxJykNX51u3w1Nx9xqoNBnkulhzkJI9XMYKFo,1690
|
|
156
156
|
followthemoney/types/language.py,sha256=SXgRRH-DyPmyyrqYurSyMiG6WHB8a0Gw81XxroEGD-c,2747
|
|
@@ -161,8 +161,8 @@ followthemoney/types/phone.py,sha256=r8uRqWinS0CYnYBTs405k5gO4jeatUDgjdzzijoMKJE
|
|
|
161
161
|
followthemoney/types/string.py,sha256=fqyTauAm4mNnNaoH-yH087RBbNh-G5ZZUO3awTGQUUg,1230
|
|
162
162
|
followthemoney/types/topic.py,sha256=Mi0Gx0m3bDeTmyuvM6jdRMqv81O03U4eI99R13KGu2Y,4503
|
|
163
163
|
followthemoney/types/url.py,sha256=QFpS_JIV8unFHuh_uGv22SWUUkocBoOpzLsAJWom_gI,1455
|
|
164
|
-
followthemoney-4.3.
|
|
165
|
-
followthemoney-4.3.
|
|
166
|
-
followthemoney-4.3.
|
|
167
|
-
followthemoney-4.3.
|
|
168
|
-
followthemoney-4.3.
|
|
164
|
+
followthemoney-4.3.1.dist-info/METADATA,sha256=i41B2NtbZrqWsc0F26XIP9GCvbRtMZ1ZsWeRWvk4AAg,6747
|
|
165
|
+
followthemoney-4.3.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
166
|
+
followthemoney-4.3.1.dist-info/entry_points.txt,sha256=caoFTlf213jhg5sz3TNSofutjUTzaKtWATuSIdd9Cps,653
|
|
167
|
+
followthemoney-4.3.1.dist-info/licenses/LICENSE,sha256=H6_EVXisnJC0-18CjXIaqrBSFq_VH3OnS7u3dccOv6g,1148
|
|
168
|
+
followthemoney-4.3.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|