PyFunceble-dev 4.2.17__py3-none-any.whl → 4.2.19__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.
- PyFunceble/checker/availability/base.py +14 -14
- PyFunceble/checker/availability/domain.py +2 -2
- PyFunceble/checker/availability/domain_and_ip.py +3 -3
- PyFunceble/checker/base.py +26 -26
- PyFunceble/checker/params_base.py +1 -1
- PyFunceble/checker/reputation/base.py +16 -16
- PyFunceble/checker/reputation/domain_and_ip.py +3 -3
- PyFunceble/checker/syntax/domain_and_ip.py +1 -1
- PyFunceble/cli/continuous_integration/base.py +40 -11
- PyFunceble/cli/entry_points/pyfunceble/cli.py +13 -13
- PyFunceble/cli/execution_time.py +2 -2
- PyFunceble/cli/file_preloader.py +4 -4
- PyFunceble/cli/filesystem/printer/file.py +2 -2
- PyFunceble/cli/migrators/json2csv/inactive.py +5 -2
- PyFunceble/cli/processes/workers/base.py +6 -4
- PyFunceble/cli/processes/workers/producer.py +7 -7
- PyFunceble/cli/system/integrator.py +26 -2
- PyFunceble/cli/system/launcher.py +3 -3
- PyFunceble/cli/utils/version.py +5 -3
- PyFunceble/config/compare.py +8 -5
- PyFunceble/config/loader.py +3 -3
- PyFunceble/data/infrastructure/.PyFunceble_production.yaml +53 -8
- PyFunceble/dataset/autocontinue/csv.py +2 -2
- PyFunceble/dataset/autocontinue/sql.py +2 -2
- PyFunceble/dataset/csv_base.py +4 -2
- PyFunceble/dataset/inactive/csv.py +3 -3
- PyFunceble/dataset/inactive/sql.py +2 -2
- PyFunceble/dataset/sql_base.py +2 -2
- PyFunceble/dataset/whois/base.py +4 -2
- PyFunceble/dataset/whois/sql.py +2 -2
- PyFunceble/downloader/base.py +9 -7
- PyFunceble/query/{collection.py → platform.py} +205 -21
- PyFunceble/storage.py +2 -2
- {PyFunceble_dev-4.2.17.dist-info → PyFunceble_dev-4.2.19.dist-info}/METADATA +46 -42
- {PyFunceble_dev-4.2.17.dist-info → PyFunceble_dev-4.2.19.dist-info}/RECORD +39 -39
- {PyFunceble_dev-4.2.17.dist-info → PyFunceble_dev-4.2.19.dist-info}/WHEEL +1 -1
- {PyFunceble_dev-4.2.17.dist-info → PyFunceble_dev-4.2.19.dist-info}/LICENSE +0 -0
- {PyFunceble_dev-4.2.17.dist-info → PyFunceble_dev-4.2.19.dist-info}/entry_points.txt +0 -0
- {PyFunceble_dev-4.2.17.dist-info → PyFunceble_dev-4.2.19.dist-info}/top_level.txt +0 -0
@@ -159,7 +159,7 @@ class AvailabilityCheckerBase(CheckerBase):
|
|
159
159
|
do_syntax_check_first: Optional[bool] = None,
|
160
160
|
db_session: Optional[Session] = None,
|
161
161
|
use_whois_db: Optional[bool] = None,
|
162
|
-
|
162
|
+
use_platform: Optional[bool] = None,
|
163
163
|
) -> None:
|
164
164
|
self.dns_query_tool = DNSQueryTool()
|
165
165
|
self.whois_query_tool = WhoisQueryTool()
|
@@ -224,7 +224,7 @@ class AvailabilityCheckerBase(CheckerBase):
|
|
224
224
|
subject,
|
225
225
|
do_syntax_check_first=do_syntax_check_first,
|
226
226
|
db_session=db_session,
|
227
|
-
|
227
|
+
use_platform=use_platform,
|
228
228
|
)
|
229
229
|
|
230
230
|
@property
|
@@ -1020,27 +1020,27 @@ class AvailabilityCheckerBase(CheckerBase):
|
|
1020
1020
|
|
1021
1021
|
raise NotImplementedError()
|
1022
1022
|
|
1023
|
-
def
|
1023
|
+
def try_to_query_status_from_platform(self) -> "AvailabilityCheckerBase":
|
1024
1024
|
"""
|
1025
|
-
Tries to get and set the status from the
|
1025
|
+
Tries to get and set the status from the platform API.
|
1026
1026
|
"""
|
1027
1027
|
|
1028
1028
|
PyFunceble.facility.Logger.info(
|
1029
|
-
"Started to try to query the status of %r from:
|
1029
|
+
"Started to try to query the status of %r from: Platform Lookup",
|
1030
1030
|
self.status.idna_subject,
|
1031
1031
|
)
|
1032
1032
|
|
1033
|
-
data = self.
|
1033
|
+
data = self.platform_query_tool.pull(self.idna_subject)
|
1034
1034
|
|
1035
1035
|
if data and "status" in data:
|
1036
1036
|
if (
|
1037
|
-
self.
|
1037
|
+
self.platform_query_tool.preferred_status_origin == "frequent"
|
1038
1038
|
and data["status"]["availability"]["frequent"]
|
1039
1039
|
):
|
1040
1040
|
self.status.status = data["status"]["availability"]["frequent"]
|
1041
|
-
self.status.status_source = "
|
1041
|
+
self.status.status_source = "PLATFORM"
|
1042
1042
|
elif (
|
1043
|
-
self.
|
1043
|
+
self.platform_query_tool.preferred_status_origin == "latest"
|
1044
1044
|
and data["status"]["availability"]["latest"]
|
1045
1045
|
):
|
1046
1046
|
try:
|
@@ -1050,21 +1050,21 @@ class AvailabilityCheckerBase(CheckerBase):
|
|
1050
1050
|
]
|
1051
1051
|
except KeyError:
|
1052
1052
|
self.status.status = data["status"]["availability"]["latest"]
|
1053
|
-
self.status.status_source = "
|
1053
|
+
self.status.status_source = "PLATFORM"
|
1054
1054
|
elif (
|
1055
|
-
self.
|
1055
|
+
self.platform_query_tool.preferred_status_origin == "recommended"
|
1056
1056
|
and data["status"]["availability"]["recommended"]
|
1057
1057
|
):
|
1058
1058
|
self.status.status = data["status"]["availability"]["recommended"]
|
1059
|
-
self.status.status_source = "
|
1059
|
+
self.status.status_source = "PLATFORM"
|
1060
1060
|
|
1061
1061
|
PyFunceble.facility.Logger.info(
|
1062
|
-
"Could define the status of %r from:
|
1062
|
+
"Could define the status of %r from: Platform Lookup",
|
1063
1063
|
self.status.idna_subject,
|
1064
1064
|
)
|
1065
1065
|
|
1066
1066
|
PyFunceble.facility.Logger.info(
|
1067
|
-
"Finished to try to query the status of %r from:
|
1067
|
+
"Finished to try to query the status of %r from: Platform Lookup",
|
1068
1068
|
self.status.idna_subject,
|
1069
1069
|
)
|
1070
1070
|
|
@@ -129,8 +129,8 @@ class DomainAvailabilityChecker(AvailabilityCheckerBase):
|
|
129
129
|
|
130
130
|
status_post_syntax_checker = None
|
131
131
|
|
132
|
-
if not self.status.status and self.
|
133
|
-
self.
|
132
|
+
if not self.status.status and self.use_platform:
|
133
|
+
self.try_to_query_status_from_platform()
|
134
134
|
|
135
135
|
if not self.status.status and self.do_syntax_check_first:
|
136
136
|
self.try_to_query_status_from_syntax_lookup(from_domain_test=True)
|
@@ -111,7 +111,7 @@ class DomainAndIPAvailabilityChecker(AvailabilityCheckerBase):
|
|
111
111
|
do_syntax_check_first=self.do_syntax_check_first,
|
112
112
|
db_session=self.db_session,
|
113
113
|
use_whois_db=self.use_whois_db,
|
114
|
-
|
114
|
+
use_platform=self.use_platform,
|
115
115
|
)
|
116
116
|
else:
|
117
117
|
query_object = DomainAvailabilityChecker(
|
@@ -125,12 +125,12 @@ class DomainAndIPAvailabilityChecker(AvailabilityCheckerBase):
|
|
125
125
|
do_syntax_check_first=self.do_syntax_check_first,
|
126
126
|
db_session=self.db_session,
|
127
127
|
use_whois_db=self.use_whois_db,
|
128
|
-
|
128
|
+
use_platform=self.use_platform,
|
129
129
|
)
|
130
130
|
|
131
131
|
query_object.dns_query_tool = self.dns_query_tool
|
132
132
|
query_object.whois_query_tool = self.whois_query_tool
|
133
|
-
query_object.
|
133
|
+
query_object.platform_query_tool = self.platform_query_tool
|
134
134
|
query_object.hostbyaddr_query_tool = self.hostbyaddr_query_tool
|
135
135
|
query_object.addressinfo_query_tool = self.addressinfo_query_tool
|
136
136
|
query_object.http_status_code_query_tool = self.http_status_code_query_tool
|
PyFunceble/checker/base.py
CHANGED
@@ -62,7 +62,7 @@ import PyFunceble.storage
|
|
62
62
|
from PyFunceble.checker.params_base import CheckerParamsBase
|
63
63
|
from PyFunceble.checker.status_base import CheckerStatusBase
|
64
64
|
from PyFunceble.converter.url2netloc import Url2Netloc
|
65
|
-
from PyFunceble.query.
|
65
|
+
from PyFunceble.query.platform import PlatformQueryTool
|
66
66
|
|
67
67
|
|
68
68
|
class CheckerBase:
|
@@ -79,10 +79,10 @@ class CheckerBase:
|
|
79
79
|
"""
|
80
80
|
|
81
81
|
STD_DO_SYNTAX_CHECK_FIRST: bool = False
|
82
|
-
|
82
|
+
STD_USE_PLATFORM: bool = False
|
83
83
|
|
84
84
|
_do_syntax_check_first: bool = False
|
85
|
-
|
85
|
+
_use_platform: bool = False
|
86
86
|
|
87
87
|
_subject: Optional[str] = None
|
88
88
|
_idna_subject: Optional[str] = None
|
@@ -90,7 +90,7 @@ class CheckerBase:
|
|
90
90
|
url2netloc: Optional[Url2Netloc] = None
|
91
91
|
|
92
92
|
db_session: Optional[Session] = None
|
93
|
-
|
93
|
+
platform_query_tool: Optional[PlatformQueryTool] = None
|
94
94
|
|
95
95
|
status: Optional[CheckerStatusBase] = None
|
96
96
|
params: Optional[CheckerParamsBase] = None
|
@@ -101,9 +101,9 @@ class CheckerBase:
|
|
101
101
|
*,
|
102
102
|
do_syntax_check_first: Optional[bool] = None,
|
103
103
|
db_session: Optional[Session] = None,
|
104
|
-
|
104
|
+
use_platform: Optional[bool] = None,
|
105
105
|
) -> None:
|
106
|
-
self.
|
106
|
+
self.platform_query_tool = PlatformQueryTool()
|
107
107
|
self.url2netloc = Url2Netloc()
|
108
108
|
|
109
109
|
if self.params is None:
|
@@ -120,10 +120,10 @@ class CheckerBase:
|
|
120
120
|
else:
|
121
121
|
self.do_syntax_check_first = self.STD_DO_SYNTAX_CHECK_FIRST
|
122
122
|
|
123
|
-
if
|
124
|
-
self.
|
123
|
+
if use_platform is not None:
|
124
|
+
self.use_platform = use_platform
|
125
125
|
else:
|
126
|
-
self.
|
126
|
+
self.guess_and_set_use_platform()
|
127
127
|
|
128
128
|
self.db_session = db_session
|
129
129
|
|
@@ -185,7 +185,7 @@ class CheckerBase:
|
|
185
185
|
def wrapper(self, *args, **kwargs): # pragma: no cover ## Safety!
|
186
186
|
result = func(self, *args, **kwargs) # pylint: disable=not-callable
|
187
187
|
|
188
|
-
self.status.tested_at = datetime.datetime.
|
188
|
+
self.status.tested_at = datetime.datetime.now(datetime.timezone.utc)
|
189
189
|
|
190
190
|
return result
|
191
191
|
|
@@ -320,17 +320,17 @@ class CheckerBase:
|
|
320
320
|
return self
|
321
321
|
|
322
322
|
@property
|
323
|
-
def
|
323
|
+
def use_platform(self) -> bool:
|
324
324
|
"""
|
325
|
-
Provides the current value of the :code:`
|
325
|
+
Provides the current value of the :code:`_use_platform` attribute.
|
326
326
|
"""
|
327
327
|
|
328
|
-
return self.
|
328
|
+
return self._use_platform
|
329
329
|
|
330
|
-
@
|
331
|
-
def
|
330
|
+
@use_platform.setter
|
331
|
+
def use_platform(self, value: bool) -> None:
|
332
332
|
"""
|
333
|
-
Sets the value which authorizes the usage of the
|
333
|
+
Sets the value which authorizes the usage of the platform.
|
334
334
|
|
335
335
|
:param value:
|
336
336
|
The value to set.
|
@@ -342,32 +342,32 @@ class CheckerBase:
|
|
342
342
|
if not isinstance(value, bool):
|
343
343
|
raise TypeError(f"<value> should be {bool}, {type(value)} given.")
|
344
344
|
|
345
|
-
self.
|
345
|
+
self._use_platform = self.params.use_platform = value
|
346
346
|
|
347
|
-
def
|
347
|
+
def set_use_platform(self, value: bool) -> "CheckerBase":
|
348
348
|
"""
|
349
|
-
Sets the value which authorizes the usage of the
|
349
|
+
Sets the value which authorizes the usage of the platform.
|
350
350
|
|
351
351
|
:param value:
|
352
352
|
The value to set.
|
353
353
|
"""
|
354
354
|
|
355
|
-
self.
|
355
|
+
self.use_platform = value
|
356
356
|
|
357
357
|
return self
|
358
358
|
|
359
|
-
def
|
359
|
+
def guess_and_set_use_platform(self) -> "CheckerBase":
|
360
360
|
"""
|
361
|
-
Try to guess and set the value of the :code:`
|
361
|
+
Try to guess and set the value of the :code:`use_platform` attribute.
|
362
362
|
"""
|
363
363
|
|
364
364
|
if PyFunceble.facility.ConfigLoader.is_already_loaded():
|
365
|
-
if isinstance(PyFunceble.storage.CONFIGURATION.lookup.
|
366
|
-
self.
|
365
|
+
if isinstance(PyFunceble.storage.CONFIGURATION.lookup.platform, bool):
|
366
|
+
self.use_platform = PyFunceble.storage.CONFIGURATION.lookup.platform
|
367
367
|
else:
|
368
|
-
self.
|
368
|
+
self.use_platform = self.STD_USE_PLATFORM
|
369
369
|
else:
|
370
|
-
self.
|
370
|
+
self.use_platform = self.STD_USE_PLATFORM
|
371
371
|
|
372
372
|
def subject_propagator(self) -> "CheckerBase":
|
373
373
|
"""
|
@@ -92,7 +92,7 @@ class ReputationCheckerBase(CheckerBase):
|
|
92
92
|
subject: Optional[str] = None,
|
93
93
|
do_syntax_check_first: Optional[bool] = None,
|
94
94
|
db_session: Optional[Session] = None,
|
95
|
-
|
95
|
+
use_platform: Optional[bool] = None,
|
96
96
|
) -> None:
|
97
97
|
self.dns_query_tool = DNSQueryTool()
|
98
98
|
self.ipv4_reputation_query_tool = IPV4ReputationDataset()
|
@@ -110,7 +110,7 @@ class ReputationCheckerBase(CheckerBase):
|
|
110
110
|
subject,
|
111
111
|
do_syntax_check_first=do_syntax_check_first,
|
112
112
|
db_session=db_session,
|
113
|
-
|
113
|
+
use_platform=use_platform,
|
114
114
|
)
|
115
115
|
|
116
116
|
@staticmethod
|
@@ -242,45 +242,45 @@ class ReputationCheckerBase(CheckerBase):
|
|
242
242
|
|
243
243
|
return self
|
244
244
|
|
245
|
-
def
|
245
|
+
def try_to_query_status_from_platform(self) -> "ReputationCheckerBase":
|
246
246
|
"""
|
247
|
-
Tries to get and set the status from the
|
247
|
+
Tries to get and set the status from the Platform API.
|
248
248
|
"""
|
249
249
|
|
250
250
|
PyFunceble.facility.Logger.info(
|
251
|
-
"Started to try to query the status of %r from:
|
251
|
+
"Started to try to query the status of %r from: Platform Lookup",
|
252
252
|
self.status.idna_subject,
|
253
253
|
)
|
254
254
|
|
255
|
-
data = self.
|
255
|
+
data = self.platform_query_tool[self.idna_subject]
|
256
256
|
|
257
257
|
if data and "status" in data:
|
258
258
|
if (
|
259
|
-
self.
|
259
|
+
self.platform_query_tool.preferred_status_origin == "frequent"
|
260
260
|
and data["status"]["reputation"]["frequent"]
|
261
261
|
):
|
262
262
|
self.status.status = data["status"]["reputation"]["frequent"]
|
263
|
-
self.status.status_source = "
|
263
|
+
self.status.status_source = "PLATFORM"
|
264
264
|
elif (
|
265
|
-
self.
|
265
|
+
self.platform_query_tool.preferred_status_origin == "latest"
|
266
266
|
and data["status"]["reputation"]["latest"]
|
267
267
|
):
|
268
268
|
self.status.status = data["status"]["reputation"]["latest"]["status"]
|
269
|
-
self.status.status_source = "
|
269
|
+
self.status.status_source = "PLATFORM"
|
270
270
|
elif (
|
271
|
-
self.
|
271
|
+
self.platform_query_tool.preferred_status_origin == "recommended"
|
272
272
|
and data["status"]["reputation"]["recommended"]
|
273
273
|
):
|
274
274
|
self.status.status = data["status"]["reputation"]["recommended"]
|
275
|
-
self.status.status_source = "
|
275
|
+
self.status.status_source = "PLATFORM"
|
276
276
|
|
277
277
|
PyFunceble.facility.Logger.info(
|
278
|
-
"Could define the status of %r from:
|
278
|
+
"Could define the status of %r from: Platform Lookup",
|
279
279
|
self.status.idna_subject,
|
280
280
|
)
|
281
281
|
|
282
282
|
PyFunceble.facility.Logger.info(
|
283
|
-
"Finished to try to query the status of %r from:
|
283
|
+
"Finished to try to query the status of %r from: Platform Lookup",
|
284
284
|
self.status.idna_subject,
|
285
285
|
)
|
286
286
|
|
@@ -294,9 +294,9 @@ class ReputationCheckerBase(CheckerBase):
|
|
294
294
|
status_post_syntax_checker = None
|
295
295
|
|
296
296
|
if (
|
297
|
-
not self.status.status and self.
|
297
|
+
not self.status.status and self.use_platform
|
298
298
|
): # pragma: no cover ## Underlying tested
|
299
|
-
self.
|
299
|
+
self.try_to_query_status_from_platform()
|
300
300
|
|
301
301
|
if not self.status.status and self.do_syntax_check_first:
|
302
302
|
self.try_to_query_status_from_syntax_lookup()
|
@@ -78,18 +78,18 @@ class DomainAndIPReputationChecker(ReputationCheckerBase):
|
|
78
78
|
self.subject,
|
79
79
|
do_syntax_check_first=self.do_syntax_check_first,
|
80
80
|
db_session=self.db_session,
|
81
|
-
|
81
|
+
use_platform=self.use_platform,
|
82
82
|
)
|
83
83
|
else:
|
84
84
|
query_object = DomainReputationChecker(
|
85
85
|
self.subject,
|
86
86
|
do_syntax_check_first=self.do_syntax_check_first,
|
87
87
|
db_session=self.db_session,
|
88
|
-
|
88
|
+
use_platform=self.use_platform,
|
89
89
|
)
|
90
90
|
|
91
91
|
query_object.ipv4_reputation_query_tool = self.ipv4_reputation_query_tool
|
92
|
-
query_object.
|
92
|
+
query_object.platform_query_tool = self.platform_query_tool
|
93
93
|
query_object.dns_query_tool = self.dns_query_tool
|
94
94
|
|
95
95
|
result = query_object.query_status()
|
@@ -83,7 +83,7 @@ class DomainAndIPSyntaxChecker(SyntaxCheckerBase):
|
|
83
83
|
else:
|
84
84
|
query_object = DomainSyntaxChecker(self.subject, db_session=self.db_session)
|
85
85
|
|
86
|
-
query_object.
|
86
|
+
query_object.platform_query_tool = self.platform_query_tool
|
87
87
|
|
88
88
|
result = query_object.query_status()
|
89
89
|
|
@@ -55,7 +55,7 @@ License:
|
|
55
55
|
import datetime
|
56
56
|
import functools
|
57
57
|
import secrets
|
58
|
-
from typing import Any, Optional
|
58
|
+
from typing import Any, List, Optional
|
59
59
|
|
60
60
|
import PyFunceble.cli.continuous_integration.exceptions
|
61
61
|
import PyFunceble.facility
|
@@ -105,6 +105,8 @@ class ContinuousIntegrationBase:
|
|
105
105
|
STD_END_COMMIT_MESSAGE: str = "PyFunceble - Results"
|
106
106
|
STD_MAX_EXEC_MINUTES: int = 15
|
107
107
|
|
108
|
+
COMMON_CI_SKIP_MARKER: List[str] = ["[skip ci]", "[ci skip]", "[no ci]"]
|
109
|
+
|
108
110
|
end_commit_marker: str = "[ci skip]"
|
109
111
|
|
110
112
|
_authorized: bool = False
|
@@ -347,6 +349,17 @@ class ContinuousIntegrationBase:
|
|
347
349
|
|
348
350
|
self._authorized = value
|
349
351
|
|
352
|
+
@property
|
353
|
+
def bypass_bypass(self) -> bool:
|
354
|
+
"""
|
355
|
+
Provides the currently state of the :code:`_bypass_bypass` attribute.
|
356
|
+
"""
|
357
|
+
|
358
|
+
return (
|
359
|
+
EnvironmentVariableHelper("PYFUNCEBLE_BYPASS_BYPASS").get_value()
|
360
|
+
is not None
|
361
|
+
)
|
362
|
+
|
350
363
|
def set_authorized(self, value: bool) -> "ContinuousIntegrationBase":
|
351
364
|
"""
|
352
365
|
Sets the value of the :code:`authorized` attribute.
|
@@ -786,7 +799,7 @@ class ContinuousIntegrationBase:
|
|
786
799
|
Sets the starting time to now.
|
787
800
|
"""
|
788
801
|
|
789
|
-
self.start_time = datetime.datetime.
|
802
|
+
self.start_time = datetime.datetime.now(datetime.timezone.utc)
|
790
803
|
self.expected_end_time = self.start_time + datetime.timedelta(
|
791
804
|
minutes=self.max_exec_minutes
|
792
805
|
)
|
@@ -1020,7 +1033,7 @@ class ContinuousIntegrationBase:
|
|
1020
1033
|
Checks if we exceeded the allocated time we have.
|
1021
1034
|
"""
|
1022
1035
|
|
1023
|
-
return self.expected_end_time < datetime.datetime.
|
1036
|
+
return self.expected_end_time < datetime.datetime.now(datetime.timezone.utc)
|
1024
1037
|
|
1025
1038
|
@execute_if_authorized(None)
|
1026
1039
|
@ensure_token_is_given
|
@@ -1136,12 +1149,15 @@ class ContinuousIntegrationBase:
|
|
1136
1149
|
raise PyFunceble.cli.continuous_integration.exceptions.StopExecution()
|
1137
1150
|
|
1138
1151
|
@execute_if_authorized(None)
|
1139
|
-
def apply_end_commit(self) -> None:
|
1152
|
+
def apply_end_commit(self, *, push: bool = True) -> None:
|
1140
1153
|
"""
|
1141
1154
|
Apply the "end" commit and push.
|
1142
1155
|
|
1143
1156
|
Side effect:
|
1144
1157
|
It runs the declared command to execute.
|
1158
|
+
|
1159
|
+
:param push:
|
1160
|
+
Whether we should push the changes or not.
|
1145
1161
|
"""
|
1146
1162
|
|
1147
1163
|
PyFunceble.facility.Logger.info(
|
@@ -1189,18 +1205,19 @@ class ContinuousIntegrationBase:
|
|
1189
1205
|
"Finished to prepare and apply final GIT commit."
|
1190
1206
|
)
|
1191
1207
|
|
1192
|
-
if
|
1193
|
-
self.push_changes(branch_to_use)
|
1194
|
-
else:
|
1208
|
+
if push:
|
1195
1209
|
self.push_changes(branch_to_use)
|
1196
1210
|
|
1197
1211
|
@execute_if_authorized(None)
|
1198
|
-
def apply_commit(self) -> None:
|
1212
|
+
def apply_commit(self, *, push: bool = True) -> None:
|
1199
1213
|
"""
|
1200
1214
|
Apply the commit and push.
|
1201
1215
|
|
1202
1216
|
Side effect:
|
1203
1217
|
It runs the declared command to execute.
|
1218
|
+
|
1219
|
+
:param push:
|
1220
|
+
Whether we should push the changes or not.
|
1204
1221
|
"""
|
1205
1222
|
|
1206
1223
|
PyFunceble.facility.Logger.info("Started to prepare and apply GIT commit.")
|
@@ -1234,7 +1251,8 @@ class ContinuousIntegrationBase:
|
|
1234
1251
|
|
1235
1252
|
PyFunceble.facility.Logger.info("Finished to prepare and apply GIT commit.")
|
1236
1253
|
|
1237
|
-
|
1254
|
+
if push:
|
1255
|
+
self.push_changes(self.git_branch)
|
1238
1256
|
|
1239
1257
|
@execute_if_authorized(None)
|
1240
1258
|
def bypass(self) -> None:
|
@@ -1243,13 +1261,24 @@ class ContinuousIntegrationBase:
|
|
1243
1261
|
|
1244
1262
|
- :code:`[PyFunceble skip]` (case insensitive)
|
1245
1263
|
- :code:`[PyFunceble-skip]` (case insensitive)
|
1264
|
+
- :code:`[skip-PyFunceble]` (case insensitive)
|
1265
|
+
- :code:`[skip PyFunceble]` (case insensitive)
|
1246
1266
|
- :attr:`~PyFunceble.cli.continuous_integration.base.end_commit_marker`
|
1267
|
+
- :attr:`~PyFunceble.cli.continuous_integration.base.COMMON_CI_SKIP_MARKER`
|
1247
1268
|
"""
|
1248
1269
|
|
1249
|
-
our_marker =
|
1270
|
+
our_marker = self.COMMON_CI_SKIP_MARKER + [
|
1271
|
+
"[pyfunceble skip]",
|
1272
|
+
"[pyfunceble-skip]",
|
1273
|
+
"[skip-pyfunceble]",
|
1274
|
+
"[skip pyfunceble]",
|
1275
|
+
self.end_commit_marker,
|
1276
|
+
]
|
1250
1277
|
latest_commit = CommandHelper("git log -1").execute().lower()
|
1251
1278
|
|
1252
|
-
if
|
1279
|
+
if not self.bypass_bypass and any(
|
1280
|
+
x.lower() in latest_commit for x in our_marker
|
1281
|
+
):
|
1253
1282
|
PyFunceble.facility.Logger.info(
|
1254
1283
|
"Bypass marker caught. Saving and stopping process."
|
1255
1284
|
)
|
@@ -386,30 +386,30 @@ def get_test_control_group_data() -> List[Tuple[List[str], dict]]:
|
|
386
386
|
},
|
387
387
|
),
|
388
388
|
(
|
389
|
-
["--
|
389
|
+
["--platform-preferred-origin"],
|
390
390
|
{
|
391
|
-
"dest": "
|
391
|
+
"dest": "platform.preferred_status_origin",
|
392
392
|
"type": str,
|
393
393
|
"choices": ["frequent", "latest", "recommended"],
|
394
394
|
"help": "Sets the preferred status origin. %s"
|
395
|
-
% get_configured_value("
|
395
|
+
% get_configured_value("platform.preferred_status_origin"),
|
396
396
|
},
|
397
397
|
),
|
398
398
|
(
|
399
|
-
["--
|
399
|
+
["--platform-lookup"],
|
400
400
|
{
|
401
|
-
"dest": "lookup.
|
401
|
+
"dest": "lookup.platform",
|
402
402
|
"action": "store_true",
|
403
|
-
"help": "Activates or disables the usage of the
|
404
|
-
"whether possible. %s" % get_configured_value("lookup.
|
403
|
+
"help": "Activates or disables the usage of the Platform lookup\n"
|
404
|
+
"whether possible. %s" % get_configured_value("lookup.platform"),
|
405
405
|
},
|
406
406
|
),
|
407
407
|
(
|
408
|
-
["--
|
408
|
+
["--platform-lookup-only"],
|
409
409
|
{
|
410
|
-
"dest": "self_contained.lookup.
|
410
|
+
"dest": "self_contained.lookup.platform",
|
411
411
|
"action": "store_true",
|
412
|
-
"help": "Only perform a
|
412
|
+
"help": "Only perform a Platform lookup.",
|
413
413
|
},
|
414
414
|
),
|
415
415
|
(
|
@@ -1009,13 +1009,13 @@ def get_output_control_group_data() -> List[Tuple[List[str], dict]]:
|
|
1009
1009
|
),
|
1010
1010
|
(
|
1011
1011
|
[
|
1012
|
-
"--push-
|
1012
|
+
"--push-platform",
|
1013
1013
|
],
|
1014
1014
|
{
|
1015
|
-
"dest": "
|
1015
|
+
"dest": "platform.push",
|
1016
1016
|
"action": "store_true",
|
1017
1017
|
"help": "Activates or disables the push of test result into the\n"
|
1018
|
-
"
|
1018
|
+
"Platform API. %s" % get_configured_value("platform.push"),
|
1019
1019
|
},
|
1020
1020
|
),
|
1021
1021
|
(
|
PyFunceble/cli/execution_time.py
CHANGED
@@ -181,7 +181,7 @@ class ExecutionTime:
|
|
181
181
|
Sets the starting time to now.
|
182
182
|
"""
|
183
183
|
|
184
|
-
self.start_time = datetime.datetime.
|
184
|
+
self.start_time = datetime.datetime.now(datetime.timezone.utc)
|
185
185
|
|
186
186
|
return self
|
187
187
|
|
@@ -191,7 +191,7 @@ class ExecutionTime:
|
|
191
191
|
Sets the starting time to now.
|
192
192
|
"""
|
193
193
|
|
194
|
-
self.end_time = datetime.datetime.
|
194
|
+
self.end_time = datetime.datetime.now(datetime.timezone.utc)
|
195
195
|
|
196
196
|
return self
|
197
197
|
|
PyFunceble/cli/file_preloader.py
CHANGED
@@ -53,7 +53,7 @@ License:
|
|
53
53
|
import copy
|
54
54
|
import functools
|
55
55
|
import os
|
56
|
-
from datetime import datetime, timedelta
|
56
|
+
from datetime import datetime, timedelta, timezone
|
57
57
|
from typing import Any, Optional
|
58
58
|
|
59
59
|
from domain2idna import domain2idna
|
@@ -455,9 +455,9 @@ class FilePreloader:
|
|
455
455
|
to_send = copy.deepcopy(self.protocol)
|
456
456
|
to_send["subject"] = subject
|
457
457
|
to_send["idna_subject"] = domain2idna(subject)
|
458
|
-
to_send["tested_at"] = datetime.
|
459
|
-
|
460
|
-
)
|
458
|
+
to_send["tested_at"] = datetime.now(
|
459
|
+
timezone.utc
|
460
|
+
) - timedelta(days=365.25 * 20)
|
461
461
|
|
462
462
|
if self.inactive_dataset.exists(to_send):
|
463
463
|
print_single_line("I")
|
@@ -51,7 +51,7 @@ License:
|
|
51
51
|
"""
|
52
52
|
|
53
53
|
import functools
|
54
|
-
from datetime import datetime
|
54
|
+
from datetime import datetime, timezone
|
55
55
|
from typing import Dict, Optional
|
56
56
|
|
57
57
|
import PyFunceble.facility
|
@@ -171,7 +171,7 @@ class FilePrinter(PrinterBase):
|
|
171
171
|
Provides the line which informs of the date a file was generated.
|
172
172
|
"""
|
173
173
|
|
174
|
-
return f"# Date of generation: {datetime.
|
174
|
+
return f"# Date of generation: {datetime.now(timezone.utc).isoformat()}"
|
175
175
|
|
176
176
|
@ensure_destination_is_given
|
177
177
|
def print_interpolated_line(self) -> None:
|
@@ -133,7 +133,8 @@ class InactiveJSON2CSVMigrator(JSON2CSVMigratorBase):
|
|
133
133
|
if not value:
|
134
134
|
if index.isdigit():
|
135
135
|
dataset["tested_at"] = datetime.datetime.fromtimestamp(
|
136
|
-
float(index)
|
136
|
+
float(index),
|
137
|
+
datetime.timezone.utc,
|
137
138
|
).isoformat()
|
138
139
|
else:
|
139
140
|
dataset["source"] = os.path.abspath(index)
|
@@ -147,7 +148,9 @@ class InactiveJSON2CSVMigrator(JSON2CSVMigratorBase):
|
|
147
148
|
dataset["status"] = value
|
148
149
|
|
149
150
|
if not dataset["tested_at"]:
|
150
|
-
dataset["tested_at"] = datetime.datetime.
|
151
|
+
dataset["tested_at"] = datetime.datetime.now(
|
152
|
+
datetime.timezone.utc
|
153
|
+
).isoformat()
|
151
154
|
|
152
155
|
PyFunceble.facility.Logger.debug("Decoded dataset:\n%r.", dataset)
|
153
156
|
|