datamarket 0.9.5__py3-none-any.whl → 0.9.6__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 datamarket might be problematic. Click here for more details.
- datamarket/interfaces/aws.py +2 -3
- datamarket/interfaces/ftp.py +2 -2
- datamarket/utils/main.py +30 -12
- {datamarket-0.9.5.dist-info → datamarket-0.9.6.dist-info}/METADATA +1 -1
- {datamarket-0.9.5.dist-info → datamarket-0.9.6.dist-info}/RECORD +7 -7
- {datamarket-0.9.5.dist-info → datamarket-0.9.6.dist-info}/LICENSE +0 -0
- {datamarket-0.9.5.dist-info → datamarket-0.9.6.dist-info}/WHEEL +0 -0
datamarket/interfaces/aws.py
CHANGED
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
import io
|
|
5
5
|
import logging
|
|
6
6
|
import boto3
|
|
7
|
-
|
|
8
|
-
from ..utils.main import Config
|
|
7
|
+
from dynaconf import Dynaconf
|
|
9
8
|
|
|
10
9
|
########################################################################################################################
|
|
11
10
|
# CLASSES
|
|
@@ -14,7 +13,7 @@ logger = logging.getLogger(__name__)
|
|
|
14
13
|
|
|
15
14
|
|
|
16
15
|
class AWSInterface:
|
|
17
|
-
def __init__(self, config:
|
|
16
|
+
def __init__(self, config: Dynaconf) -> None:
|
|
18
17
|
self.profiles = []
|
|
19
18
|
self.config = config
|
|
20
19
|
|
datamarket/interfaces/ftp.py
CHANGED
|
@@ -5,7 +5,7 @@ import logging
|
|
|
5
5
|
from ftplib import FTP, FTP_TLS
|
|
6
6
|
from pathlib import Path
|
|
7
7
|
|
|
8
|
-
from
|
|
8
|
+
from dynaconf import Dynaconf
|
|
9
9
|
|
|
10
10
|
########################################################################################################################
|
|
11
11
|
# CLASSES
|
|
@@ -13,7 +13,7 @@ from ..utils.main import Config
|
|
|
13
13
|
logger = logging.getLogger(__name__)
|
|
14
14
|
|
|
15
15
|
class FTPInterface:
|
|
16
|
-
def __init__(self, config:
|
|
16
|
+
def __init__(self, config: Dynaconf):
|
|
17
17
|
if "ftp" in config:
|
|
18
18
|
self.config = config["ftp"]
|
|
19
19
|
|
datamarket/utils/main.py
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
# IMPORTS
|
|
3
3
|
|
|
4
4
|
import asyncio
|
|
5
|
+
from dataclasses import dataclass
|
|
5
6
|
import inspect
|
|
6
7
|
import logging
|
|
7
8
|
import random
|
|
@@ -11,23 +12,35 @@ import shutil
|
|
|
11
12
|
import subprocess
|
|
12
13
|
import time
|
|
13
14
|
from pathlib import Path
|
|
14
|
-
from typing import Literal, Union
|
|
15
|
+
from typing import Literal, Optional, Union
|
|
15
16
|
|
|
16
17
|
import pendulum
|
|
17
18
|
from croniter import croniter
|
|
18
19
|
from configparser import RawConfigParser
|
|
19
20
|
from dynaconf import Dynaconf, add_converter
|
|
20
21
|
|
|
22
|
+
logger = logging.getLogger(__name__)
|
|
23
|
+
|
|
21
24
|
########################################################################################################################
|
|
22
|
-
#
|
|
25
|
+
# CLASSES
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
@dataclass
|
|
29
|
+
class ProjectMetadata:
|
|
30
|
+
cmd_prefix: str
|
|
31
|
+
package_name: str
|
|
32
|
+
env_name: str
|
|
33
|
+
path: Path
|
|
34
|
+
config_path: Path
|
|
23
35
|
|
|
24
|
-
logger = logging.getLogger(__name__)
|
|
25
36
|
|
|
26
|
-
|
|
37
|
+
########################################################################################################################
|
|
38
|
+
# FUNCTIONS
|
|
27
39
|
|
|
28
40
|
|
|
29
41
|
def get_granular_date(
|
|
30
|
-
granularity: Union[Literal["monthly", "biweekly", "weekly", "daily"], str],
|
|
42
|
+
granularity: Union[Literal["monthly", "biweekly", "weekly", "daily"], str],
|
|
43
|
+
tz: str = "Europe/Madrid",
|
|
31
44
|
) -> pendulum.DateTime:
|
|
32
45
|
"""
|
|
33
46
|
Returns the most recent date based on the given granularity or a custom cron expression.
|
|
@@ -67,8 +80,10 @@ def read_converter(path_str: str):
|
|
|
67
80
|
|
|
68
81
|
|
|
69
82
|
def get_config(
|
|
70
|
-
config_file: Path, tz: str = "Europe/Madrid"
|
|
71
|
-
) ->
|
|
83
|
+
config_file: Optional[Path] = None, tz: str = "Europe/Madrid"
|
|
84
|
+
) -> Dynaconf:
|
|
85
|
+
config_file = config_file or get_project_metadata().config_path
|
|
86
|
+
|
|
72
87
|
if Path(config_file).suffix == ".ini":
|
|
73
88
|
logger.warning("Using legacy INI config reader. Please migrate to TOML")
|
|
74
89
|
cfg = RawConfigParser()
|
|
@@ -106,17 +121,20 @@ def get_config(
|
|
|
106
121
|
|
|
107
122
|
return config
|
|
108
123
|
|
|
109
|
-
|
|
110
|
-
def get_project_metadata():
|
|
124
|
+
def get_project_metadata() -> ProjectMetadata:
|
|
111
125
|
caller_frame = inspect.stack()[1]
|
|
112
126
|
current_file_parts = Path(caller_frame.filename).resolve().parts
|
|
113
127
|
src_index = current_file_parts.index("src")
|
|
128
|
+
|
|
114
129
|
cmd_prefix = "dix vnc run --" if shutil.which("dix") else ""
|
|
115
|
-
|
|
116
|
-
env_name = f"{
|
|
130
|
+
package_name = current_file_parts[src_index + 1]
|
|
131
|
+
env_name = f"{package_name}_env"
|
|
117
132
|
project_path = Path(*current_file_parts[:src_index])
|
|
133
|
+
config_path = project_path / "config.toml"
|
|
118
134
|
|
|
119
|
-
return
|
|
135
|
+
return ProjectMetadata(
|
|
136
|
+
cmd_prefix, package_name, env_name, project_path, config_path
|
|
137
|
+
)
|
|
120
138
|
|
|
121
139
|
|
|
122
140
|
def set_logger(level):
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
datamarket/__init__.py,sha256=FHS77P9qNewKMoN-p0FLEUEC60oWIYup1QkbJZP4ays,12
|
|
2
2
|
datamarket/interfaces/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
3
|
datamarket/interfaces/alchemy.py,sha256=V8E1GtokxUNmrUftKTFkIpNoXaqJME7ACES2BY0znQM,4214
|
|
4
|
-
datamarket/interfaces/aws.py,sha256=
|
|
4
|
+
datamarket/interfaces/aws.py,sha256=7KLUeBxmPN7avEMPsu5HC_KHB1N7W6Anp2X8fo43mlw,2383
|
|
5
5
|
datamarket/interfaces/drive.py,sha256=shbV5jpQVe_KPE-8Idx6Z9te5Zu1SmVfrvSAyd9ZIgE,2915
|
|
6
|
-
datamarket/interfaces/ftp.py,sha256=
|
|
6
|
+
datamarket/interfaces/ftp.py,sha256=o0KlJxtksbop9OjCiQRzyAa2IeG_ExVXagS6apwrAQo,1881
|
|
7
7
|
datamarket/interfaces/nominatim.py,sha256=_gFJ04D-ju5xn3wuaGT5Pj5jhf4F5eINpxOpuQL_dIQ,3664
|
|
8
8
|
datamarket/interfaces/peerdb.py,sha256=rNQ1-THcVvrej8BEPJs9zM4VfH5dlByafOIHYN9sB2A,21833
|
|
9
9
|
datamarket/interfaces/proxy.py,sha256=updoOStKd8-nQBbxWbnD9eOt6HksnYi-5dQ0rEySf5M,3152
|
|
@@ -13,11 +13,11 @@ datamarket/params/nominatim.py,sha256=pBYRfoBkkLBg2INbFymefmYSzaAVujQSpEro5c1hD_
|
|
|
13
13
|
datamarket/utils/__init__.py,sha256=8D5a8oKgqd6WA1RUkiKCn4l_PVemtyuckxQut0vDHXM,20
|
|
14
14
|
datamarket/utils/airflow.py,sha256=al0vc0YUikNu3Oy51VSn52I7pMU40akFBOl_UlHa2E4,795
|
|
15
15
|
datamarket/utils/alchemy.py,sha256=SRq6kgh1aANXVShBPgAuglmNhZssPWwWEY503gKSia8,635
|
|
16
|
-
datamarket/utils/main.py,sha256=
|
|
16
|
+
datamarket/utils/main.py,sha256=O6rX-65h4h0j2zs9dofdTPlly5reKDnvgLtTwbLmbWg,6529
|
|
17
17
|
datamarket/utils/selenium.py,sha256=IMKlbLzXABFhACnWzhHmB0l2hhVzNwHGZwbo14nEewQ,2499
|
|
18
18
|
datamarket/utils/soda.py,sha256=eZTXFbI1P3WoMd1MM-YjoVTpdjTcDSWuvBb7ViBMhSQ,941
|
|
19
19
|
datamarket/utils/typer.py,sha256=FDF3l6gh3UlAFPsHCtesnekvct2rKz0oFn3uKARBQvE,814
|
|
20
|
-
datamarket-0.9.
|
|
21
|
-
datamarket-0.9.
|
|
22
|
-
datamarket-0.9.
|
|
23
|
-
datamarket-0.9.
|
|
20
|
+
datamarket-0.9.6.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
21
|
+
datamarket-0.9.6.dist-info/METADATA,sha256=8navfRiIA2UGaMQCWCsq0-LQBDzVpfYPlAH_RzLsams,6362
|
|
22
|
+
datamarket-0.9.6.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
|
|
23
|
+
datamarket-0.9.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|