calificar 0.1.0__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.
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2026 Juan Carlos Lezama
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
@@ -0,0 +1,31 @@
1
+ Metadata-Version: 2.4
2
+ Name: calificar
3
+ Version: 0.1.0
4
+ Summary: Permite calificar talleres a través de Python
5
+ Author-email: Juan Carlos Lezama <jclezamap@gmail.com>
6
+ Project-URL: Homepage, https://github.com/jclezamap/calificar
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Operating System :: OS Independent
10
+ Requires-Python: >=3.8
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Requires-Dist: pandas>=1.4.0
14
+ Requires-Dist: numpy>=1.22.0
15
+ Requires-Dist: requests>=2.28.0
16
+ Dynamic: license-file
17
+ Dynamic: requires-python
18
+
19
+ # 📦 Calificar
20
+
21
+ [![PyPI version](https://img.shields.io/pypi/v/nombre-de-tu-libreria.svg)](https://pypi.org/project/nombre-de-tu-libreria/)
22
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
23
+
24
+ Una breve descripción de una frase que explique el "qué" y el "por qué" de tu librería.
25
+
26
+ ## 🚀 Instalación
27
+
28
+ Instálalo fácilmente usando pip:
29
+
30
+ ```bash
31
+ pip install calificar as cr
@@ -0,0 +1,13 @@
1
+ # 📦 Calificar
2
+
3
+ [![PyPI version](https://img.shields.io/pypi/v/nombre-de-tu-libreria.svg)](https://pypi.org/project/nombre-de-tu-libreria/)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+
6
+ Una breve descripción de una frase que explique el "qué" y el "por qué" de tu librería.
7
+
8
+ ## 🚀 Instalación
9
+
10
+ Instálalo fácilmente usando pip:
11
+
12
+ ```bash
13
+ pip install calificar as cr
@@ -0,0 +1,32 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "calificar"
7
+ version = "0.1.0"
8
+ authors = [
9
+ { name="Juan Carlos Lezama", email="jclezamap@gmail.com" },
10
+ ]
11
+ description = "Permite calificar talleres a través de Python"
12
+ readme = "README.md"
13
+ requires-python = ">=3.7"
14
+ classifiers = [
15
+ "Programming Language :: Python :: 3",
16
+ "License :: OSI Approved :: MIT License",
17
+ "Operating System :: OS Independent",
18
+ ]
19
+
20
+ dependencies = [
21
+ "pandas>=1.4.0",
22
+ "numpy>=1.22.0",
23
+ "requests>=2.28.0",
24
+ ]
25
+
26
+
27
+ [project.urls]
28
+ "Homepage" = "https://github.com/jclezamap/calificar"
29
+
30
+ [tool.setuptools.packages.find]
31
+ where = ["src"]
32
+ include = ["calificar*"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,14 @@
1
+ from setuptools import setup, find_packages
2
+
3
+ setup(
4
+ name="calificar",
5
+ version="0.1.0",
6
+ package_dir={"": "src"},
7
+ packages=find_packages(where="src"),
8
+ install_requires=[
9
+ "pandas>=1.4.0",
10
+ "numpy>=1.22.0",
11
+ "requests>=2.28.0",
12
+ ],
13
+ python_requires=">=3.8",
14
+ )
@@ -0,0 +1,18 @@
1
+ # src/calificar/__init__.py
2
+
3
+ __version__ = "0.1.0"
4
+
5
+ #Se importa los módulos que están en core
6
+ from .core import taller, evafunciones
7
+
8
+
9
+ # Lo que importa cuando colocan 'from calificar import *'
10
+ __all__ = ["taller", "evafunciones"]
11
+
12
+
13
+
14
+ import numpy as np
15
+
16
+ print(f"Iniciando Calificar v0.1.0 (Usando Numpy {np.__version__})")
17
+
18
+
@@ -0,0 +1,160 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ import requests
4
+ import numpy as np
5
+ import pandas as pd
6
+ import inspect
7
+ import hashlib
8
+
9
+
10
+
11
+ class taller:
12
+ def __init__(self, integrante, grupo, taller, cant_respuestas=1, curso='0'):
13
+ # Datos Inicialess
14
+ self.integrante = integrante
15
+ self.grupo = grupo
16
+ self.taller = taller
17
+ self.curso = curso
18
+ self.resp=np.zeros(cant_respuestas,'U256') #No Modificar
19
+
20
+ def respuestas(self, indice, valor):
21
+ try:
22
+ self.resp[indice] = valor
23
+ print(f"🔢 La respuesta {indice} se actualizó a {valor}.")
24
+
25
+ except IndexError:
26
+ print(f"❌ Error: El índice {indice} está fuera de rango.")
27
+
28
+ def _preparar_respuestas(self):
29
+
30
+ if hasattr(self.resp, 'tolist'): # Si es un array de numpy
31
+ return ';'.join(map(str, self.resp.tolist()))
32
+ elif isinstance(self.resp, list): # Si es una lista normal
33
+ return ';'.join(map(str, self.resp))
34
+ return str(self.resp)
35
+
36
+ def calificar(self):
37
+ respuestas_str = self._preparar_respuestas()
38
+ datos = {
39
+ 'Integrantes': self.integrante,
40
+ 'Grupo': self.grupo,
41
+ 'Curso': self.curso,
42
+ 'Respuestas': respuestas_str,
43
+ 'python': 1
44
+ }
45
+ try:
46
+ url = f'https://www.economiafinanciera.com.co/indexdes.php?app=excel&modulo=taller&accion=respuestas&Actividad={self.taller}'
47
+ resp = requests.post(url, data=datos)
48
+ partes = resp.text.split("|")
49
+ return print(f"🔢 Validación de Puntos: {partes[0]} \n Nota: {partes[1]} \n Mensaje: {partes[2][1:]}")
50
+ except Exception as e:
51
+ return print(f"❌ Error en calificación: {str(e)}")
52
+
53
+ def validar(self):
54
+ respuestas_str = self._preparar_respuestas()
55
+ datos = {
56
+ 'Integrantes': self.integrante,
57
+ 'Grupo': self.grupo,
58
+ 'Curso': self.curso,
59
+ 'Respuestas': respuestas_str,
60
+ 'python': 1
61
+ }
62
+ try:
63
+ url = f'https://www.economiafinanciera.com.co/indexdes.php?app=excel&modulo=taller&accion=respuestas&Actividad={self.taller}'
64
+ resp = requests.post(url, data=datos)
65
+ return resp.text.split("|")[0].split(";")
66
+ except Exception as e:
67
+ return f"❌ Error en validación: {str(e)}"
68
+
69
+
70
+ class evafunciones:
71
+ def __init__(self, url_base, num_tema):
72
+ self.url_base = url_base
73
+ self.num_tema = f"tema_{num_tema}"
74
+ self.respuestas = self._cargar_respuestas()
75
+
76
+ def _cargar_respuestas(self):
77
+ try:
78
+ r = requests.get(f"{self.url_base}/respuestas.json", timeout=10)
79
+ r.raise_for_status() # Asegura que la URL sea válida
80
+ return r.json()
81
+ except Exception as e:
82
+ print(f"❌ Error al cargar respuestas: {e}")
83
+ return None
84
+
85
+ def _generar_verificador(self, n_secreto, salt="2026i"):
86
+ # Crea el código alfanumérico que el alumno te debe entregar
87
+ hash_obj = hashlib.sha256(f"{n_secreto}{salt}{self.num_tema}".encode())
88
+ return hash_obj.hexdigest()[:8].upper()
89
+
90
+ def validar(self, nombre_funcion):
91
+ if not self.respuestas:
92
+ print("❌ No hay respuestas cargadas.")
93
+ return
94
+
95
+ # 1. Obtener datos del JSON
96
+ tema_data = self.respuestas.get(self.num_tema)
97
+ if not tema_data:
98
+ print(f"❌ No existe el {self.num_tema} en el JSON.")
99
+ return
100
+
101
+ datos_reto = tema_data.get(nombre_funcion)
102
+ if not datos_reto:
103
+ print(f"❌ El ejercicio '{nombre_funcion}' no existe para este tema.")
104
+ return
105
+
106
+ inputs_del_reto = datos_reto['inputs']
107
+ esperado_raw = datos_reto['expected']
108
+ codigo_base = datos_reto.get('codigo_oculto', '0000')
109
+
110
+ # 2. Obtener función del estudiante
111
+ frame = inspect.stack()[1]
112
+ modulo = inspect.getmodule(frame[0])
113
+ funcion_estudiante = getattr(modulo, nombre_funcion, None)
114
+
115
+ if not funcion_estudiante:
116
+ print(f"❌ No se encontró la función '{nombre_funcion}' en el código.")
117
+ return
118
+
119
+ try:
120
+ # Ejecutar la función del estudiante con los inputs del JSON
121
+ resultado_estudiante = funcion_estudiante(**inputs_del_reto)
122
+ es_correcto = False
123
+
124
+ # 3. VALIDACIÓN DE DATAFRAME TRANSFORMADO
125
+ if isinstance(resultado_estudiante, pd.DataFrame):
126
+ df_esperado = pd.DataFrame(esperado_raw)
127
+ pd.testing.assert_frame_equal(
128
+ resultado_estudiante,
129
+ df_esperado,
130
+ check_dtype=False,
131
+ check_like=True,
132
+ check_exact=False,
133
+ atol=1e-5
134
+ )
135
+ es_correcto = True
136
+
137
+ elif isinstance(resultado_estudiante, pd.Series):
138
+ serie_esperada = pd.Series(esperado_raw)
139
+ pd.testing.assert_series_equal(resultado_estudiante, serie_esperada, check_dtype=False)
140
+ es_correcto = True
141
+
142
+ else:
143
+ # Comparación para números o listas
144
+ es_correcto = np.allclose(resultado_estudiante, esperado_raw, atol=1e-5)
145
+
146
+ if es_correcto:
147
+ # 4. ÉXITO: Generar código secreto
148
+ codigo_final = self._generar_verificador(codigo_base)
149
+ print(f"✅ ¡Transformación correcta para '{nombre_funcion}'!")
150
+ print(f"🔢 TU CÓDIGO DE VALIDACIÓN: {codigo_final}")
151
+ return codigo_final
152
+
153
+ except AssertionError as e:
154
+ print(f"❌ El resultado de '{nombre_funcion}' no coincide con el esperado.")
155
+ # Limpiamos el mensaje de error de Pandas para que sea legible
156
+ detalle = str(e).split('\n')[0]
157
+ print(f"ℹ️ Detalle: {detalle}")
158
+ except Exception as e:
159
+ print(f"⚠️ Error al ejecutar tu función: {type(e).__name__}: {e}")
160
+
@@ -0,0 +1,31 @@
1
+ Metadata-Version: 2.4
2
+ Name: calificar
3
+ Version: 0.1.0
4
+ Summary: Permite calificar talleres a través de Python
5
+ Author-email: Juan Carlos Lezama <jclezamap@gmail.com>
6
+ Project-URL: Homepage, https://github.com/jclezamap/calificar
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Operating System :: OS Independent
10
+ Requires-Python: >=3.8
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Requires-Dist: pandas>=1.4.0
14
+ Requires-Dist: numpy>=1.22.0
15
+ Requires-Dist: requests>=2.28.0
16
+ Dynamic: license-file
17
+ Dynamic: requires-python
18
+
19
+ # 📦 Calificar
20
+
21
+ [![PyPI version](https://img.shields.io/pypi/v/nombre-de-tu-libreria.svg)](https://pypi.org/project/nombre-de-tu-libreria/)
22
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
23
+
24
+ Una breve descripción de una frase que explique el "qué" y el "por qué" de tu librería.
25
+
26
+ ## 🚀 Instalación
27
+
28
+ Instálalo fácilmente usando pip:
29
+
30
+ ```bash
31
+ pip install calificar as cr
@@ -0,0 +1,11 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ setup.py
5
+ src/calificar/__init__.py
6
+ src/calificar/core.py
7
+ src/calificar.egg-info/PKG-INFO
8
+ src/calificar.egg-info/SOURCES.txt
9
+ src/calificar.egg-info/dependency_links.txt
10
+ src/calificar.egg-info/requires.txt
11
+ src/calificar.egg-info/top_level.txt
@@ -0,0 +1,3 @@
1
+ pandas>=1.4.0
2
+ numpy>=1.22.0
3
+ requests>=2.28.0
@@ -0,0 +1 @@
1
+ calificar