modulitiz-micro 2.37.0__py311-none-any.whl → 2.38.1__py311-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.
- modulitiz_micro/ModuloDate.py +1 -1
- modulitiz_micro/rete/ModuloNetworking.py +19 -14
- modulitiz_micro/rete/http/ModuloHttp.py +15 -12
- modulitiz_micro/util/wheel/ModuloBuildWheel.py +6 -5
- modulitiz_micro/util/wheel/ModuloCheckTestNamingConvention.py +7 -1
- {modulitiz_micro-2.37.0.dist-info → modulitiz_micro-2.38.1.dist-info}/METADATA +1 -1
- {modulitiz_micro-2.37.0.dist-info → modulitiz_micro-2.38.1.dist-info}/RECORD +10 -10
- {modulitiz_micro-2.37.0.dist-info → modulitiz_micro-2.38.1.dist-info}/LICENSE +0 -0
- {modulitiz_micro-2.37.0.dist-info → modulitiz_micro-2.38.1.dist-info}/WHEEL +0 -0
- {modulitiz_micro-2.37.0.dist-info → modulitiz_micro-2.38.1.dist-info}/top_level.txt +0 -0
modulitiz_micro/ModuloDate.py
CHANGED
@@ -139,7 +139,7 @@ class ModuloDate(object):
|
|
139
139
|
def timestampToDate(timestamp:int|float)->datetime:
|
140
140
|
"""
|
141
141
|
Converte un timestamp in secondi in un oggetto data completo.
|
142
|
-
Se ti serve
|
142
|
+
Se ti serve lavorare con il timestamp in formato UTC usa il metodo dedicato.
|
143
143
|
"""
|
144
144
|
return datetime.fromtimestamp(timestamp)
|
145
145
|
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import os
|
2
|
+
import re
|
2
3
|
import socket
|
3
4
|
from contextlib import closing
|
4
5
|
from uuid import getnode
|
@@ -46,22 +47,26 @@ class ModuloNetworking(object):
|
|
46
47
|
return False
|
47
48
|
|
48
49
|
@staticmethod
|
49
|
-
def checkPing(
|
50
|
-
#
|
51
|
-
|
50
|
+
def checkPing(ipAddress:str)->bool:
|
51
|
+
# build command
|
52
|
+
cmd="ping "
|
53
|
+
regexPercPacketsLost=r"(\d{1,3})\% "
|
52
54
|
if ModuloSystem.isWindows():
|
53
|
-
|
55
|
+
cmd+="-n"
|
56
|
+
regexPercPacketsLost=r"\("+regexPercPacketsLost
|
54
57
|
elif os.name=='posix':
|
55
|
-
|
58
|
+
cmd+="-c"
|
59
|
+
regexPercPacketsLost=r", "+regexPercPacketsLost
|
56
60
|
else:
|
57
61
|
raise EccezioneRuntime("Tipologia del sistema operativo non riconosciuta: "+os.name)
|
58
|
-
|
59
|
-
#
|
60
|
-
outputComando=ModuloStringhe.normalizzaEol(ModuloSystem.systemCallReturnOutput(
|
61
|
-
|
62
|
-
|
63
|
-
for
|
64
|
-
if ModuloStringhe.contains(
|
65
|
-
|
66
|
-
|
62
|
+
cmd+=" 1 "+ipAddress
|
63
|
+
# execute command
|
64
|
+
outputComando=ModuloStringhe.normalizzaEol(ModuloSystem.systemCallReturnOutput(cmd,None))
|
65
|
+
rows=outputComando.split("\n")
|
66
|
+
rows=ModuloListe.eliminaElementiVuoti(rows)
|
67
|
+
for row in rows:
|
68
|
+
if ModuloStringhe.contains(row, "%"):
|
69
|
+
regexOutput=re.search(regexPercPacketsLost,row)
|
70
|
+
if regexOutput is not None:
|
71
|
+
return int(regexOutput.group(1).strip())==0
|
67
72
|
return False
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import gzip
|
2
|
+
import json
|
2
3
|
import logging
|
3
4
|
import ssl
|
4
5
|
import urllib
|
@@ -47,33 +48,35 @@ class ModuloHttp(object):
|
|
47
48
|
|
48
49
|
self.setUserAgent(self.UA_WINDOWS_FIREFOX)
|
49
50
|
self.addHeader('Accept-Encoding','gzip, deflate, br') # questo serve per ridurre la dimensione della risposta
|
50
|
-
if useProxy
|
51
|
+
if useProxy:
|
51
52
|
self.addHeader('Origin','localhost')
|
52
53
|
self.connectionSafe=ModuloHttpConnectionSafe(self.__logger)
|
53
|
-
self.postData=None
|
54
54
|
|
55
55
|
def doGet(self,retries:int,ignoreCerts:bool=False)->HttpResponseBean:
|
56
56
|
"""
|
57
57
|
Esegue una richiesta di tipo GET
|
58
58
|
"""
|
59
59
|
if retries==0:
|
60
|
-
return self.__getOrPost(
|
61
|
-
return self.connectionSafe.run(retries,0,self.__getOrPost,
|
60
|
+
return self.__getOrPost(ignoreCerts)
|
61
|
+
return self.connectionSafe.run(retries,0,self.__getOrPost,ignoreCerts)
|
62
62
|
|
63
|
-
def doPost(self, postData:dict, retries:int,ignoreCerts:bool=False)->HttpResponseBean:
|
63
|
+
def doPost(self, postData:dict, asJson:bool, retries:int,ignoreCerts:bool=False)->HttpResponseBean:
|
64
64
|
"""
|
65
65
|
Esegue una richiesta di tipo POST
|
66
66
|
"""
|
67
|
-
|
67
|
+
if not asJson:
|
68
|
+
postDataEncoded=urlencode(postData)
|
69
|
+
else:
|
70
|
+
postDataEncoded=json.dumps(postData)
|
71
|
+
self.addHeader("Content-Type","application/json; charset=utf-8")
|
72
|
+
postDataEncoded=postDataEncoded.encode()
|
73
|
+
self.__requestObj.data=postDataEncoded
|
68
74
|
if retries==0:
|
69
|
-
return self.__getOrPost(
|
70
|
-
return self.connectionSafe.run(retries,0,self.__getOrPost,
|
75
|
+
return self.__getOrPost(ignoreCerts)
|
76
|
+
return self.connectionSafe.run(retries,0,self.__getOrPost,ignoreCerts)
|
71
77
|
|
72
78
|
@catchAndRaiseHttpExceptions
|
73
|
-
def __getOrPost(self,
|
74
|
-
if not isGet:
|
75
|
-
postData=urlencode(self.postData).encode()
|
76
|
-
self.__requestObj.data=postData
|
79
|
+
def __getOrPost(self, ignoreCerts:bool)->HttpResponseBean:
|
77
80
|
# ignoro certificati
|
78
81
|
ctx=None
|
79
82
|
if ignoreCerts:
|
@@ -47,15 +47,15 @@ class ModuloBuildWheel(object):
|
|
47
47
|
{}""".format(ModuloColorText.GRASSETTO,msg,self.versionOld,ModuloColorText.DEFAULT))
|
48
48
|
# change dir
|
49
49
|
os.chdir(self.percorsoCartellaSource)
|
50
|
-
if self.__doUnitTests()
|
50
|
+
if self.__doUnitTests():
|
51
51
|
return
|
52
52
|
# aggiorno versione
|
53
53
|
self.moduloToml.updateVersion(self.versionNew)
|
54
54
|
# building wheel
|
55
55
|
ModuloSystem.systemCallPrintOutput(f'{self.CMD_PYTHON} -m pip install -U build twine==6.0.1',None)
|
56
56
|
print()
|
57
|
-
|
58
|
-
cmd='{} -m build --wheel --outdir "{}"'.format(self.CMD_PYTHON,
|
57
|
+
pathFolderWheel=ModuloFiles.pathJoin(self.percorsoCartellaRoot,"wheel")
|
58
|
+
cmd='{} -m build --wheel --outdir "{}"'.format(self.CMD_PYTHON,pathFolderWheel)
|
59
59
|
ModuloSystem.systemCallPrintOutput(cmd,None)
|
60
60
|
# deleting temporary dirs
|
61
61
|
print()
|
@@ -63,15 +63,16 @@ class ModuloBuildWheel(object):
|
|
63
63
|
shutil.rmtree(ModuloFiles.pathJoin(self.percorsoCartellaSource,self.moduleName+".egg-info"))
|
64
64
|
# install wheel
|
65
65
|
self.filenameWheel=self.PATTERN_NOMEFILE_WHEEL.format(self.moduleName,self.versionNew,self.moduloToml.retrieveMinPyVersion())
|
66
|
-
percorsoWheel=ModuloFiles.pathJoin(
|
66
|
+
percorsoWheel=ModuloFiles.pathJoin(pathFolderWheel,self.filenameWheel)
|
67
67
|
cmd='{} -m pip install -U "{}"'.format(self.CMD_PYTHON,percorsoWheel)
|
68
68
|
ModuloSystem.systemCallPrintOutput(cmd,None)
|
69
|
+
# upload to web
|
69
70
|
print()
|
70
71
|
print("Uploading to Pypi")
|
71
72
|
cmd='{} -m twine upload "{}"'.format(self.CMD_PYTHON,percorsoWheel)
|
72
73
|
ModuloSystem.systemCallPrintOutput(cmd,None)
|
73
74
|
# delete wheel
|
74
|
-
|
75
|
+
shutil.rmtree(pathFolderWheel)
|
75
76
|
|
76
77
|
def __doUnitTests(self) -> bool:
|
77
78
|
if self.skipUnitTest:
|
@@ -51,11 +51,14 @@ class ModuloCheckTestNamingConvention(object):
|
|
51
51
|
return
|
52
52
|
# file name must match class name
|
53
53
|
testClasses=ModuloFunzioni.getClassesFromFileSource(filenameAbs)
|
54
|
+
if len(testClasses)==0:
|
55
|
+
self.errors.append("File must contain at least 1 class: %s"%(filenameRel,))
|
56
|
+
return
|
54
57
|
if len(testClasses)>1:
|
55
58
|
self.errors.append("File must not contain more than 1 class: %s"%(filenameRel,))
|
56
59
|
return
|
57
60
|
baseFilename=ModuloFiles.getBaseFileNameAndExtension(filename)[0]
|
58
|
-
testClassName=None
|
61
|
+
testClassName:str|None=None
|
59
62
|
if not isDecorator:
|
60
63
|
testClassName=testClasses[0]
|
61
64
|
if testClassName!=baseFilename:
|
@@ -68,6 +71,9 @@ class ModuloCheckTestNamingConvention(object):
|
|
68
71
|
return
|
69
72
|
# source class name must equals class test
|
70
73
|
if not isDecorator:
|
74
|
+
if ModuloStringhe.isEmpty(testClassName):
|
75
|
+
self.errors.append("Test class name doesn't match source class name: %s"%(filenameRel,))
|
76
|
+
return
|
71
77
|
sourceClassName=ModuloFunzioni.getClassesFromFileSource(ModuloFiles.pathJoin(self.pathSource,sourceFilenameRel))[0]
|
72
78
|
if not testClassName.startswith(sourceClassName):
|
73
79
|
self.errors.append("Test class name doesn't match source class name: %s"%(filenameRel,))
|
@@ -1,6 +1,6 @@
|
|
1
1
|
modulitiz_micro/ModuloBase64.py,sha256=dW1TP8TkIuOqAbbJcvTAo4xEurHl8NBs8lQTuHY_HaU,1866
|
2
2
|
modulitiz_micro/ModuloColorText.py,sha256=_sMSh9xZ-qbpa35oaSGdzQJKpFiGLsCHtM4P1HQWcTE,828
|
3
|
-
modulitiz_micro/ModuloDate.py,sha256=
|
3
|
+
modulitiz_micro/ModuloDate.py,sha256=niDdyhWUkRNOfxK7G-RkvvuGJdPCCJRpL3-TFZiuUOE,7997
|
4
4
|
modulitiz_micro/ModuloFunzioni.py,sha256=K-8rwVeSEgKCCLQSIXVHZ69YhLRCy3ILYxZXZOy95eI,1947
|
5
5
|
modulitiz_micro/ModuloListe.py,sha256=aWqnJX2JAk_LApUQvObkc6P89qXJzFviljJeKa39KC8,3581
|
6
6
|
modulitiz_micro/ModuloMeteo.py,sha256=Tr3lRW-lvk9XKm_M-ZvohJ6ueA9oA4TbP6BaZVeCl60,2310
|
@@ -54,11 +54,11 @@ modulitiz_micro/multithread/ModuloThreadLogger.py,sha256=oQql4C3qrqOUksvcdrgZxgW
|
|
54
54
|
modulitiz_micro/multithread/ModuloThreadWithCallbackError.py,sha256=RQWfLDssdVmXoewrWaCdVSrySjbElh2iNBqlSslg0W8,724
|
55
55
|
modulitiz_micro/nlp/ModuloNlp.py,sha256=h7ca9kVLKRcqHMK6rCVOambdpPfh-ehVSppP2nYGxVA,799
|
56
56
|
modulitiz_micro/nlp/ModuloNlpDateAndTime.py,sha256=QCURYksP4-z_u03CVzcESLp5EtdIx2GNXDNYgYOPGuU,1851
|
57
|
-
modulitiz_micro/rete/ModuloNetworking.py,sha256=
|
57
|
+
modulitiz_micro/rete/ModuloNetworking.py,sha256=3tatSHP4s2AeBBZM4nsyZFHdhlXhNIG16C1SsCb6xYk,2114
|
58
58
|
modulitiz_micro/rete/ModuloOpenVpn.py,sha256=t99ofIYhM7q3HnQrvzQbx-6JeyDQqOc1wvg7pxvYo8U,627
|
59
59
|
modulitiz_micro/rete/email/EmailBean.py,sha256=EOKLfBVqwBEkbWfywiUmk2iB5K2uVlykxsh4zB9red8,168
|
60
60
|
modulitiz_micro/rete/email/ModuloEmail.py,sha256=6roT23q15xmo_olXORF19PRwss81tQg-71gGquvs28A,2956
|
61
|
-
modulitiz_micro/rete/http/ModuloHttp.py,sha256=
|
61
|
+
modulitiz_micro/rete/http/ModuloHttp.py,sha256=4IPwfUjwYHHBTavLxnAULOVetKpcE_kFLESWUFgO3w4,4693
|
62
62
|
modulitiz_micro/rete/http/ModuloHttpConnectionSafe.py,sha256=w1cLQrnPJXltUeJ4OOtFOTPv5k0J6uNqlrXUzO0UbX4,2936
|
63
63
|
modulitiz_micro/rete/http/ModuloHttpUtils.py,sha256=9r6Z4eT4j4ZH-UyjOQXz_vUaltW-oH9gyyQLZDgVf7s,2350
|
64
64
|
modulitiz_micro/rete/http/beans/HttpResponseBean.py,sha256=7JVywcWURv1I9rYKj4Kt9XLt7387wMZGTMefcsm7E3I,202
|
@@ -93,12 +93,12 @@ modulitiz_micro/util/spooler/eccezioni/EccezioneSpoolerFull.py,sha256=KEcDisixOS
|
|
93
93
|
modulitiz_micro/util/unittesting/AbstractOverrideTestUtil.py,sha256=5YX20I-rhl6TpRrqSdNafI1cqBAdTs2sgtOTDjzDn5k,754
|
94
94
|
modulitiz_micro/util/unittesting/AbstractTestUtil.py,sha256=AW9mCj8i_qHrigcXcvvjgdLxa-4Ce0jrwJEZqpPVBxY,297
|
95
95
|
modulitiz_micro/util/unittesting/ModuloRunUnitTest.py,sha256=_YHxjTk_t9wvlCYgS4HSQ657ht7ekSRQsH7i1aKw1LY,774
|
96
|
-
modulitiz_micro/util/wheel/ModuloBuildWheel.py,sha256=
|
97
|
-
modulitiz_micro/util/wheel/ModuloCheckTestNamingConvention.py,sha256=
|
96
|
+
modulitiz_micro/util/wheel/ModuloBuildWheel.py,sha256=OtZdKTiiU0XhrIjWaFlBx8denZXwWIe-V794YUi8WcE,4786
|
97
|
+
modulitiz_micro/util/wheel/ModuloCheckTestNamingConvention.py,sha256=ZGwMtVexRscwVEtiwxgU5ENsItcfsV2NEAcyclcLFgA,3885
|
98
98
|
modulitiz_micro/util/wheel/ModuloToml.py,sha256=774GQ8y6lyhOrT0edJPlLq4TBU7Nq4699q74deGlFW4,1205
|
99
99
|
modulitiz_micro/util/wheel/ModuloWheel.py,sha256=VRS_6kSt62qubBYzkGm91_GWzcIiD0KlSnaqhM_aQnE,338
|
100
|
-
modulitiz_micro-2.
|
101
|
-
modulitiz_micro-2.
|
102
|
-
modulitiz_micro-2.
|
103
|
-
modulitiz_micro-2.
|
104
|
-
modulitiz_micro-2.
|
100
|
+
modulitiz_micro-2.38.1.dist-info/LICENSE,sha256=b-Ia9Hv3N_FviXoFAXG44lDGbk4tCC0fBdduccm8nl0,1086
|
101
|
+
modulitiz_micro-2.38.1.dist-info/METADATA,sha256=F3Qr0knvwgGjNuWU7UqoZlLZta1i55imXv1TcTyz9bQ,1690
|
102
|
+
modulitiz_micro-2.38.1.dist-info/WHEEL,sha256=2aRSX09k7pmd4gPs96VOQ860h0v0t30ka6JGHtpC3BY,94
|
103
|
+
modulitiz_micro-2.38.1.dist-info/top_level.txt,sha256=ESJE0qtNJp3tbKPrffbFVjH511NSjJHxscfpdLjTpA8,16
|
104
|
+
modulitiz_micro-2.38.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|