Skip to content
This repository was archived by the owner on Mar 18, 2019. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion coreapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from coreapi import codecs, history, transports


__version__ = '1.26.0'
__version__ = '1.27.0'
__all__ = [
'Array', 'Document', 'Link', 'Object', 'Error', 'Field',
'ParseError', 'NotAcceptable', 'TransportError', 'ErrorMessage',
Expand Down
14 changes: 6 additions & 8 deletions coreapi/commandline.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ def get_codecs():
headers_path = None
bookmarks_path = None

codecs = get_codecs()
codec_keys = [key for key in codecs.keys() if key not in ('json', 'text')]
codec_lookup = get_codecs()
codec_keys = [key for key in codec_lookup.keys() if key not in ('json', 'text')]


def setup_paths():
Expand Down Expand Up @@ -200,10 +200,10 @@ def client(ctx, version):
@click.option('--format', default=None, type=click.Choice(codec_keys))
def get(url, debug, format):
if format:
decoder = codecs[format]
decoder = codec_lookup[format]
decoders = [decoder]
else:
decoders = list(get_codecs().values())
decoders = [codec_lookup[key] for key in codec_keys]
client = get_client(decoders=decoders, debug=debug)
history = get_history()
try:
Expand All @@ -224,7 +224,7 @@ def get(url, debug, format):
def load(input_file, format):
input_bytes = input_file.read()
input_file.close()
decoder = codecs[format]
decoder = codec_lookup[format]

history = get_history()
doc = decoder.load(input_bytes)
Expand Down Expand Up @@ -692,10 +692,8 @@ def codecs():

@click.command(help="List the installed codecs.")
def codecs_show():
codecs = get_codecs()

click.echo(click.style('Codecs', bold=True))
for name, codec in codecs.items():
for name, codec in codec_lookup.items():
click.echo('%s "%s"' % (name, codec.media_type))


Expand Down