replbase 0.0.47__tar.gz → 0.0.49__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: replbase
3
- Version: 0.0.47
3
+ Version: 0.0.49
4
4
  Summary: "Combination of other REPL tools into a reusable class that generates a REPL"
5
5
  License: MIT
6
6
  Author: Joseph Bochinski
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
4
4
 
5
5
  [tool.poetry]
6
6
  name = "replbase"
7
- version = "0.0.47"
7
+ version = "0.0.49"
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"
@@ -371,6 +371,31 @@ class ReplBase:
371
371
  key = keys[choice - 1]
372
372
  return choices[key]
373
373
 
374
+ def input_obj_update(self, obj: dict[str, Any]) -> Any:
375
+
376
+ prop_name = self.input_choice(
377
+ "Select property to update: ", choices=list(obj.keys())
378
+ )
379
+ prop = obj[prop_name]
380
+
381
+ if not prop:
382
+ self.warn("Invalid selection")
383
+ return None
384
+
385
+ prompt = f"Enter value for {prop_name}: "
386
+ if prop is str | list[str]:
387
+ return self.input(prompt)
388
+ if prop is int | list[int]:
389
+ return self.input_int(prompt)
390
+ if prop is bool:
391
+ return self.input_bool(prompt)
392
+ if isinstance(prop, EnumType):
393
+ return self.get_enum_val(prompt, prop)
394
+ if isinstance(prop, Enum):
395
+ return self.get_enum_val(prompt, type(prop))
396
+ self.warn("Invalid property type")
397
+ return None
398
+
374
399
  def get_enum_val(self, prompt: str, enum_cls: EnumType) -> Enum:
375
400
  """Prompt the user to select an enum value
376
401
 
File without changes
File without changes