Skip to content

Commit

Permalink
Merge branch 'dev' of github.com:ywangd/stash into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
bennr01 committed Mar 13, 2020
2 parents b64da1f + 7d9744e commit 2ef593b
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 13 deletions.
4 changes: 2 additions & 2 deletions bin/crypt.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ def aes_decrypt(self, key, chunksize=64 * 1024):
args = ap.parse_args()
crypt = Crypt(args.infile, args.outfile)
if args.decrypt:
crypt.aes_decrypt(args.key)
crypt.aes_decrypt(args.key.encode())
else:
nk = crypt.aes_encrypt(args.key)
if args.key is None:
print("Key: %s" % nk)
print("Key: %s" % nk.decode())
32 changes: 24 additions & 8 deletions bin/curl.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,12 @@
import argparse
import requests

try:
from urllib.parse import urlparse
except ImportError:
from urlparse import urlparse
from six.moves.urllib.parse import urlparse

try:
import clipboard
except ImportError:
pass
clipboard = None


def main(args):
Expand All @@ -27,6 +24,12 @@ def main(args):
action='store_true',
help='write output to a local file named like the remote file we get'
)
ap.add_argument(
'-L',
'--location',
action='store_true',
help='follow redirects to other web pages (if the URL has a 3XX response code)'
)
ap.add_argument(
'-X',
'--request-method',
Expand All @@ -49,11 +52,24 @@ def main(args):
headers[name.strip()] = value.strip()

if ns.request_method == 'GET':
r = requests.get(url, headers=headers)
r = requests.get(
url,
headers=headers,
allow_redirects=ns.location
)
elif ns.request_method == 'POST':
r = requests.post(url, data=ns.data, headers=headers)
r = requests.post(
url,
data=ns.data,
headers=headers,
allow_redirects=ns.location
)
elif ns.request_method == 'HEAD':
r = requests.head(url, headers=headers)
r = requests.head(
url,
headers=headers,
allow_redirects=ns.location
)
else:
print('unknown request method: {}'.format(ns.request_method))
return
Expand Down
9 changes: 6 additions & 3 deletions bin/pip.py
Original file line number Diff line number Diff line change
Expand Up @@ -783,9 +783,12 @@ def _get_cooked_ast(filename):
"""
# with codecs.open(filename, mode="r", encoding="UTF-8") as ins:
# s = ins.read()
with open(filename, "r") as ins:
s = ins.read()
tree = ast.parse(s, filename=filename, mode='exec')
with open(filename, "rb") as ins:
tree = ast.parse(
ins.read(),
filename=filename,
mode='exec'
)
ArchiveFileInstaller.SetupTransformer().visit(tree)
return tree

Expand Down

0 comments on commit 2ef593b

Please sign in to comment.