inpython-package 1.0.4__tar.gz → 1.1.5__tar.gz
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.
- inpython_package-1.1.5/PKG-INFO +57 -0
- inpython_package-1.1.5/README.md +30 -0
- inpython_package-1.1.5/inpython/aotools/__init__.py +6 -0
- inpython_package-1.1.5/inpython/aotools/aogeo.py +61 -0
- inpython_package-1.1.5/inpython/ingraph/ingraph.py +53 -0
- inpython_package-1.1.5/inpython/intools/Servalux-devis.py +58 -0
- inpython_package-1.1.5/inpython/intools/__init__.py +6 -0
- inpython_package-1.1.5/inpython/intools/in_docx.py +61 -0
- inpython_package-1.1.5/inpython/intools/in_projet.py +55 -0
- inpython_package-1.1.5/inpython/intools/in_test.py +4 -0
- inpython_package-1.1.5/inpython/intools/xls_to_csv.py +45 -0
- inpython_package-1.1.5/inpython_package.egg-info/PKG-INFO +57 -0
- {inpython-package-1.0.4 → inpython_package-1.1.5}/inpython_package.egg-info/SOURCES.txt +8 -0
- inpython_package-1.1.5/inpython_package.egg-info/requires.txt +5 -0
- {inpython-package-1.0.4 → inpython_package-1.1.5}/setup.py +6 -2
- inpython-package-1.0.4/PKG-INFO +0 -35
- inpython-package-1.0.4/README.md +0 -23
- inpython-package-1.0.4/inpython/ingraph/ingraph.py +0 -129
- inpython-package-1.0.4/inpython_package.egg-info/PKG-INFO +0 -35
- inpython-package-1.0.4/inpython_package.egg-info/requires.txt +0 -1
- {inpython-package-1.0.4 → inpython_package-1.1.5}/LICENSE.txt +0 -0
- {inpython-package-1.0.4 → inpython_package-1.1.5}/inpython/__init__.py +0 -0
- {inpython-package-1.0.4 → inpython_package-1.1.5}/inpython/__main__.py +0 -0
- {inpython-package-1.0.4 → inpython_package-1.1.5}/inpython/ingraph/__init__.py +0 -0
- {inpython-package-1.0.4 → inpython_package-1.1.5}/inpython_package.egg-info/dependency_links.txt +0 -0
- {inpython-package-1.0.4 → inpython_package-1.1.5}/inpython_package.egg-info/top_level.txt +0 -0
- {inpython-package-1.0.4 → inpython_package-1.1.5}/setup.cfg +0 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: inpython-package
|
|
3
|
+
Version: 1.1.5
|
|
4
|
+
Summary: # Infodata's IN-Tools U2Python Package
|
|
5
|
+
Home-page: https://bitbucket.org/infodata-dev/inpython
|
|
6
|
+
Author: infodata
|
|
7
|
+
Author-email: efv@infodata.lu
|
|
8
|
+
License: MIT
|
|
9
|
+
Requires-Python: >=3.4
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE.txt
|
|
12
|
+
Requires-Dist: msal>=1.22
|
|
13
|
+
Requires-Dist: qrcode
|
|
14
|
+
Requires-Dist: requests
|
|
15
|
+
Requires-Dist: qrcode[pil]
|
|
16
|
+
Requires-Dist: dotenv
|
|
17
|
+
Dynamic: author
|
|
18
|
+
Dynamic: author-email
|
|
19
|
+
Dynamic: description
|
|
20
|
+
Dynamic: description-content-type
|
|
21
|
+
Dynamic: home-page
|
|
22
|
+
Dynamic: license
|
|
23
|
+
Dynamic: license-file
|
|
24
|
+
Dynamic: requires-dist
|
|
25
|
+
Dynamic: requires-python
|
|
26
|
+
Dynamic: summary
|
|
27
|
+
|
|
28
|
+
# README
|
|
29
|
+
|
|
30
|
+
Ce projet **inpython-package** rassemble tous les packages et modules python exploités par Integrix .
|
|
31
|
+
|
|
32
|
+
## sub-package **inpython.ingraph**
|
|
33
|
+
|
|
34
|
+
package pour la gestion avec MS-Graph en exploitant le module 'msal' (Microsoft Authentication Library).
|
|
35
|
+
|
|
36
|
+
## How do I get set up?
|
|
37
|
+
|
|
38
|
+
* Les bases de u2Python c.f. [wiki sys/proc/install u2Python](https://wiki.infodata.lu/sys/proc/install_u2python)
|
|
39
|
+
* [U2Python par RocketSoftware](https://docs.rocketsoftware.com/bundle/UniVerse_PythonUserGuide_V1134/resource/UniVerse_PythonUserGuide_V1134.pdf)
|
|
40
|
+
* Vérifier la version de u2Python, au TCL uv
|
|
41
|
+
|
|
42
|
+
```python
|
|
43
|
+
>python
|
|
44
|
+
import sys
|
|
45
|
+
print(sys.version)
|
|
46
|
+
print(sys.executable) # -> 'C:\\U2\\UV\\BIN\\uv.exe' uvbin !!
|
|
47
|
+
print('\n'.join(sys.path)) # les path en cours
|
|
48
|
+
exit()
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Install inPackages into U2python
|
|
52
|
+
|
|
53
|
+
* `pip3 install inpython-package`
|
|
54
|
+
|
|
55
|
+
## Manage Package
|
|
56
|
+
|
|
57
|
+
* c.f. [devREADME](devREADME.md)
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# README
|
|
2
|
+
|
|
3
|
+
Ce projet **inpython-package** rassemble tous les packages et modules python exploités par Integrix .
|
|
4
|
+
|
|
5
|
+
## sub-package **inpython.ingraph**
|
|
6
|
+
|
|
7
|
+
package pour la gestion avec MS-Graph en exploitant le module 'msal' (Microsoft Authentication Library).
|
|
8
|
+
|
|
9
|
+
## How do I get set up?
|
|
10
|
+
|
|
11
|
+
* Les bases de u2Python c.f. [wiki sys/proc/install u2Python](https://wiki.infodata.lu/sys/proc/install_u2python)
|
|
12
|
+
* [U2Python par RocketSoftware](https://docs.rocketsoftware.com/bundle/UniVerse_PythonUserGuide_V1134/resource/UniVerse_PythonUserGuide_V1134.pdf)
|
|
13
|
+
* Vérifier la version de u2Python, au TCL uv
|
|
14
|
+
|
|
15
|
+
```python
|
|
16
|
+
>python
|
|
17
|
+
import sys
|
|
18
|
+
print(sys.version)
|
|
19
|
+
print(sys.executable) # -> 'C:\\U2\\UV\\BIN\\uv.exe' uvbin !!
|
|
20
|
+
print('\n'.join(sys.path)) # les path en cours
|
|
21
|
+
exit()
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Install inPackages into U2python
|
|
25
|
+
|
|
26
|
+
* `pip3 install inpython-package`
|
|
27
|
+
|
|
28
|
+
## Manage Package
|
|
29
|
+
|
|
30
|
+
* c.f. [devREADME](devREADME.md)
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"""Always-On geocoding module
|
|
2
|
+
|
|
3
|
+
Content :
|
|
4
|
+
=========
|
|
5
|
+
distance_calculation : Calculate distance between 2 points or multiple points on earth
|
|
6
|
+
offset_calculation : Calculate one or more GPS coordinates from an initial point based on a given azimuth and distance
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
import geopy.distance
|
|
10
|
+
from latlon import *
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def distance_calculation(origin, coordinates):
|
|
14
|
+
"""Calculate distance between 2 points or multiple points on earth
|
|
15
|
+
|
|
16
|
+
Usage :
|
|
17
|
+
=======
|
|
18
|
+
origin (tuple) : The origin from which we want to calculate distances
|
|
19
|
+
coordinates (list) : Points used to calculate the distance
|
|
20
|
+
|
|
21
|
+
Example :
|
|
22
|
+
=========
|
|
23
|
+
distance_calculation((52.2296756, 21.0122287), [(52.406374, 16.9251681), (52.606374, 16.5251681)])
|
|
24
|
+
Output = [279.35290160430094, 308.0962131498814]
|
|
25
|
+
"""
|
|
26
|
+
try:
|
|
27
|
+
return [geopy.distance.geodesic(
|
|
28
|
+
origin, coordinate).km for coordinate in coordinates]
|
|
29
|
+
except Exception as e:
|
|
30
|
+
raise e
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def offset_calculation(origin, azimuths_and_distances):
|
|
34
|
+
""" Calculate one or more GPS coordinates from an initial point based on a given azimuth and distance
|
|
35
|
+
|
|
36
|
+
Usage :
|
|
37
|
+
=======
|
|
38
|
+
origin (tuple) : The origin from which we want to calculate offsets
|
|
39
|
+
azimuths_and_distances (list) : List of azimuths and distances
|
|
40
|
+
|
|
41
|
+
Example :
|
|
42
|
+
=========
|
|
43
|
+
offset_calculation((52.2296756, 21.0122287), [(0, 279.35290160430094), (50, 308.0962131498814)])
|
|
44
|
+
Output = 54.739690349825885,21.01222870000001|53.95616765233316,24.60854517315002
|
|
45
|
+
"""
|
|
46
|
+
try:
|
|
47
|
+
origin = LatLon(Latitude(origin[0]), Longitude(origin[1]))
|
|
48
|
+
points = [origin.offset(azim, dist)
|
|
49
|
+
for azim, dist in azimuths_and_distances]
|
|
50
|
+
points = ["{0},{1}".format(point.lat, point.lon) for point in points]
|
|
51
|
+
return "|".join(points)
|
|
52
|
+
except Exception as e:
|
|
53
|
+
raise e
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
if __name__ == "__main__":
|
|
57
|
+
print("Hello from aogeo")
|
|
58
|
+
print(distance_calculation(
|
|
59
|
+
(52.2296756, 21.0122287), [(52.406374, 16.9251681), (52.606374, 16.5251681)]))
|
|
60
|
+
print(offset_calculation((52.2296756, 21.0122287), [
|
|
61
|
+
(0, 279.35290160430094), (50, 308.0962131498814)]))
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# infodata' u2python module to work with ..GRAPH... intools
|
|
2
|
+
# efv 20240403 elimine le finaly car cela efface les erreurs
|
|
3
|
+
import sys
|
|
4
|
+
import json
|
|
5
|
+
import msal
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def helloWorld():
|
|
9
|
+
print("hello from inpython.ingraph")
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def getGraphTokenFromCertificate(path):
|
|
13
|
+
# fonctions pour générer un token Graph avec un certificat
|
|
14
|
+
# retourne un objet string json ou un erreur python
|
|
15
|
+
# {
|
|
16
|
+
# "token_type": "Bearer",
|
|
17
|
+
# "expires_in": 3599,
|
|
18
|
+
# "ext_expires_in": 3599,
|
|
19
|
+
# "access_token": "eyJ0eXAiOiJKV1QiLCJub25jZS..."
|
|
20
|
+
# }
|
|
21
|
+
# c.f. https://github.com/Azure-Samples/ms-identity-python-daemon/tree/master/2-Call-MsGraph-WithCertificate
|
|
22
|
+
#-------------------------------------------------------------------------------------------------------------
|
|
23
|
+
# load config file .json
|
|
24
|
+
# {
|
|
25
|
+
# "authority": "https://login.microsoftonline.com/infodata.lu",
|
|
26
|
+
# "tenant_id": "e2a26e34-3...",
|
|
27
|
+
# "client_id": "15855fc2-...",
|
|
28
|
+
# "scope": [ "https://graph.microsoft.com/.default" ],
|
|
29
|
+
# "thumbprint": "9615472D8...",
|
|
30
|
+
# "private_key_file": "...//9615472D8...//9615472D8....privatekey"
|
|
31
|
+
# }
|
|
32
|
+
result = ''
|
|
33
|
+
try:
|
|
34
|
+
# open & load config
|
|
35
|
+
f_path = open(path)
|
|
36
|
+
config = json.load(f_path)
|
|
37
|
+
# open & load private key
|
|
38
|
+
f_privatekey = open(config['private_key_file'])
|
|
39
|
+
privatekey = f_privatekey.read()
|
|
40
|
+
# connect to the app
|
|
41
|
+
msal_app = msal.ConfidentialClientApplication(
|
|
42
|
+
config["client_id"],
|
|
43
|
+
authority=config["authority"],
|
|
44
|
+
client_credential={"thumbprint": config["thumbprint"],
|
|
45
|
+
"private_key": privatekey},
|
|
46
|
+
)
|
|
47
|
+
# try to get a token
|
|
48
|
+
result = msal_app.acquire_token_for_client(scopes=config["scope"])
|
|
49
|
+
result = json.dumps(result)
|
|
50
|
+
return result
|
|
51
|
+
except:
|
|
52
|
+
# toute exception issue de la séquence try arrive ici et est remontée à l'appelant 'uvpython'
|
|
53
|
+
raise # pour que l'appelant reçoive l'exception
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
from docx import Document
|
|
2
|
+
|
|
3
|
+
def chk_br(par):
|
|
4
|
+
for run in par.r_lst:
|
|
5
|
+
if len(run.br_lst) > 0:
|
|
6
|
+
return(True)
|
|
7
|
+
return(False)
|
|
8
|
+
|
|
9
|
+
def build_word_file(doc_directory,fab_filename,skipped_pg_br,keeped_pg_br):
|
|
10
|
+
tmp_file = doc_directory + "/schemas.docx"
|
|
11
|
+
|
|
12
|
+
print(fab_filename)
|
|
13
|
+
doc_fab = Document(fab_filename)
|
|
14
|
+
doc_fab.save(tmp_file)
|
|
15
|
+
doc_tmp = Document(tmp_file)
|
|
16
|
+
|
|
17
|
+
# extraction des pages du docuemnt fabriquant
|
|
18
|
+
num_page_breaks = 0
|
|
19
|
+
|
|
20
|
+
state = 0
|
|
21
|
+
|
|
22
|
+
for elt_idx, elt in enumerate(doc_tmp.element.body):
|
|
23
|
+
print(elt.tag)
|
|
24
|
+
if state == 0:
|
|
25
|
+
if elt.tag == "{http://schemas.openxmlformats.org/wordprocessingml/2006/main}p":
|
|
26
|
+
if chk_br(elt):
|
|
27
|
+
num_page_breaks += 1
|
|
28
|
+
if num_page_breaks == 2:
|
|
29
|
+
doc_tmp.save(tmp_file)
|
|
30
|
+
state = 1
|
|
31
|
+
doc_tmp.element.body.remove(elt)
|
|
32
|
+
elif state == 1:
|
|
33
|
+
if elt.tag == "{http://schemas.openxmlformats.org/wordprocessingml/2006/main}p":
|
|
34
|
+
if chk_br(elt):
|
|
35
|
+
num_page_breaks += 1
|
|
36
|
+
if num_page_breaks == 3:
|
|
37
|
+
state = 2
|
|
38
|
+
doc_tmp.element.body.remove(elt)
|
|
39
|
+
#doc_tmp.add_paragraph()
|
|
40
|
+
#elif elt.tag == "{http://schemas.openxmlformats.org/wordprocessingml/2006/main}tbl":
|
|
41
|
+
#table_copy(elt, doc_fab, doc_tmp)
|
|
42
|
+
elif state == 2:
|
|
43
|
+
if elt.tag != "{http://schemas.openxmlformats.org/wordprocessingml/2006/main}sectPr":
|
|
44
|
+
doc_tmp.element.body.remove(elt)
|
|
45
|
+
|
|
46
|
+
print("save " + tmp_file)
|
|
47
|
+
doc_tmp.save(tmp_file)
|
|
48
|
+
|
|
49
|
+
return(tmp_file)
|
|
50
|
+
|
|
51
|
+
def build_devis(doc_directory,fab_filename,startdoc,end_doc):
|
|
52
|
+
tmp_doc = build_word_file(doc_directory,fab_filename,2,1)
|
|
53
|
+
print(tmp_doc)
|
|
54
|
+
|
|
55
|
+
doc_dir = "Q:/is/chantier/1000/"
|
|
56
|
+
fab_fn = "Q:/is/chantier/1000/FABRIQUANT/1000.docx"
|
|
57
|
+
|
|
58
|
+
build_devis(doc_dir,fab_fn,"","")
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
from docx import Document
|
|
2
|
+
from docxcompose.composer import Composer
|
|
3
|
+
|
|
4
|
+
def chk_br(par):
|
|
5
|
+
for run in par.r_lst:
|
|
6
|
+
if len(run.br_lst) > 0:
|
|
7
|
+
return(True)
|
|
8
|
+
return(False)
|
|
9
|
+
|
|
10
|
+
def doc_extract(doc_directory,fab_filename,skipped_pg_br,keeped_pg_br):
|
|
11
|
+
tmp_file = doc_directory + "/schemas.docx"
|
|
12
|
+
|
|
13
|
+
doc_fab = Document(fab_filename)
|
|
14
|
+
doc_fab.save(tmp_file)
|
|
15
|
+
doc_tmp = Document(tmp_file)
|
|
16
|
+
|
|
17
|
+
# extraction des pages du docuemnt fabriquant
|
|
18
|
+
num_page_breaks = 0
|
|
19
|
+
|
|
20
|
+
state = 0
|
|
21
|
+
|
|
22
|
+
for elt_idx, elt in enumerate(doc_tmp.element.body):
|
|
23
|
+
if state == 0:
|
|
24
|
+
if elt.tag == "{http://schemas.openxmlformats.org/wordprocessingml/2006/main}p":
|
|
25
|
+
if chk_br(elt):
|
|
26
|
+
num_page_breaks += 1
|
|
27
|
+
if num_page_breaks == 2:
|
|
28
|
+
doc_tmp.save(tmp_file)
|
|
29
|
+
state = 1
|
|
30
|
+
doc_tmp.element.body.remove(elt)
|
|
31
|
+
elif state == 1:
|
|
32
|
+
if elt.tag == "{http://schemas.openxmlformats.org/wordprocessingml/2006/main}p":
|
|
33
|
+
if chk_br(elt):
|
|
34
|
+
num_page_breaks += 1
|
|
35
|
+
if num_page_breaks == 3:
|
|
36
|
+
state = 2
|
|
37
|
+
doc_tmp.element.body.remove(elt)
|
|
38
|
+
#doc_tmp.add_paragraph()
|
|
39
|
+
#elif elt.tag == "{http://schemas.openxmlformats.org/wordprocessingml/2006/main}tbl":
|
|
40
|
+
#table_copy(elt, doc_fab, doc_tmp)
|
|
41
|
+
elif state == 2:
|
|
42
|
+
if elt.tag != "{http://schemas.openxmlformats.org/wordprocessingml/2006/main}sectPr":
|
|
43
|
+
doc_tmp.element.body.remove(elt)
|
|
44
|
+
|
|
45
|
+
doc_tmp.save(tmp_file)
|
|
46
|
+
|
|
47
|
+
return(tmp_file)
|
|
48
|
+
|
|
49
|
+
def compose_doc(base_file,files_list,final_doc):
|
|
50
|
+
files_list = files_list.split(";")
|
|
51
|
+
master = Document(base_file)
|
|
52
|
+
composer = Composer(master)
|
|
53
|
+
for filename in files_list:
|
|
54
|
+
doc_temp = Document(filename)
|
|
55
|
+
composer.append(doc_temp)
|
|
56
|
+
composer.save(final_doc)
|
|
57
|
+
return
|
|
58
|
+
|
|
59
|
+
if __name__ == '__main__':
|
|
60
|
+
flist = ['//winprod/commun/is/chantier/1000/schemas.docx', '//winprod/commun/is/chantier/1000/1000_DETAIL.docx', '//winprod/commun/is/chantier/_doc_base/Formulaire_ALU_cgv.docx']
|
|
61
|
+
compose_doc('//winprod/commun/is/chantier/_doc_base/Formulaire_ALU_1-3.docx',flist,'//winprod/commun/is/chantier/1000/Devis.docx')
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
from docx import Document
|
|
2
|
+
from docx.shared import Pt
|
|
3
|
+
import csv
|
|
4
|
+
|
|
5
|
+
def hello_world():
|
|
6
|
+
print('Hello world fron in_projet')
|
|
7
|
+
|
|
8
|
+
def build_projet(txt_filename,tpl_filename,doc_filename):
|
|
9
|
+
doc_prj = Document(tpl_filename)
|
|
10
|
+
font_size = Pt(8)
|
|
11
|
+
|
|
12
|
+
ret = False
|
|
13
|
+
table = doc_prj.tables[0]
|
|
14
|
+
|
|
15
|
+
data = []
|
|
16
|
+
# Ouvrir le fichier en mode lecture
|
|
17
|
+
with open(txt_filename, 'r', encoding="utf-8") as file:
|
|
18
|
+
# Créer un lecteur CSV
|
|
19
|
+
reader = csv.reader(file, delimiter=';') # Spécifiez le délimiteur approprié si nécessaire
|
|
20
|
+
for rowidx, row in enumerate(reader):
|
|
21
|
+
if rowidx >= 11:
|
|
22
|
+
if len(row) > 0:
|
|
23
|
+
data.append(row)
|
|
24
|
+
|
|
25
|
+
current_pos = ''
|
|
26
|
+
for posidx, pos in enumerate(data[0]):
|
|
27
|
+
if pos != "X":
|
|
28
|
+
current_pos = data[1][posidx]
|
|
29
|
+
cells = table.add_row().cells
|
|
30
|
+
cells[0].text = data[1][posidx]
|
|
31
|
+
cells[0].paragraphs[0].runs[0].font.bold = True
|
|
32
|
+
text = str(data[4][posidx])
|
|
33
|
+
cells[1].text = text.replace("|","\r")
|
|
34
|
+
cells[2].text = data[3][posidx]
|
|
35
|
+
cells[3].text = data[13][posidx]
|
|
36
|
+
cells[4].text = data[5][posidx]
|
|
37
|
+
cells[5].text = data[11][posidx]
|
|
38
|
+
cells[6].text = data[12][posidx]
|
|
39
|
+
|
|
40
|
+
#else:
|
|
41
|
+
# print("desigantion = ",data[4][posidx])
|
|
42
|
+
|
|
43
|
+
for cell in table._cells:
|
|
44
|
+
for paragraph in cell.paragraphs:
|
|
45
|
+
for run in paragraph.runs:
|
|
46
|
+
run.font.size = font_size
|
|
47
|
+
run.font.name = 'Calibri'
|
|
48
|
+
|
|
49
|
+
doc_prj.save(doc_filename)
|
|
50
|
+
ret = True
|
|
51
|
+
return(ret)
|
|
52
|
+
|
|
53
|
+
if __name__ == '__main__':
|
|
54
|
+
arguments = sys.argv
|
|
55
|
+
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import pandas as pd
|
|
2
|
+
import sys
|
|
3
|
+
import csv
|
|
4
|
+
|
|
5
|
+
def hello_world():
|
|
6
|
+
print('Hello world fron xls_to_csv')
|
|
7
|
+
|
|
8
|
+
def parse_csv(csv_file):
|
|
9
|
+
# Ouvrir le fichier CSV en mode lecture
|
|
10
|
+
with open(csv_file, newline='') as csvfile:
|
|
11
|
+
# Créer un lecteur CSV
|
|
12
|
+
lecteur_csv = csv.reader(csvfile, delimiter=';')
|
|
13
|
+
donnees = list(lecteur_csv)
|
|
14
|
+
# Parcourir chaque ligne du fichier CSV
|
|
15
|
+
for lindex, ligne in enumerate(donnees):
|
|
16
|
+
# Parcourir chaque cellule de la ligne
|
|
17
|
+
for cindex, cellule in enumerate(ligne):
|
|
18
|
+
if len(cellule) > 0:
|
|
19
|
+
donnees[lindex][cindex] = cellule.replace('\n','|')
|
|
20
|
+
|
|
21
|
+
with open(csv_file, 'w', newline='') as fichier_sortie:
|
|
22
|
+
writer_csv = csv.writer(fichier_sortie, delimiter=';')
|
|
23
|
+
# Écrire les données modifiées dans le nouveau fichier CSV
|
|
24
|
+
writer_csv.writerows(donnees)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def convert_to_csv(xls_file,csv_file):
|
|
28
|
+
df = pd.read_excel(xls_file)
|
|
29
|
+
df.to_csv(csv_file, index=False, sep=';')
|
|
30
|
+
parse_csv(csv_file)
|
|
31
|
+
return
|
|
32
|
+
|
|
33
|
+
if __name__ == '__main__':
|
|
34
|
+
arguments = sys.argv
|
|
35
|
+
|
|
36
|
+
if len(arguments) == 3:
|
|
37
|
+
xl_filename = arguments[1].replace('\\','/') # Premier argument
|
|
38
|
+
csv_filename = arguments[2].replace('\\','/') # Deuxième argument
|
|
39
|
+
convert_to_csv(xl_filename, csv_filename)
|
|
40
|
+
else:
|
|
41
|
+
xl_filename = "Q:/is/chantier/1000/1000_DETAIL.xlsx" # Premier argument
|
|
42
|
+
csv_filename = "Q:/is/chantier/1000/1000_DETAIL.csv" # Deuxième argument
|
|
43
|
+
convert_to_csv(xl_filename, csv_filename)
|
|
44
|
+
print("Veuillez spécifier des arguments.")
|
|
45
|
+
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: inpython-package
|
|
3
|
+
Version: 1.1.5
|
|
4
|
+
Summary: # Infodata's IN-Tools U2Python Package
|
|
5
|
+
Home-page: https://bitbucket.org/infodata-dev/inpython
|
|
6
|
+
Author: infodata
|
|
7
|
+
Author-email: efv@infodata.lu
|
|
8
|
+
License: MIT
|
|
9
|
+
Requires-Python: >=3.4
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE.txt
|
|
12
|
+
Requires-Dist: msal>=1.22
|
|
13
|
+
Requires-Dist: qrcode
|
|
14
|
+
Requires-Dist: requests
|
|
15
|
+
Requires-Dist: qrcode[pil]
|
|
16
|
+
Requires-Dist: dotenv
|
|
17
|
+
Dynamic: author
|
|
18
|
+
Dynamic: author-email
|
|
19
|
+
Dynamic: description
|
|
20
|
+
Dynamic: description-content-type
|
|
21
|
+
Dynamic: home-page
|
|
22
|
+
Dynamic: license
|
|
23
|
+
Dynamic: license-file
|
|
24
|
+
Dynamic: requires-dist
|
|
25
|
+
Dynamic: requires-python
|
|
26
|
+
Dynamic: summary
|
|
27
|
+
|
|
28
|
+
# README
|
|
29
|
+
|
|
30
|
+
Ce projet **inpython-package** rassemble tous les packages et modules python exploités par Integrix .
|
|
31
|
+
|
|
32
|
+
## sub-package **inpython.ingraph**
|
|
33
|
+
|
|
34
|
+
package pour la gestion avec MS-Graph en exploitant le module 'msal' (Microsoft Authentication Library).
|
|
35
|
+
|
|
36
|
+
## How do I get set up?
|
|
37
|
+
|
|
38
|
+
* Les bases de u2Python c.f. [wiki sys/proc/install u2Python](https://wiki.infodata.lu/sys/proc/install_u2python)
|
|
39
|
+
* [U2Python par RocketSoftware](https://docs.rocketsoftware.com/bundle/UniVerse_PythonUserGuide_V1134/resource/UniVerse_PythonUserGuide_V1134.pdf)
|
|
40
|
+
* Vérifier la version de u2Python, au TCL uv
|
|
41
|
+
|
|
42
|
+
```python
|
|
43
|
+
>python
|
|
44
|
+
import sys
|
|
45
|
+
print(sys.version)
|
|
46
|
+
print(sys.executable) # -> 'C:\\U2\\UV\\BIN\\uv.exe' uvbin !!
|
|
47
|
+
print('\n'.join(sys.path)) # les path en cours
|
|
48
|
+
exit()
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Install inPackages into U2python
|
|
52
|
+
|
|
53
|
+
* `pip3 install inpython-package`
|
|
54
|
+
|
|
55
|
+
## Manage Package
|
|
56
|
+
|
|
57
|
+
* c.f. [devREADME](devREADME.md)
|
|
@@ -3,8 +3,16 @@ README.md
|
|
|
3
3
|
setup.py
|
|
4
4
|
inpython/__init__.py
|
|
5
5
|
inpython/__main__.py
|
|
6
|
+
inpython/aotools/__init__.py
|
|
7
|
+
inpython/aotools/aogeo.py
|
|
6
8
|
inpython/ingraph/__init__.py
|
|
7
9
|
inpython/ingraph/ingraph.py
|
|
10
|
+
inpython/intools/Servalux-devis.py
|
|
11
|
+
inpython/intools/__init__.py
|
|
12
|
+
inpython/intools/in_docx.py
|
|
13
|
+
inpython/intools/in_projet.py
|
|
14
|
+
inpython/intools/in_test.py
|
|
15
|
+
inpython/intools/xls_to_csv.py
|
|
8
16
|
inpython_package.egg-info/PKG-INFO
|
|
9
17
|
inpython_package.egg-info/SOURCES.txt
|
|
10
18
|
inpython_package.egg-info/dependency_links.txt
|
|
@@ -9,7 +9,7 @@ with open("README.md", "r") as fh:
|
|
|
9
9
|
|
|
10
10
|
setup(
|
|
11
11
|
name="inpython-package",
|
|
12
|
-
version="1.
|
|
12
|
+
version="1.1.5",
|
|
13
13
|
author="infodata",
|
|
14
14
|
author_email="efv@infodata.lu",
|
|
15
15
|
packages=find_packages(),
|
|
@@ -20,6 +20,10 @@ setup(
|
|
|
20
20
|
license='MIT',
|
|
21
21
|
python_requires='>=3.4',
|
|
22
22
|
install_requires=[
|
|
23
|
-
'msal >= 1.22'
|
|
23
|
+
'msal >= 1.22',
|
|
24
|
+
'qrcode',
|
|
25
|
+
'requests',
|
|
26
|
+
'qrcode[pil]',
|
|
27
|
+
'dotenv'
|
|
24
28
|
]
|
|
25
29
|
)
|
inpython-package-1.0.4/PKG-INFO
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: inpython-package
|
|
3
|
-
Version: 1.0.4
|
|
4
|
-
Summary: # Infodata's IN-Tools U2Python Package
|
|
5
|
-
Home-page: https://bitbucket.org/infodata-dev/inpython
|
|
6
|
-
Author: infodata
|
|
7
|
-
Author-email: efv@infodata.lu
|
|
8
|
-
License: MIT
|
|
9
|
-
Requires-Python: >=3.4
|
|
10
|
-
Description-Content-Type: text/markdown
|
|
11
|
-
License-File: LICENSE.txt
|
|
12
|
-
|
|
13
|
-
# README #
|
|
14
|
-
|
|
15
|
-
ce projet 'inpython-package' rassemble tous les packages et modules python exploités par Integrix .
|
|
16
|
-
|
|
17
|
-
# inpython.ingarph
|
|
18
|
-
package pour la gestion avec MS-Graph.
|
|
19
|
-
|
|
20
|
-
### How do I get set up? ###
|
|
21
|
-
|
|
22
|
-
* les bases de u2Python c.f. [wiki sys/proc/install u2ptyhon](https://wiki.infodata.lu/sys/proc/install_u2python)
|
|
23
|
-
* [U2Python par RocketSoftware](https://docs.rocketsoftware.com/bundle/UniVerse_PythonUserGuide_V1134/resource/UniVerse_PythonUserGuide_V1134.pdf)
|
|
24
|
-
* vérifier la version de u2Python, au TCL uv
|
|
25
|
-
```python
|
|
26
|
-
>python
|
|
27
|
-
import sys
|
|
28
|
-
sys.version # ->> '3.4.1 (default, Feb 18 2015, 13:36:51) \n[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)]'
|
|
29
|
-
exit()
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
### Install inPackages into U2python
|
|
33
|
-
`pip install inpython-package`
|
|
34
|
-
|
|
35
|
-
|
inpython-package-1.0.4/README.md
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
# README #
|
|
2
|
-
|
|
3
|
-
ce projet 'inpython-package' rassemble tous les packages et modules python exploités par Integrix .
|
|
4
|
-
|
|
5
|
-
# inpython.ingarph
|
|
6
|
-
package pour la gestion avec MS-Graph.
|
|
7
|
-
|
|
8
|
-
### How do I get set up? ###
|
|
9
|
-
|
|
10
|
-
* les bases de u2Python c.f. [wiki sys/proc/install u2ptyhon](https://wiki.infodata.lu/sys/proc/install_u2python)
|
|
11
|
-
* [U2Python par RocketSoftware](https://docs.rocketsoftware.com/bundle/UniVerse_PythonUserGuide_V1134/resource/UniVerse_PythonUserGuide_V1134.pdf)
|
|
12
|
-
* vérifier la version de u2Python, au TCL uv
|
|
13
|
-
```python
|
|
14
|
-
>python
|
|
15
|
-
import sys
|
|
16
|
-
sys.version # ->> '3.4.1 (default, Feb 18 2015, 13:36:51) \n[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)]'
|
|
17
|
-
exit()
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
### Install inPackages into U2python
|
|
21
|
-
`pip install inpython-package`
|
|
22
|
-
|
|
23
|
-
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
# infodata' u2python module to work with ..GRAPH... intools
|
|
2
|
-
import sys
|
|
3
|
-
import traceback
|
|
4
|
-
import json
|
|
5
|
-
import msal
|
|
6
|
-
|
|
7
|
-
def helloWorld():
|
|
8
|
-
print("hellp from inpython")
|
|
9
|
-
|
|
10
|
-
def getGraphTokenFromCertificate(path):
|
|
11
|
-
# fonctions pour générer un token Graph avec un certificat
|
|
12
|
-
# retourne un objet string json
|
|
13
|
-
# {
|
|
14
|
-
# "token_type": "Bearer",
|
|
15
|
-
# "expires_in": 3599,
|
|
16
|
-
# "ext_expires_in": 3599,
|
|
17
|
-
# "access_token": "eyJ0eXAiOiJKV1QiLCJub25jZS..."
|
|
18
|
-
# }
|
|
19
|
-
# ----------------------
|
|
20
|
-
# {
|
|
21
|
-
# "error": "invalid_client",
|
|
22
|
-
# "error_description": "AADSTS700027: The certificate with identifier used to sign the client assertion is not registered on application. [Reason - The key was not found., Thumbprint of key used by client: 'D02953830A67536051EFCB073FB05537287D3800', Please visit the Azure Portal, Graph Explorer or directly use MS Graph to see configured keys for app Id '15855fc2-ac31-4020-b32d-5dd531bd6b43'. Review the documentation at https://docs.microsoft.com/en-us/graph/deployments to determine the corresponding service endpoint and https://docs.microsoft.com/en-us/graph/api/application-get?view=graph-rest-1.0&tabs=http to build a query request URL, such as 'https://graph.microsoft.com/beta/applications/15855fc2-ac31-4020-b32d-5dd531bd6b43'].\r\nTrace ID: c239abbb-de7c-4092-8f1a-6a13382c5500\r\nCorrelation ID: 48f14b85-0366-451d-b576-e78bb526ade9\r\nTimestamp: 2023-07-17 10:33:11Z",
|
|
23
|
-
# "error_codes": [
|
|
24
|
-
# 700027
|
|
25
|
-
# ],
|
|
26
|
-
# "timestamp": "2023-07-17 10:33:11Z",
|
|
27
|
-
# "trace_id": "c239abbb-de7c-4092-8f1a-6a13382c5500",
|
|
28
|
-
# "correlation_id": "48f14b85-0366-451d-b576-e78bb526ade9",
|
|
29
|
-
# "error_uri": "https://login.microsoftonline.com/error?code=700027"
|
|
30
|
-
# }
|
|
31
|
-
# -----------------------------------------------------------------------------------------------------------
|
|
32
|
-
# c.f.
|
|
33
|
-
# https://github.com/Azure-Samples/ms-identity-python-daemon/tree/master/2-Call-MsGraph-WithCertificate
|
|
34
|
-
|
|
35
|
-
# load config file .json
|
|
36
|
-
# {
|
|
37
|
-
# "authority": "https://login.microsoftonline.com/infodata.lu",
|
|
38
|
-
# "tenant_id": "e2a26e34-3...",
|
|
39
|
-
# "client_id": "15855fc2-...",
|
|
40
|
-
# "scope": [ "https://graph.microsoft.com/.default" ],
|
|
41
|
-
# "thumbprint": "9615472D8...",
|
|
42
|
-
# "private_key_file": "...//9615472D8...//9615472D8....privatekey"
|
|
43
|
-
# }
|
|
44
|
-
|
|
45
|
-
try:
|
|
46
|
-
f = open(path)
|
|
47
|
-
config = json.load(f)
|
|
48
|
-
except: # catch *all* exceptions
|
|
49
|
-
result = {"errorCode" : "1",
|
|
50
|
-
"errorFrom" : "json.load({0})".format(path),
|
|
51
|
-
"error" : "{0}".format(traceback.format_exc())
|
|
52
|
-
}
|
|
53
|
-
f.close()
|
|
54
|
-
return json.dumps(result)
|
|
55
|
-
|
|
56
|
-
# try to connect
|
|
57
|
-
try:
|
|
58
|
-
app = msal.ConfidentialClientApplication(
|
|
59
|
-
config["client_id"],
|
|
60
|
-
authority=config["authority"],
|
|
61
|
-
client_credential={"thumbprint": config["thumbprint"],
|
|
62
|
-
"private_key": open(config['private_key_file']).read()}, )
|
|
63
|
-
except:
|
|
64
|
-
result = {"errorCode" : "2",
|
|
65
|
-
"errorFrom" : "msal.ConfidentialClientApplication(authority={authority}, client_credentials=thumbprint={thumbprint}, privatekey={privatekey})".format(authority=config["authority"], thumbprint=config["thumbprint"], privatekey=config['private_key_file']),
|
|
66
|
-
"error" : "{0}".format(traceback.format_exc())
|
|
67
|
-
}
|
|
68
|
-
f.close()
|
|
69
|
-
return json.dumps(result)
|
|
70
|
-
|
|
71
|
-
# try to get a token
|
|
72
|
-
result = None
|
|
73
|
-
try:
|
|
74
|
-
result = app.acquire_token_for_client(scopes=config["scope"])
|
|
75
|
-
except:
|
|
76
|
-
result = {"errorCode" : "3",
|
|
77
|
-
"errorFrom" : "app.acquire_token_for_client {scopes}=".format(scopes=config["scope"]) ,
|
|
78
|
-
"error" : "{0}".format(traceback.format_exc())
|
|
79
|
-
}
|
|
80
|
-
f.close()
|
|
81
|
-
return json.dumps(result)
|
|
82
|
-
|
|
83
|
-
return json.dumps(result)
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
def getGraphTokenFromCertificate2(path):
|
|
88
|
-
# fonctions pour générer un token Graph avec un certificat
|
|
89
|
-
# retourne un objet string json
|
|
90
|
-
# {
|
|
91
|
-
# "token_type": "Bearer",
|
|
92
|
-
# "expires_in": 3599,
|
|
93
|
-
# "ext_expires_in": 3599,
|
|
94
|
-
# "access_token": "eyJ0eXAiOiJKV1QiLCJub25jZS..."
|
|
95
|
-
# }
|
|
96
|
-
# ----------------------
|
|
97
|
-
# {
|
|
98
|
-
# "error": "invalid_client",
|
|
99
|
-
# "error_description": "AADSTS700027: The certificate with identifier used to sign the client assertion is not registered on application. [Reason - The key was not found., Thumbprint of key used by client: 'D02953830A67536051EFCB073FB05537287D3800', Please visit the Azure Portal, Graph Explorer or directly use MS Graph to see configured keys for app Id '15855fc2-ac31-4020-b32d-5dd531bd6b43'. Review the documentation at https://docs.microsoft.com/en-us/graph/deployments to determine the corresponding service endpoint and https://docs.microsoft.com/en-us/graph/api/application-get?view=graph-rest-1.0&tabs=http to build a query request URL, such as 'https://graph.microsoft.com/beta/applications/15855fc2-ac31-4020-b32d-5dd531bd6b43'].\r\nTrace ID: c239abbb-de7c-4092-8f1a-6a13382c5500\r\nCorrelation ID: 48f14b85-0366-451d-b576-e78bb526ade9\r\nTimestamp: 2023-07-17 10:33:11Z",
|
|
100
|
-
# "error_codes": [
|
|
101
|
-
# 700027
|
|
102
|
-
# ],
|
|
103
|
-
# "timestamp": "2023-07-17 10:33:11Z",
|
|
104
|
-
# "trace_id": "c239abbb-de7c-4092-8f1a-6a13382c5500",
|
|
105
|
-
# "correlation_id": "48f14b85-0366-451d-b576-e78bb526ade9",
|
|
106
|
-
# "error_uri": "https://login.microsoftonline.com/error?code=700027"
|
|
107
|
-
# }
|
|
108
|
-
# -----------------------------------------------------------------------------------------------------------
|
|
109
|
-
# c.f.
|
|
110
|
-
# https://github.com/Azure-Samples/ms-identity-python-daemon/tree/master/2-Call-MsGraph-WithCertificate
|
|
111
|
-
|
|
112
|
-
# load config file .json
|
|
113
|
-
# {
|
|
114
|
-
# "authority": "https://login.microsoftonline.com/infodata.lu",
|
|
115
|
-
# "tenant_id": "e2a26e34-3...",
|
|
116
|
-
# "client_id": "15855fc2-...",
|
|
117
|
-
# "scope": [ "https://graph.microsoft.com/.default" ],
|
|
118
|
-
# "thumbprint": "9615472D8...",
|
|
119
|
-
# "private_key_file": "...//9615472D8...//9615472D8....privatekey"
|
|
120
|
-
# }
|
|
121
|
-
|
|
122
|
-
f = open(path)
|
|
123
|
-
config = json.load(f)
|
|
124
|
-
app = msal.ConfidentialClientApplication(
|
|
125
|
-
config["client_id"],
|
|
126
|
-
authority=config["authority"],
|
|
127
|
-
client_credential={"thumbprint": config["thumbprint"],
|
|
128
|
-
"private_key": open(config['private_key_file']).read()}, )
|
|
129
|
-
result = app.acquire_token_for_client(scopes=config["scope"])
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: inpython-package
|
|
3
|
-
Version: 1.0.4
|
|
4
|
-
Summary: # Infodata's IN-Tools U2Python Package
|
|
5
|
-
Home-page: https://bitbucket.org/infodata-dev/inpython
|
|
6
|
-
Author: infodata
|
|
7
|
-
Author-email: efv@infodata.lu
|
|
8
|
-
License: MIT
|
|
9
|
-
Requires-Python: >=3.4
|
|
10
|
-
Description-Content-Type: text/markdown
|
|
11
|
-
License-File: LICENSE.txt
|
|
12
|
-
|
|
13
|
-
# README #
|
|
14
|
-
|
|
15
|
-
ce projet 'inpython-package' rassemble tous les packages et modules python exploités par Integrix .
|
|
16
|
-
|
|
17
|
-
# inpython.ingarph
|
|
18
|
-
package pour la gestion avec MS-Graph.
|
|
19
|
-
|
|
20
|
-
### How do I get set up? ###
|
|
21
|
-
|
|
22
|
-
* les bases de u2Python c.f. [wiki sys/proc/install u2ptyhon](https://wiki.infodata.lu/sys/proc/install_u2python)
|
|
23
|
-
* [U2Python par RocketSoftware](https://docs.rocketsoftware.com/bundle/UniVerse_PythonUserGuide_V1134/resource/UniVerse_PythonUserGuide_V1134.pdf)
|
|
24
|
-
* vérifier la version de u2Python, au TCL uv
|
|
25
|
-
```python
|
|
26
|
-
>python
|
|
27
|
-
import sys
|
|
28
|
-
sys.version # ->> '3.4.1 (default, Feb 18 2015, 13:36:51) \n[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)]'
|
|
29
|
-
exit()
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
### Install inPackages into U2python
|
|
33
|
-
`pip install inpython-package`
|
|
34
|
-
|
|
35
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
msal>=1.22
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{inpython-package-1.0.4 → inpython_package-1.1.5}/inpython_package.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|