From 1074c042185be629f98239676e3ce3a3a6df3da4 Mon Sep 17 00:00:00 2001 From: Ruslan Zhenetl Date: Thu, 19 Aug 2021 12:09:22 +0300 Subject: [PATCH 1/5] Support for a string blob as stdin --- py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/py b/py index b0b2bdd..b2c92f9 100755 --- a/py +++ b/py @@ -83,6 +83,9 @@ group.add_argument('-x', dest='lines_of_stdin', action='store_const', group.add_argument('-l', dest='list_of_stdin', action='store_const', const=True, default=False, help='treat list of stdin as l') +group.add_argument('-s', dest='string_of_stdin', action='store_const', + const=True, default=False, + help='treat stdin string as s') group.add_argument('-j', dest='json_of_stdin', action='store_const', const=True, default=False, @@ -179,6 +182,9 @@ try: elif args.json_of_stdin: j = json.load(sys.stdin) result = eval(args.expression) + elif args.string_of_stdin" + s = sys.stdin.read() + result = eval(args.expression) else: result = eval(args.expression) From 53381fd909b759597b833dfba45f4ea597c455dc Mon Sep 17 00:00:00 2001 From: Ruslan Zhenetl Date: Thu, 19 Aug 2021 12:19:15 +0300 Subject: [PATCH 2/5] Support for a string blob as stdin II --- pythonpy/__main__.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pythonpy/__main__.py b/pythonpy/__main__.py index 9125a83..39fd9e1 100755 --- a/pythonpy/__main__.py +++ b/pythonpy/__main__.py @@ -77,6 +77,9 @@ def inspect_source(obj): group.add_argument('-l', dest='list_of_stdin', action='store_const', const=True, default=False, help='treat list of stdin as l') +group.add_argument('-s', dest='string_of_stdin', action='store_const', + const=True, default=False, + help='treat stdin string as s') group.add_argument('--ji', '--json_input', dest='json_input', action='store_const', const=True, default=False, @@ -166,6 +169,9 @@ def safe_eval(text, x): elif args.list_of_stdin: l = list(stdin) result = eval(args.expression) + elif args.string_of_stdin: + s = sys.stdin.read() + result = eval(args.expression) else: result = eval(args.expression) From 57609814c6f193458b48eec1d1d6c645449360c5 Mon Sep 17 00:00:00 2001 From: Ruslan Zhenetl Date: Thu, 19 Aug 2021 12:19:39 +0300 Subject: [PATCH 3/5] Support for a string blob as stdin fix --- py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/py b/py index b2c92f9..9fb676f 100755 --- a/py +++ b/py @@ -182,7 +182,7 @@ try: elif args.json_of_stdin: j = json.load(sys.stdin) result = eval(args.expression) - elif args.string_of_stdin" + elif args.string_of_stdin: s = sys.stdin.read() result = eval(args.expression) else: From 981c46d8ad239551713b8fc3859cf0c4a47456dd Mon Sep 17 00:00:00 2001 From: Ruslan Zhenetl Date: Wed, 18 May 2022 20:31:08 +0300 Subject: [PATCH 4/5] Fix python 3.10 import problem --- pythonpy/__main__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pythonpy/__main__.py b/pythonpy/__main__.py index 39fd9e1..060f1d4 100755 --- a/pythonpy/__main__.py +++ b/pythonpy/__main__.py @@ -16,7 +16,7 @@ import argparse import json import re -from collections import Iterable +from collections.abc import Iterable try: from . import __version__ From 6fd6aebe288c5ce80aeb2fcda5280bdce3fa67a6 Mon Sep 17 00:00:00 2001 From: Ruslan Zhenetl Date: Mon, 5 Jun 2023 12:23:32 +0000 Subject: [PATCH 5/5] Update README.rst --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index be5ebce..ae23179 100644 --- a/README.rst +++ b/README.rst @@ -5,7 +5,7 @@ Installation :: - pip install pythonpy + pip install git+https://github.com/c6401/pythonpy.git ::