ingestify 0.1.1__py3-none-any.whl → 0.1.3__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.
ingestify/__init__.py CHANGED
@@ -8,4 +8,4 @@ if not __INGESTIFY_SETUP__:
8
8
  from .infra import retrieve_http
9
9
  from .source_base import Source, DatasetResource
10
10
 
11
- __version__ = "0.1.1"
11
+ __version__ = "0.1.3"
@@ -84,9 +84,15 @@ def load_file(
84
84
  file_data_serialization_format=file_resource.data_serialization_format
85
85
  or "txt",
86
86
  **http_options,
87
+ **file_resource.loader_kwargs,
87
88
  )
88
89
  else:
89
- return file_resource.file_loader(file_resource, current_file)
90
+ return file_resource.file_loader(
91
+ file_resource,
92
+ current_file,
93
+ # TODO: check how to fix this with typehints
94
+ **file_resource.loader_kwargs,
95
+ )
90
96
 
91
97
 
92
98
  class UpdateDatasetTask(Task):
ingestify/cmdline.py CHANGED
@@ -12,6 +12,7 @@ from ingestify.exceptions import ConfigurationError
12
12
  from ingestify.main import get_engine
13
13
 
14
14
  from ingestify import __version__
15
+ from ingestify.utils import try_number
15
16
 
16
17
  logger = logging.getLogger(__name__)
17
18
  #
@@ -174,7 +175,7 @@ def delete_dataset(
174
175
  if "=" in dataset_id:
175
176
  selector = {
176
177
  # TODO: this `int` will might break stuff. Issue here is the int != str
177
- _[0]: int(_[1])
178
+ _[0]: try_number(_[1])
178
179
  for _ in [_.split("=") for _ in dataset_id.split("/")]
179
180
  }
180
181
  else:
@@ -1,4 +1,4 @@
1
- from dataclasses import dataclass
1
+ from dataclasses import dataclass, field
2
2
  from datetime import datetime
3
3
  from typing import Optional, Callable, TYPE_CHECKING
4
4
 
@@ -29,6 +29,7 @@ class FileResource:
29
29
  file_loader: Optional[
30
30
  Callable[["FileResource", Optional["File"]], Optional["DraftFile"]]
31
31
  ] = None
32
+ loader_kwargs: dict = field(default_factory=dict)
32
33
 
33
34
  def __post_init__(self):
34
35
  if self.json_content is None and not self.url and not self.file_loader:
@@ -75,6 +76,7 @@ class DatasetResource:
75
76
  Optional["DraftFile"],
76
77
  ]
77
78
  ] = None,
79
+ loader_kwargs: Optional[dict] = None,
78
80
  ):
79
81
  file_id = f"{data_feed_key}__{data_spec_version}"
80
82
  if file_id in self.files:
@@ -91,6 +93,7 @@ class DatasetResource:
91
93
  http_options=http_options,
92
94
  data_serialization_format=data_serialization_format,
93
95
  file_loader=file_loader,
96
+ loader_kwargs=loader_kwargs or {},
94
97
  )
95
98
 
96
99
  self.files[file_id] = file_resource
ingestify/utils.py CHANGED
@@ -274,3 +274,13 @@ class TaskExecutor:
274
274
  def join(self):
275
275
  self.pool.close()
276
276
  self.pool.join()
277
+
278
+
279
+ def try_number(s: str):
280
+ try:
281
+ return int(s)
282
+ except ValueError:
283
+ try:
284
+ return float(s)
285
+ except ValueError:
286
+ return s
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ingestify
3
- Version: 0.1.1
3
+ Version: 0.1.3
4
4
  Summary: Standardizing soccer tracking- and event data
5
5
  Author: Koen Vossen
6
6
  Author-email: info@koenvossen.nl
@@ -1,14 +1,14 @@
1
- ingestify/__init__.py,sha256=aikpoo_eBRu5RSYV4NGLYO89gnOWPVM6TGriRmeqZLg,301
2
- ingestify/cmdline.py,sha256=gLy79Cq3OnEyoEcI6koWIEbCwvgFZ1E8n3UU1sKS8FM,7143
1
+ ingestify/__init__.py,sha256=7SmMqBObZfacvSUG-7g0fFyt6ZlamLxBNgU5ReQ36lk,301
2
+ ingestify/cmdline.py,sha256=bIuyPgGEw4wIglNzpG9zp7TsJozsP8NSVsCe4eAyWUg,7189
3
3
  ingestify/exceptions.py,sha256=wMMuajl4AkQRfW60TLN7btJmQaH8-lUczXyW_2g9kOU,143
4
4
  ingestify/main.py,sha256=YjrAOiGzwurtoDyIf981DSJHHA6IT5q09k3QNzTKCC8,6814
5
5
  ingestify/server.py,sha256=OVrf_XtpAQIn88MzqQzShXgsA9_jbnqYvD8YPBjn3cs,2413
6
6
  ingestify/source_base.py,sha256=GXAFCoT11Zov9M2v-fqQr9gFCXbtVfEIEH32V7r2oE8,382
