DE-Lib 0.0.20__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.
- DE_Lib/Cloud/__init__.py +0 -0
- DE_Lib/DataBase/Azure.py +44 -0
- DE_Lib/DataBase/Cache.py +74 -0
- DE_Lib/DataBase/Firebird.py +45 -0
- DE_Lib/DataBase/Informix.py +37 -0
- DE_Lib/DataBase/Metadata.py +62 -0
- DE_Lib/DataBase/MsSql.py +39 -0
- DE_Lib/DataBase/MySql.py +42 -0
- DE_Lib/DataBase/Oracle.py +111 -0
- DE_Lib/DataBase/Postgres.py +39 -0
- DE_Lib/DataBase/RedShift.py +42 -0
- DE_Lib/DataBase/SQCipher.py +42 -0
- DE_Lib/DataBase/SQLite.py +48 -0
- DE_Lib/DataBase/__init__.py +0 -0
- DE_Lib/Files/Avro.py +23 -0
- DE_Lib/Files/Csv.py +64 -0
- DE_Lib/Files/JSon.py +64 -0
- DE_Lib/Files/Parquet.py +31 -0
- DE_Lib/Files/Txt.py +64 -0
- DE_Lib/Files/Xlsx.py +55 -0
- DE_Lib/Files/__init__.py +0 -0
- DE_Lib/Log/DE_LogEventos.py +533 -0
- DE_Lib/Log/Level.py +77 -0
- DE_Lib/Log/Log.py +470 -0
- DE_Lib/Log/__init__.py +0 -0
- DE_Lib/Utils/Cipher/Aes.py +65 -0
- DE_Lib/Utils/Cipher/Argon.py +37 -0
- DE_Lib/Utils/Cipher/Base64.py +48 -0
- DE_Lib/Utils/Cipher/Cipher.py +300 -0
- DE_Lib/Utils/Cipher/Fernet.py +81 -0
- DE_Lib/Utils/Cipher/Gcm.py +78 -0
- DE_Lib/Utils/Cipher/Pbkdf2.py +43 -0
- DE_Lib/Utils/Cipher/Rsa.py +140 -0
- DE_Lib/Utils/Cipher/__init__.py +0 -0
- DE_Lib/Utils/Colors.py +203 -0
- DE_Lib/Utils/DateUtils.py +215 -0
- DE_Lib/Utils/Generic.py +249 -0
- DE_Lib/Utils/SQL.py +34 -0
- DE_Lib/Utils/System.py +50 -0
- DE_Lib/Utils/WebHook.py +18 -0
- DE_Lib/Utils/__init__.py +0 -0
- DE_Lib/__init__.py +0 -0
- de_lib-0.0.20.dist-info/LICENCE +21 -0
- de_lib-0.0.20.dist-info/METADATA +68 -0
- de_lib-0.0.20.dist-info/RECORD +47 -0
- de_lib-0.0.20.dist-info/WHEEL +5 -0
- de_lib-0.0.20.dist-info/top_level.txt +1 -0
DE_Lib/Files/Csv.py
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
import pandas as pd
|
2
|
+
import csv
|
3
|
+
|
4
|
+
|
5
|
+
class CSV:
|
6
|
+
def __init__(self):
|
7
|
+
...
|
8
|
+
|
9
|
+
def ExportDataFrame(self,
|
10
|
+
df: pd.DataFrame,
|
11
|
+
file_name: str,
|
12
|
+
file_sufix: str = "",
|
13
|
+
file_path: str = "",
|
14
|
+
sep: str = "\t",
|
15
|
+
na_rep: str = "",
|
16
|
+
float_format: str = None,
|
17
|
+
columns: list = None,
|
18
|
+
header: bool = True,
|
19
|
+
index: bool = True,
|
20
|
+
index_label: str = None,
|
21
|
+
mode: str = 'w',
|
22
|
+
encoding: str = None,
|
23
|
+
compression: str = "infer",
|
24
|
+
quoting: int = csv.QUOTE_ALL,
|
25
|
+
quotechar: str = "\"",
|
26
|
+
line_terminator: str = None,
|
27
|
+
chunksize: object = None,
|
28
|
+
date_format: str = "%Y-%m-%d %H:%M:%S",
|
29
|
+
doublequote: bool = True,
|
30
|
+
escapechar: str = None,
|
31
|
+
decimal: str = ".",
|
32
|
+
errors: str = "strict",
|
33
|
+
storage_options: str = None
|
34
|
+
):
|
35
|
+
msg, result = None, None
|
36
|
+
try:
|
37
|
+
df.to_csv(path_or_buf=file_name,
|
38
|
+
sep=sep,
|
39
|
+
na_rep=na_rep,
|
40
|
+
float_format=float_format,
|
41
|
+
columns=columns,
|
42
|
+
header=header,
|
43
|
+
index=index,
|
44
|
+
index_label=index_label,
|
45
|
+
mode=mode,
|
46
|
+
encoding=encoding,
|
47
|
+
compression=compression,
|
48
|
+
quoting=quoting,
|
49
|
+
quotechar=quotechar,
|
50
|
+
#line_terminator=line_terminator,
|
51
|
+
chunksize=chunksize,
|
52
|
+
date_format=date_format,
|
53
|
+
doublequote=doublequote,
|
54
|
+
escapechar=escapechar,
|
55
|
+
decimal=decimal,
|
56
|
+
errors=errors,
|
57
|
+
storage_options=storage_options
|
58
|
+
)
|
59
|
+
except Exception as error:
|
60
|
+
msg = error
|
61
|
+
result = msg
|
62
|
+
finally:
|
63
|
+
return result
|
64
|
+
|
DE_Lib/Files/JSon.py
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
import pandas as pd
|
2
|
+
import json
|
3
|
+
|
4
|
+
|
5
|
+
class JSON:
|
6
|
+
def __init__(self):
|
7
|
+
...
|
8
|
+
|
9
|
+
def ExportDataFrame(self,
|
10
|
+
df: pd.DataFrame,
|
11
|
+
file_name: str,
|
12
|
+
file_sufix: str = None,
|
13
|
+
file_path: str = "",
|
14
|
+
orient: str = "records",
|
15
|
+
date_format: str =None,
|
16
|
+
double_precision: int = 10,
|
17
|
+
force_ascii: bool = True,
|
18
|
+
date_unit: str = 'ms',
|
19
|
+
default_handler=None,
|
20
|
+
lines: bool = False,
|
21
|
+
compression: str = "infer",
|
22
|
+
index: bool = True,
|
23
|
+
indent: int = 2,
|
24
|
+
storage_options=None,
|
25
|
+
payload: dict = None
|
26
|
+
):
|
27
|
+
msg, result = None, None
|
28
|
+
try:
|
29
|
+
if payload is not None:
|
30
|
+
with open(file_name, "w", encoding='utf-8') as outfile:
|
31
|
+
json.dump(payload, outfile, indent=2)
|
32
|
+
else:
|
33
|
+
if orient not in ["split", "table"]:
|
34
|
+
df.to_json(path_or_buf=file_name,
|
35
|
+
orient=orient,
|
36
|
+
date_format=date_format,
|
37
|
+
double_precision=10,
|
38
|
+
force_ascii=force_ascii,
|
39
|
+
date_unit=date_unit,
|
40
|
+
default_handler=default_handler,
|
41
|
+
lines=lines,
|
42
|
+
compression=compression,
|
43
|
+
# index=index,
|
44
|
+
indent=indent,
|
45
|
+
storage_options=storage_options)
|
46
|
+
else:
|
47
|
+
df.to_json(path_or_buf=file_name,
|
48
|
+
orient=orient,
|
49
|
+
date_format=date_format,
|
50
|
+
double_precision=10,
|
51
|
+
force_ascii=force_ascii,
|
52
|
+
date_unit=date_unit,
|
53
|
+
default_handler=default_handler,
|
54
|
+
lines=lines,
|
55
|
+
compression=compression,
|
56
|
+
index=index,
|
57
|
+
indent=indent,
|
58
|
+
storage_options=storage_options)
|
59
|
+
except Exception as error:
|
60
|
+
msg = error
|
61
|
+
result = msg
|
62
|
+
finally:
|
63
|
+
return result
|
64
|
+
|
DE_Lib/Files/Parquet.py
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
import pandas as pd
|
2
|
+
|
3
|
+
|
4
|
+
class PARQUET:
|
5
|
+
def __init__(self):
|
6
|
+
...
|
7
|
+
|
8
|
+
def ExportDataFrame(self,
|
9
|
+
df: pd.DataFrame,
|
10
|
+
file_name: str,
|
11
|
+
file_sufix: str = None,
|
12
|
+
file_path: str = "",
|
13
|
+
engine: str = "pyarrow",
|
14
|
+
compression: str = "snappy",
|
15
|
+
index: bool = False,
|
16
|
+
partition_cols=None
|
17
|
+
):
|
18
|
+
msg, result = None, None
|
19
|
+
try:
|
20
|
+
df.to_parquet(path=file_name
|
21
|
+
,engine=engine
|
22
|
+
,compression=compression
|
23
|
+
,index=index
|
24
|
+
,partition_cols=partition_cols
|
25
|
+
)
|
26
|
+
except Exception as error:
|
27
|
+
msg = error
|
28
|
+
result = msg
|
29
|
+
finally:
|
30
|
+
return result
|
31
|
+
|
DE_Lib/Files/Txt.py
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
import pandas as pd
|
2
|
+
import csv
|
3
|
+
|
4
|
+
|
5
|
+
class TXT:
|
6
|
+
def __init__(self):
|
7
|
+
...
|
8
|
+
|
9
|
+
def ExportDataFrame(self,
|
10
|
+
df: pd.DataFrame,
|
11
|
+
file_name: str,
|
12
|
+
file_sufix: str = "",
|
13
|
+
file_path: str = "",
|
14
|
+
sep: str = "\t",
|
15
|
+
na_rep: str = "",
|
16
|
+
float_format: str = None,
|
17
|
+
columns: list = None,
|
18
|
+
header: bool = True,
|
19
|
+
index: bool = True,
|
20
|
+
index_label: str = None,
|
21
|
+
mode: str = 'w',
|
22
|
+
encoding: str = None,
|
23
|
+
compression: str = "infer",
|
24
|
+
quoting: int = csv.QUOTE_ALL,
|
25
|
+
quotechar: str = "\"",
|
26
|
+
line_terminator: str = None,
|
27
|
+
chunksize: object = None,
|
28
|
+
date_format: str = "%Y-%m-%d %H:%M:%S",
|
29
|
+
doublequote: bool = True,
|
30
|
+
escapechar: str = None,
|
31
|
+
decimal: str = ".",
|
32
|
+
errors: str = "strict",
|
33
|
+
storage_options: str = None
|
34
|
+
):
|
35
|
+
msg, result = None, None
|
36
|
+
try:
|
37
|
+
df.to_csv(path_or_buf=file_name,
|
38
|
+
sep=sep,
|
39
|
+
na_rep=na_rep,
|
40
|
+
float_format=float_format,
|
41
|
+
columns=columns,
|
42
|
+
header=header,
|
43
|
+
index=index,
|
44
|
+
index_label=index_label,
|
45
|
+
mode=mode,
|
46
|
+
encoding=encoding,
|
47
|
+
compression=compression,
|
48
|
+
quoting=quoting,
|
49
|
+
quotechar=quotechar,
|
50
|
+
#line_terminator=line_terminator,
|
51
|
+
chunksize=chunksize,
|
52
|
+
date_format=date_format,
|
53
|
+
doublequote=doublequote,
|
54
|
+
escapechar=escapechar,
|
55
|
+
decimal=decimal,
|
56
|
+
errors=errors,
|
57
|
+
storage_options=storage_options
|
58
|
+
)
|
59
|
+
except Exception as error:
|
60
|
+
msg = error
|
61
|
+
result = msg
|
62
|
+
finally:
|
63
|
+
return result
|
64
|
+
|
DE_Lib/Files/Xlsx.py
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
import pandas as pd
|
2
|
+
|
3
|
+
|
4
|
+
class XLSX:
|
5
|
+
def __init__(self):
|
6
|
+
...
|
7
|
+
|
8
|
+
def ExportDataFrame(self
|
9
|
+
,df: pd.DataFrame
|
10
|
+
,file_name: str
|
11
|
+
,file_path: str = ""
|
12
|
+
,file_sufix: str = ""
|
13
|
+
,sheet_name: str = 'Dados'
|
14
|
+
,na_rep: str = ""
|
15
|
+
,float_format: str = None
|
16
|
+
,columns: list = None
|
17
|
+
,header: bool = True
|
18
|
+
,index: bool = True
|
19
|
+
,index_label=None
|
20
|
+
,startrow: int = 0
|
21
|
+
,startcol: int = 0
|
22
|
+
,engine: str = "xlsxwriter"
|
23
|
+
,merge_cells=True
|
24
|
+
,encoding: str = None
|
25
|
+
,inf_rep: str = "inf"
|
26
|
+
,verbose: bool = True
|
27
|
+
,freeze_panes=None
|
28
|
+
,storage_options=None
|
29
|
+
):
|
30
|
+
msg, result = None, None
|
31
|
+
try:
|
32
|
+
df.to_excel(file_or_path=file_name
|
33
|
+
,sheet_name=sheet_name
|
34
|
+
,na_rep=na_rep
|
35
|
+
,float_format=float_format
|
36
|
+
,columns=columns
|
37
|
+
,header=header
|
38
|
+
,index=index
|
39
|
+
,index_label=index_label
|
40
|
+
,startrow=startrow
|
41
|
+
,startcol=startcol
|
42
|
+
,engine=engine
|
43
|
+
,merge_cells=merge_cells
|
44
|
+
,encoding=encoding
|
45
|
+
,inf_rep=inf_rep
|
46
|
+
,verbose=verbose
|
47
|
+
,freeze_panes=freeze_panes
|
48
|
+
,storage_options=storage_options
|
49
|
+
)
|
50
|
+
except Exception as error:
|
51
|
+
msg = error
|
52
|
+
result = msg
|
53
|
+
finally:
|
54
|
+
return result
|
55
|
+
|
DE_Lib/Files/__init__.py
ADDED
File without changes
|