inpython-package 1.0.8__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.0.8/inpython_package.egg-info → inpython_package-1.1.5}/PKG-INFO +15 -2
- {inpython_package-1.0.8 → inpython_package-1.1.5}/inpython/intools/Servalux-devis.py +58 -58
- {inpython_package-1.0.8 → inpython_package-1.1.5}/inpython/intools/__init__.py +6 -6
- {inpython_package-1.0.8 → inpython_package-1.1.5}/inpython/intools/in_docx.py +61 -61
- {inpython_package-1.0.8 → inpython_package-1.1.5}/inpython/intools/in_projet.py +55 -55
- {inpython_package-1.0.8 → inpython_package-1.1.5}/inpython/intools/in_test.py +3 -3
- {inpython_package-1.0.8 → inpython_package-1.1.5}/inpython/intools/xls_to_csv.py +45 -45
- {inpython_package-1.0.8 → inpython_package-1.1.5/inpython_package.egg-info}/PKG-INFO +15 -2
- inpython_package-1.1.5/inpython_package.egg-info/requires.txt +5 -0
- {inpython_package-1.0.8 → inpython_package-1.1.5}/setup.py +5 -2
- inpython_package-1.0.8/inpython_package.egg-info/requires.txt +0 -2
- {inpython_package-1.0.8 → inpython_package-1.1.5}/LICENSE.txt +0 -0
- {inpython_package-1.0.8 → inpython_package-1.1.5}/README.md +0 -0
- {inpython_package-1.0.8 → inpython_package-1.1.5}/inpython/__init__.py +0 -0
- {inpython_package-1.0.8 → inpython_package-1.1.5}/inpython/__main__.py +0 -0
- {inpython_package-1.0.8 → inpython_package-1.1.5}/inpython/aotools/__init__.py +0 -0
- {inpython_package-1.0.8 → inpython_package-1.1.5}/inpython/aotools/aogeo.py +0 -0
- {inpython_package-1.0.8 → inpython_package-1.1.5}/inpython/ingraph/__init__.py +0 -0
- {inpython_package-1.0.8 → inpython_package-1.1.5}/inpython/ingraph/ingraph.py +0 -0
- {inpython_package-1.0.8 → inpython_package-1.1.5}/inpython_package.egg-info/SOURCES.txt +0 -0
- {inpython_package-1.0.8 → inpython_package-1.1.5}/inpython_package.egg-info/dependency_links.txt +0 -0
- {inpython_package-1.0.8 → inpython_package-1.1.5}/inpython_package.egg-info/top_level.txt +0 -0
- {inpython_package-1.0.8 → inpython_package-1.1.5}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: inpython-package
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.1.5
|
|
4
4
|
Summary: # Infodata's IN-Tools U2Python Package
|
|
5
5
|
Home-page: https://bitbucket.org/infodata-dev/inpython
|
|
6
6
|
Author: infodata
|
|
@@ -11,6 +11,19 @@ Description-Content-Type: text/markdown
|
|
|
11
11
|
License-File: LICENSE.txt
|
|
12
12
|
Requires-Dist: msal>=1.22
|
|
13
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
|
|
14
27
|
|
|
15
28
|
# README
|
|
16
29
|
|
|
@@ -1,58 +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,"","")
|
|
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,"","")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# inpython.ingraph init file
|
|
2
|
-
# executed when 'from inpython.ingraph import *'
|
|
3
|
-
|
|
4
|
-
# !! update the list when new modules are added !!
|
|
5
|
-
|
|
6
|
-
__all__ = ["xls_to_csv", "in_projet", "in_docx","in_test"]
|
|
1
|
+
# inpython.ingraph init file
|
|
2
|
+
# executed when 'from inpython.ingraph import *'
|
|
3
|
+
|
|
4
|
+
# !! update the list when new modules are added !!
|
|
5
|
+
|
|
6
|
+
__all__ = ["xls_to_csv", "in_projet", "in_docx","in_test"]
|
|
@@ -1,61 +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')
|
|
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')
|
|
@@ -1,55 +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
|
-
|
|
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
|
+
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
def hello_world:
|
|
3
|
-
print("salut les aminches")
|
|
1
|
+
|
|
2
|
+
def hello_world:
|
|
3
|
+
print("salut les aminches")
|
|
4
4
|
return("ça roule ma poule!")
|
|
@@ -1,45 +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
|
-
|
|
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
|
+
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: inpython-package
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.1.5
|
|
4
4
|
Summary: # Infodata's IN-Tools U2Python Package
|
|
5
5
|
Home-page: https://bitbucket.org/infodata-dev/inpython
|
|
6
6
|
Author: infodata
|
|
@@ -11,6 +11,19 @@ Description-Content-Type: text/markdown
|
|
|
11
11
|
License-File: LICENSE.txt
|
|
12
12
|
Requires-Dist: msal>=1.22
|
|
13
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
|
|
14
27
|
|
|
15
28
|
# README
|
|
16
29
|
|
|
@@ -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(),
|
|
@@ -21,6 +21,9 @@ setup(
|
|
|
21
21
|
python_requires='>=3.4',
|
|
22
22
|
install_requires=[
|
|
23
23
|
'msal >= 1.22',
|
|
24
|
-
'qrcode'
|
|
24
|
+
'qrcode',
|
|
25
|
+
'requests',
|
|
26
|
+
'qrcode[pil]',
|
|
27
|
+
'dotenv'
|
|
25
28
|
]
|
|
26
29
|
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{inpython_package-1.0.8 → inpython_package-1.1.5}/inpython_package.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|