QueryList exception do not inherit from libtmux.exc.LibTmuxException
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 35/100
Línea de trabajo
Start with libtmux._internal.query_list.py and libtmux.exc to compare ObjectDoesNotExist with LibTmuxException, then inspect the top-level init.py and the documented exceptions reference. Done means the query exception hierarchy and public exposure match the supported API, with the intended behavior for sessions.get established.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
I was porting today a legacy piece of software (written by another co-worker, I only maintain it) that was using libtmux-0.8.5 und made an upgrade to libtmux-0.24.0 and I was getting a lot of deprecation errors because of session.find_where usage.
The code looked mostly like this:
try:
session = libtmux.Server().find_where({"session_name":session_name})
except libtmux.exc.LibTmuxException:
session = libtmux.Server().new_session(session_name=session_name)
and I changed it to
tmux_server = libtmux.server.Server()
try:
session = tmux_server.sessions.get(session_name=session_name)
except libtmux.exc.LibTmuxException:
session = tmux_server.new_session(session_name=session_name)
I realized that when sessions.get does not found a session, it raises ObjectDoesNotExist. But ObjectDoesNotExist is declared like this:
class ObjectDoesNotExist(Exception):
"""The requested object does not exist."""
The problem is that ObjectDoesNotExist is actually defined in libtmux._internal.query_list.py while the the documentation says here https://libtmux.git-pull.com/reference/exceptions.html
exception libtmux.exc.LibTmuxException Base Exception for libtmux Errors.
I don't want to start importing stuff from submodules with a leading underscore as this is mostly used by "private" modules and cannot be considered part of the public API.
I think you should either expose those exception directly in the top __init__.py and at least make ObjectDoesNotExist and ObjectDoesNotExist both inherit from libtmux.exc.LibTmuxException to keep it consistent.
Is there a reason why the the query_list implementation is the ._internal private submodule and why those exceptions do not inherit from libtmux.exc.LibTmuxException?
- Lenguaje dominante
- Python
- Estrellas
- 1.2k
- Forks
- 127
- Merge medio
- 2 h 13 min
- PR fusionados (30 d)
- 1
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de tmux-python/libtmux
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
tmux-python/libtmux#759 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
tmux-python/libtmux#745 · 2 comentarios ·
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
tmux-python/libtmux#744 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
tmux-python/libtmux#731 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
tmux-python/libtmux#654 ·
Todos los issues de tmux-python/libtmux
Issues similares
-
[Bug] reef-hermes tells me to resume with hermes --resume, which does not work from my shell Abiertoarea: harness bug status: needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Human-Agent-Society/reef#625 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 80/100
learningequality/kolibri#15351 · 2 comentarios ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
Name consistency Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
eellak/triplestore#65 · 1 comentario ·