Forráskód Böngészése

added raw_input_with_default

Fabian Peter Hammerle 9 éve
commit
5e4b447912
5 módosított fájl, 54 hozzáadás és 0 törlés
  1. 21 0
      LICENSE.txt
  2. 2 0
      README.md
  3. 12 0
      ioex/__init__.py
  4. 2 0
      setup.cfg
  5. 17 0
      setup.py

+ 21 - 0
LICENSE.txt

@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2015 Fabian Peter Hammerle
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.

+ 2 - 0
README.md

@@ -0,0 +1,2 @@
+# ioex
+an extension for python's build-in input / output interface

+ 12 - 0
ioex/__init__.py

@@ -0,0 +1,12 @@
+import os
+
+def raw_input_with_default(prompt, default):
+    import readline
+    def pre_input_hook():
+        readline.insert_text(default)
+        readline.redisplay()
+    readline.set_pre_input_hook(pre_input_hook)
+    try:
+        return raw_input(prompt)
+    finally:
+        readline.set_pre_input_hook(None)

+ 2 - 0
setup.cfg

@@ -0,0 +1,2 @@
+[metadata]
+description-file = README.md

+ 17 - 0
setup.py

@@ -0,0 +1,17 @@
+from setuptools import setup
+
+import glob
+
+setup(
+    name = 'ioex',
+    packages = ['ioex'],
+    version = '0.1',
+    description = 'extension for python\'s build-in input / output interface',
+    author = 'Fabian Peter Hammerle',
+    author_email = 'fabian.hammerle@gmail.com',
+    url = 'https://github.com/fphammerle/ioex',
+    download_url = 'https://github.com/fphammerle/ioex/tarball/0.1',
+    keywords = [],
+    classifiers = [],
+    tests_require = ['pytest']
+    )