replbase 0.0.43__tar.gz → 0.0.45__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.
- {replbase-0.0.43 → replbase-0.0.45}/PKG-INFO +1 -1
- {replbase-0.0.43 → replbase-0.0.45}/pyproject.toml +1 -1
- {replbase-0.0.43 → replbase-0.0.45}/replbase/repl_base.py +19 -0
- {replbase-0.0.43 → replbase-0.0.45}/LICENSE +0 -0
- {replbase-0.0.43 → replbase-0.0.45}/README.md +0 -0
- {replbase-0.0.43 → replbase-0.0.45}/replbase/__init__.py +0 -0
- {replbase-0.0.43 → replbase-0.0.45}/replbase/cmd_meta.py +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
|
|
|
4
4
|
|
|
5
5
|
[tool.poetry]
|
|
6
6
|
name = "replbase"
|
|
7
|
-
version = "0.0.
|
|
7
|
+
version = "0.0.45"
|
|
8
8
|
description = "\"Combination of other REPL tools into a reusable class that generates a REPL\""
|
|
9
9
|
authors = [ "Joseph Bochinski <stirgejr@gmail.com>",]
|
|
10
10
|
license = "MIT"
|
|
@@ -26,6 +26,7 @@ import stat
|
|
|
26
26
|
import time
|
|
27
27
|
|
|
28
28
|
from dataclasses import dataclass, field
|
|
29
|
+
from enum import Enum, EnumType
|
|
29
30
|
from typing import Any, Callable, Literal, get_type_hints
|
|
30
31
|
|
|
31
32
|
from prompt_toolkit import PromptSession
|
|
@@ -370,6 +371,24 @@ class ReplBase:
|
|
|
370
371
|
key = keys[choice - 1]
|
|
371
372
|
return choices[key]
|
|
372
373
|
|
|
374
|
+
def get_enum_val(self, prompt: str, enum_cls: EnumType) -> Enum:
|
|
375
|
+
"""Prompt the user to select an enum value
|
|
376
|
+
|
|
377
|
+
Args:
|
|
378
|
+
prompt (str): Prompt to display
|
|
379
|
+
enum_cls (EnumType): Enum class to select from
|
|
380
|
+
|
|
381
|
+
Returns:
|
|
382
|
+
Enum: Selected enum value
|
|
383
|
+
"""
|
|
384
|
+
|
|
385
|
+
options = dict(enum_cls.__members__)
|
|
386
|
+
|
|
387
|
+
if len(options) == 1:
|
|
388
|
+
return list(options.values())[0]
|
|
389
|
+
else:
|
|
390
|
+
return self.input_choice_dict(prompt, options)
|
|
391
|
+
|
|
373
392
|
def debug(self, *args) -> None:
|
|
374
393
|
"""Print only if debug_enabled == True"""
|
|
375
394
|
if self.debug_enabled:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|