Skip to content

Commit

Permalink
scripts: Make scripts silent
Browse files Browse the repository at this point in the history
  • Loading branch information
leoetlino committed Jun 29, 2018
1 parent 1f37bb3 commit 0fb00d0
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 5 deletions.
1 change: 0 additions & 1 deletion byml_to_yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ with file:
elif '!!' in args.yml:
sys.stderr.write('error: cannot use !! (for input filename) when reading from stdin\n')
sys.exit(1)
sys.stderr.write('writing to %s\n' % args.yml)
output = sys.stdout if args.yml == '-' else open(args.yml, 'w')
with output:
yaml.dump(root, output, Dumper=dumper, allow_unicode=True)
4 changes: 2 additions & 2 deletions yaz0_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

def compress(data: bytes) -> bytes:
return subprocess.run([_tool_name, "comp", "-", "-d-", "-C10"], input=data, stdout=subprocess.PIPE,
check=True).stdout
stderr=subprocess.PIPE, check=True).stdout

def decompress(data: bytes) -> bytes:
return subprocess.run([_tool_name, "de", "-", "-d-"], input=data, stdout=subprocess.PIPE,
check=True).stdout
stderr=subprocess.PIPE, check=True).stdout
2 changes: 0 additions & 2 deletions yml_to_byml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,8 @@ with file:
if args.byml != '-':
extension = os.path.splitext(args.byml)[1]
if extension.startswith('.s'):
sys.stderr.write('compressing sbyml\n')
buf = io.BytesIO(yaz0_util.compress(buf.read()))

sys.stderr.write('writing to %s\n' % args.byml)
output = sys.stdout.buffer if args.byml == '-' else open(args.byml, 'wb')
with output:
shutil.copyfileobj(buf, output)

0 comments on commit 0fb00d0

Please sign in to comment.