functions.variable
1from dictionary.vars import decimal_values 2import streamlit as st 3 4 5class Variable: 6 """ 7 Classe com métodos para análises de variáveis. 8 """ 9 10 def treat_complex_string(self, value_passed: float): 11 str_value = str(value_passed) 12 str_value = str_value.replace(".", ",") 13 last_two_values = str_value[-2:] 14 15 if last_two_values in decimal_values: 16 str_value = str_value + "0" 17 18 return str_value 19 20 def create_variable(self, name, value): 21 """ 22 Cria uma nova variável. 23 """ 24 globals()[name] = value 25 26 def debug_variable(self, variable): 27 """ 28 Exibe os dados da variável. 29 """ 30 31 variable_type = type(variable).__name__ 32 33 st.info(body="Tipo: {}.".format(variable_type)) 34 st.info(body="Conteúdo: {}.".format(variable)) 35 36 if variable_type != "int" and variable_type != "float" and variable_type != "complex" and variable_type != "UploadedFile" and variable_type != "decimal.Decimal": 37 st.info(body="Tamanho: {}.".format(len(variable))) 38 39 if variable_type == "list": 40 for i in range(0, len(variable)): 41 st.info(body="Tipo: {}.".format( 42 type(variable[i]).__name__)) 43 st.info(body="Conteúdo: {}.".format(variable[i]))
class
Variable:
6class Variable: 7 """ 8 Classe com métodos para análises de variáveis. 9 """ 10 11 def treat_complex_string(self, value_passed: float): 12 str_value = str(value_passed) 13 str_value = str_value.replace(".", ",") 14 last_two_values = str_value[-2:] 15 16 if last_two_values in decimal_values: 17 str_value = str_value + "0" 18 19 return str_value 20 21 def create_variable(self, name, value): 22 """ 23 Cria uma nova variável. 24 """ 25 globals()[name] = value 26 27 def debug_variable(self, variable): 28 """ 29 Exibe os dados da variável. 30 """ 31 32 variable_type = type(variable).__name__ 33 34 st.info(body="Tipo: {}.".format(variable_type)) 35 st.info(body="Conteúdo: {}.".format(variable)) 36 37 if variable_type != "int" and variable_type != "float" and variable_type != "complex" and variable_type != "UploadedFile" and variable_type != "decimal.Decimal": 38 st.info(body="Tamanho: {}.".format(len(variable))) 39 40 if variable_type == "list": 41 for i in range(0, len(variable)): 42 st.info(body="Tipo: {}.".format( 43 type(variable[i]).__name__)) 44 st.info(body="Conteúdo: {}.".format(variable[i]))
Classe com métodos para análises de variáveis.
def
create_variable(self, name, value):
21 def create_variable(self, name, value): 22 """ 23 Cria uma nova variável. 24 """ 25 globals()[name] = value
Cria uma nova variável.
def
debug_variable(self, variable):
27 def debug_variable(self, variable): 28 """ 29 Exibe os dados da variável. 30 """ 31 32 variable_type = type(variable).__name__ 33 34 st.info(body="Tipo: {}.".format(variable_type)) 35 st.info(body="Conteúdo: {}.".format(variable)) 36 37 if variable_type != "int" and variable_type != "float" and variable_type != "complex" and variable_type != "UploadedFile" and variable_type != "decimal.Decimal": 38 st.info(body="Tamanho: {}.".format(len(variable))) 39 40 if variable_type == "list": 41 for i in range(0, len(variable)): 42 st.info(body="Tipo: {}.".format( 43 type(variable[i]).__name__)) 44 st.info(body="Conteúdo: {}.".format(variable[i]))
Exibe os dados da variável.