7
- ingestify/utils.py,sha256=eEHwulqNEb2YTRDrCMVxr6mWZYI6KOcNCAIWFTi74u0,8029
7
+ ingestify/utils.py,sha256=WcbG2mEb-oLF_sA-2JPRbx8nD55HqASrHQRz7Zd0Ejg,8198
8
8
  ingestify/application/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  ingestify/application/dataset_store.py,sha256=NAW-XSvp118Lr2hXZd3qtuQr6VkPdWCLksIwd5MSs30,11489
10
10
  ingestify/application/ingestion_engine.py,sha256=GYIhb8a9ePkEcNOBPdfu-YawiD7eRZMRlxCA-6g9DRA,2249
11
- ingestify/application/loader.py,sha256=d7iXmdHN_yhDkEc2MMZ_6BLMEdRz9ChpBMy4yCWvxQo,13317
11
+ ingestify/application/loader.py,sha256=DSdSNFf7WynGsMCoK3iQGiMKkO76fZ_KIOBDEMZK3zU,13495
12
12
  ingestify/application/secrets_manager.py,sha256=5qCbPfUvRGP1Xbq6xPkMfpgYl8uPzF_0NbiKeRY5zxU,1757
13
13
  ingestify/domain/__init__.py,sha256=M7_fVTJjQUx53P4UQUPhowRKPKsIIjx4JYZL1yjHKsM,46
14
14
  ingestify/domain/models/__init__.py,sha256=xHVQZP57ZQYUKwAtbccnDKX89_yTOvBKAtn4XDVbEbY,930
@@ -37,7 +37,7 @@ ingestify/domain/models/event/event_bus.py,sha256=iseourbCwdUg-ODM5bM_u6cageJmce
37
37
  ingestify/domain/models/event/publisher.py,sha256=TOAawYYiPQCLR2Gm17LumMEzeapMDYcAYeklLFmwqAY,620
38
38
  ingestify/domain/models/event/subscriber.py,sha256=tP1ZFSvpJWKUITnATYekRxJzepz85UY7egBTMiP-dwg,1039
39
39
  ingestify/domain/models/resources/__init__.py,sha256=ZuY9DPRfwk-aLB3Lj6DYP_NqMkcQfcYjZp4VejTtcbU,46
40
- ingestify/domain/models/resources/dataset_resource.py,sha256=g0tu9QZQEdAGR-dRXQPL3ddcbEEGI__pvkDJGoscUTE,3027
40
+ ingestify/domain/models/resources/dataset_resource.py,sha256=HH5wMqzoWvcL84GzNa7QL3YsciI757FG4iZu9DbXn_k,3181
41
41
  ingestify/domain/models/task/__init__.py,sha256=BdlyIPvE07Xax_IzLgO9DUw0wsz9OZutxnxdDNyRlys,79
42
42
  ingestify/domain/models/task/set.py,sha256=04txDYgS5rotXofD9TqChKdW0VZIYshrkfPIpXtlhW4,430
43
43
  ingestify/domain/models/task/task.py,sha256=R6tEZub-N_Wjl4VjwlPySdFb3L9D7nH4St2CcDzFoKA,107
@@ -72,8 +72,8 @@ ingestify/static/templates/wyscout/README.md,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRk
72
72
  ingestify/static/templates/wyscout/config.yaml.jinja2,sha256=0zQXuvJVwd0oL2OJsPMZ8sOvRbdfRbieSGLQ44ezmYc,379
73
73
  ingestify/static/templates/wyscout/query.py,sha256=wjAOMoKvhX-BzCRqEm1SJp6YAcF8Fsq7ddrOaOpAeOk,364
74
74
  ingestify/static/templates/wyscout/database/README.md,sha256=7IuzjKo7Pqkx5wkmOETRZDljVOslqfA3ALuHMONq5dg,32
75
- ingestify-0.1.1.dist-info/METADATA,sha256=H8ASxletYwv0etkk4E85L3OecC7Kg3zsTqdoS3NUCGM,18822
76
- ingestify-0.1.1.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
77
- ingestify-0.1.1.dist-info/entry_points.txt,sha256=czYYXeX2ul4zdeB6bKlz3HaUF7zyVVcj9E_sRNDisI0,53
78
- ingestify-0.1.1.dist-info/top_level.txt,sha256=Lwnjgns4KequS7KiicXhh6mLUvcdfjzLyPI4qf_s4A0,10
79
- ingestify-0.1.1.dist-info/RECORD,,
75
+ ingestify-0.1.3.dist-info/METADATA,sha256=N5OO5RAYulhFCXCqp4Hi2gEcEB9dnf6W7n59ZOGRUQ8,18822
76
+ ingestify-0.1.3.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
77
+ ingestify-0.1.3.dist-info/entry_points.txt,sha256=czYYXeX2ul4zdeB6bKlz3HaUF7zyVVcj9E_sRNDisI0,53
78
+ ingestify-0.1.3.dist-info/top_level.txt,sha256=Lwnjgns4KequS7KiicXhh6mLUvcdfjzLyPI4qf_s4A0,10
79
+ ingestify-0.1.3.dist-info/RECORD,,