csc-cia-stne 0.0.22__py3-none-any.whl → 0.0.24__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.
csc_cia_stne/__init__.py CHANGED
@@ -9,13 +9,13 @@ if os.getenv('ambiente_de_execucao') is not None and os.getenv('ambiente_de_exec
9
9
  else:
10
10
  from .logger_rich import logger
11
11
  from .karavela import Karavela
12
- from .utilitarios import Util
12
+ #from .utilitarios.classes import Util
13
13
  from .servicenow import ServiceNow
14
14
  from .stne_admin import StoneAdmin
15
15
  from .bc_sta import BC_STA
16
16
  from .bc_correios import BC_Correios
17
17
  from .gcp_bigquery import BigQuery
18
- from .functions import titulo
18
+ #from .utilitarios.functions import titulo
19
19
  # Define os itens disponíveis para importação
20
20
  __all__ = [
21
21
  "titulo",
@@ -0,0 +1 @@
1
+ from .functions import titulo, recriar_pasta, b64encode, b64decode, convert_bquery_result_to_json
@@ -0,0 +1,4 @@
1
+ from .func_titulo import titulo
2
+ from .func_recriar_pastas import recriar_pasta
3
+ from .func_b64 import b64decode, b64encode
4
+ from .func_converters import convert_bquery_result_to_json
@@ -0,0 +1,50 @@
1
+ import base64
2
+
3
+ def b64decode(b64_string:str=None)->str:
4
+ """Faz o decode de uma string em base64
5
+
6
+ Args:
7
+ b64_string (str): string em base64
8
+
9
+ Returns:
10
+ str: string em texto
11
+ """
12
+
13
+ if b64_string is None or b64_string == "":
14
+
15
+ raise ValueError("Uma string Base64 precisa ser informada com o parâmetro 'b64_string'")
16
+
17
+ try:
18
+
19
+ b64_decode_output = base64.b64decode(b64_string).decode('utf-8')
20
+
21
+ except:
22
+
23
+ raise TypeError("A string informada não está em formato Base64")
24
+
25
+ return b64_decode_output
26
+
27
+ def b64encode(string_to_convert:str=None)->base64:
28
+ """Faz o encode de uma string para base64
29
+
30
+ Args:
31
+ string_to_convert (str): string para converter em base64
32
+
33
+ Returns:
34
+ base64: string convertida para base64
35
+ """
36
+
37
+ if string_to_convert is None or string_to_convert == "":
38
+
39
+ raise ValueError("Uma string precisa ser informada com o parâmetro 'string_to_convert'")
40
+
41
+ try:
42
+
43
+ b64_encode_output = base64.b64encode(str(string_to_convert).encode('utf-8')).decode('utf-8')
44
+
45
+ except Exception as e:
46
+
47
+ raise TypeError(f"Erro ao converter a string para Base64: {e}")
48
+
49
+ return b64_encode_output
50
+
@@ -0,0 +1,18 @@
1
+ def convert_bquery_result_to_json(query_result:list)->list:
2
+ """Converte o resultado de uma query do BigQuery em uma lista de dicionários JSON
3
+
4
+ Args:
5
+ query_result (list): resultado da query do BigQuery (query.result)
6
+
7
+ Returns:
8
+ list: lista de dicionários JSON
9
+ """
10
+
11
+ try:
12
+
13
+ #return [dict(row) for row in query_result]
14
+ return [dict(row._asdict()) for row in query_result]
15
+
16
+ except Exception as e:
17
+
18
+ raise e
@@ -0,0 +1,19 @@
1
+ import os
2
+ import shutil
3
+
4
+ def recriar_pasta(caminho_pasta):
5
+
6
+ try:
7
+
8
+ # Se a pasta já existir, remove-a
9
+ if os.path.exists(caminho_pasta) and os.path.isdir(caminho_pasta):
10
+ shutil.rmtree(caminho_pasta) # Deleta a pasta e todo o conteúdo
11
+
12
+ # Cria a pasta novamente
13
+ os.makedirs(caminho_pasta)
14
+ return True, None
15
+
16
+ except Exception as e:
17
+
18
+ return False, e
19
+
@@ -1,12 +1,8 @@
1
1
  import os
2
- import base64
3
- import mimetypes
4
2
  from datetime import datetime
5
3
  from rich import print
6
4
  from rich.panel import Panel
7
5
  from rich.style import Style
8
- import json
9
- import shutil
10
6
  import logging
11
7
  from pydantic import BaseModel
12
8
  from pydantic import ValidationError, field_validator
@@ -108,19 +104,3 @@ def titulo(project_name:str,project_version:str,project_dev_name:str,project_dev
108
104
  logging.info(f"\tDesenvolvedor: {project_dev_name} <{project_dev_mail}>")
109
105
  logging.info("-")
110
106
 
111
- def recriar_pasta(caminho_pasta):
112
-
113
- try:
114
-
115
- # Se a pasta já existir, remove-a
116
- if os.path.exists(caminho_pasta) and os.path.isdir(caminho_pasta):
117
- shutil.rmtree(caminho_pasta) # Deleta a pasta e todo o conteúdo
118
-
119
- # Cria a pasta novamente
120
- os.makedirs(caminho_pasta)
121
- return True, None
122
-
123
- except Exception as e:
124
-
125
- return False, e
126
-
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: csc_cia_stne
3
- Version: 0.0.22
3
+ Version: 0.0.24
4
4
  Summary: Biblioteca do time CSC-CIA utilizada no desenvolvimento de RPAs
5
5
  License: MIT
6
6
  Keywords: karavela,csc,cia,stone,rpa
@@ -0,0 +1,20 @@
1
+ csc_cia_stne/__init__.py,sha256=IYTgLq8P6SHJM4EcpD91iex1u_hAuQ3-thxIlLQ91R4,720
2
+ csc_cia_stne/bc_correios.py,sha256=ANsvLyL7wdkM0MvjjBHB2Ih4eyTcyWgt5IqiK0Rv89E,23014
3
+ csc_cia_stne/bc_sta.py,sha256=I9N29wjTbd4ZmoM2yIW-xp3X-dMENZdSb0JhapfCegY,10988
4
+ csc_cia_stne/gcp_bigquery.py,sha256=f8UEQgr6XyFacYX0bRq4UDmWoH-0XqZF8fA2LsLTtAU,5654
5
+ csc_cia_stne/karavela.py,sha256=Q7MbQXXz_jtrLHM7QeenbSzcro07EpoFk4lKglivJ_I,3564
6
+ csc_cia_stne/logger_json.py,sha256=2G0rm0lyCtHn4o2v7fzn4wMylb0A_nbxiQatnrSZxHs,1212
7
+ csc_cia_stne/logger_rich.py,sha256=yW1py7k5yY5Fay5I_eY-ulMGGSmFGGhUl3Q4U8aczbo,3392
8
+ csc_cia_stne/servicenow.py,sha256=vSsNSANFyCZtDu2O7YmdoCbr-_bO1sgMWnOI29mFBOA,23311
9
+ csc_cia_stne/stne_admin.py,sha256=G5ozXt18VjKL2BHtROQk4GnfVY1xM14RXSQ-rra_D54,15487
10
+ csc_cia_stne/utilitarios/__init__.py,sha256=4YFhzxu8F_CDHU6iaNhpzz9mfX-8wfJc1XEQInJzwJ4,98
11
+ csc_cia_stne/utilitarios/functions/__init__.py,sha256=X0PmuSe0RilU824Lvlg-DtO0qDb_D_VfL4ftzR93d40,180
12
+ csc_cia_stne/utilitarios/functions/func_b64.py,sha256=XGU34BIQQXWXBS0yM2B4A2wDlcrMl1unIJXjq4lpLnk,1254
13
+ csc_cia_stne/utilitarios/functions/func_converters.py,sha256=EY1zvlBaRX7G1MceVSiRXwwKDQDZwUO9iECBL0fe5iU,481
14
+ csc_cia_stne/utilitarios/functions/func_recriar_pastas.py,sha256=2_unoSoQHxShcMw_0XIL9F0NgiF1QCKsX4drvg0fEb8,415
15
+ csc_cia_stne/utilitarios/functions/func_titulo.py,sha256=EhUtsiIOAz4yERNZl3EOHjiFLjj4rK3pr_KB0DxwGIA,3943
16
+ csc_cia_stne-0.0.24.dist-info/LICENCE,sha256=LPGMtgKki2C3KEZP7hDhA1HBrlq5JCHkIeStUCLEMx4,1073
17
+ csc_cia_stne-0.0.24.dist-info/METADATA,sha256=CiP_W79ifwOjgz6TbKMAVpl0BczsgxhdNQqpZN2G-ow,1003
18
+ csc_cia_stne-0.0.24.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
19
+ csc_cia_stne-0.0.24.dist-info/top_level.txt,sha256=ldo7GVv3tQx5KJvwBzdZzzQmjPys2NDVVn1rv0BOF2Q,13
20
+ csc_cia_stne-0.0.24.dist-info/RECORD,,
@@ -1,72 +0,0 @@
1
- import base64
2
-
3
- class Util():
4
- """Classe Util com necessidades de rotina
5
- """
6
-
7
- def b64decode(self,b64_string:str=None)->str:
8
- """Faz o decode de uma string em base64
9
-
10
- Args:
11
- b64_string (str): string em base64
12
-
13
- Returns:
14
- str: string em texto
15
- """
16
-
17
- if b64_string is None or b64_string == "":
18
-
19
- raise ValueError("Uma string Base64 precisa ser informada com o parâmetro 'b64_string'")
20
-
21
- try:
22
-
23
- b64_decode_output = base64.b64decode(b64_string).decode('utf-8')
24
-
25
- except:
26
-
27
- raise TypeError("A string informada não está em formato Base64")
28
-
29
- return b64_decode_output
30
-
31
- def b64encode(self,string_to_convert:str=None)->base64:
32
- """Faz o encode de uma string para base64
33
-
34
- Args:
35
- string_to_convert (str): string para converter em base64
36
-
37
- Returns:
38
- base64: string convertida para base64
39
- """
40
-
41
- if string_to_convert is None or string_to_convert == "":
42
-
43
- raise ValueError("Uma string precisa ser informada com o parâmetro 'string_to_convert'")
44
-
45
- try:
46
-
47
- b64_encode_output = base64.b64encode(str(string_to_convert).encode('utf-8')).decode('utf-8')
48
-
49
- except Exception as e:
50
-
51
- raise TypeError(f"Erro ao converter a string para Base64: {e}")
52
-
53
- return b64_encode_output
54
-
55
- def convert_query_result_to_json(self,query_result:list)->list:
56
- """Converte o resultado de uma query do BigQuery em uma lista de dicionários JSON
57
-
58
- Args:
59
- query_result (list): resultado da query do BigQuery (query.result)
60
-
61
- Returns:
62
- list: lista de dicionários JSON
63
- """
64
-
65
- try:
66
-
67
- #return [dict(row) for row in query_result]
68
- return [dict(row._asdict()) for row in query_result]
69
-
70
- except Exception as e:
71
-
72
- raise e
@@ -1,16 +0,0 @@
1
- csc_cia_stne/__init__.py,sha256=oQ-AaSyDfqYGSWoKZiSVP6kyNsJBOb6qbi9bZxxYEZg,698
2
- csc_cia_stne/bc_correios.py,sha256=ANsvLyL7wdkM0MvjjBHB2Ih4eyTcyWgt5IqiK0Rv89E,23014
3
- csc_cia_stne/bc_sta.py,sha256=I9N29wjTbd4ZmoM2yIW-xp3X-dMENZdSb0JhapfCegY,10988
4
- csc_cia_stne/functions.py,sha256=O3UCK2IX2uDC_cqgwr2Z0mLolVBOZaxLfd661tJxHLQ,4390
5
- csc_cia_stne/gcp_bigquery.py,sha256=f8UEQgr6XyFacYX0bRq4UDmWoH-0XqZF8fA2LsLTtAU,5654
6
- csc_cia_stne/karavela.py,sha256=Q7MbQXXz_jtrLHM7QeenbSzcro07EpoFk4lKglivJ_I,3564
7
- csc_cia_stne/logger_json.py,sha256=2G0rm0lyCtHn4o2v7fzn4wMylb0A_nbxiQatnrSZxHs,1212
8
- csc_cia_stne/logger_rich.py,sha256=yW1py7k5yY5Fay5I_eY-ulMGGSmFGGhUl3Q4U8aczbo,3392
9
- csc_cia_stne/servicenow.py,sha256=vSsNSANFyCZtDu2O7YmdoCbr-_bO1sgMWnOI29mFBOA,23311
10
- csc_cia_stne/stne_admin.py,sha256=G5ozXt18VjKL2BHtROQk4GnfVY1xM14RXSQ-rra_D54,15487
11
- csc_cia_stne/utilitarios.py,sha256=LU8YrELiRIW4UxqULjiUPYmgbEx79NGenK5QKRdSh_E,2050
12
- csc_cia_stne-0.0.22.dist-info/LICENCE,sha256=LPGMtgKki2C3KEZP7hDhA1HBrlq5JCHkIeStUCLEMx4,1073
13
- csc_cia_stne-0.0.22.dist-info/METADATA,sha256=MsKPYqBchh4NGDJHOWaEJLDRhNsPR6J_mA0euNQUfE4,1003
14
- csc_cia_stne-0.0.22.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
15
- csc_cia_stne-0.0.22.dist-info/top_level.txt,sha256=ldo7GVv3tQx5KJvwBzdZzzQmjPys2NDVVn1rv0BOF2Q,13
16
- csc_cia_stne-0.0.22.dist-info/RECORD,,