-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds JSON/CBOR support and an Io-type option #243
Changes from 5 commits
e9914bc
8bcd385
87e7f65
ed55973
3c99a29
2cbbdd8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from enum import Enum | ||
|
||
|
||
class Command(Enum): | ||
"""Enumeration of the Command.""" | ||
READ = 'read' | ||
WRITE = 'write' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,39 @@ | ||
from enum import Enum | ||
|
||
|
||
def format_is_ion(format_option): | ||
return (format_option == Format.ION_BINARY.value) or (format_option == Format.ION_TEXT.value) | ||
|
||
|
||
def format_is_json(format_option): | ||
return (format_option == Format.JSON.value) or (format_option == Format.SIMPLEJSON.value) \ | ||
or (format_option == Format.UJSON.value) or (format_option == Format.RAPIDJSON.value) or \ | ||
(format_option == Format.ORJSON.value) | ||
|
||
|
||
def format_is_cbor(format_option): | ||
return (format_option == Format.CBOR.value) or (format_option == Format.CBOR2.value) | ||
|
||
|
||
def format_is_binary(format_option): | ||
return format_is_cbor(format_option) or (format_option == Format.ION_BINARY.value) \ | ||
or (format_option == Format.ORJSON.value) | ||
|
||
|
||
def rewrite_file_to_format(file, format_option): | ||
return file | ||
|
||
|
||
class Format(Enum): | ||
"""Enumeration of the formats.""" | ||
ION_TEXT = 'ion_text' | ||
ION_BINARY = 'ion_binary' | ||
JSON = 'json' | ||
SIMPLEJSON = 'simplejson' | ||
UJSON = 'ujson' | ||
RAPIDJSON = 'rapidjson' | ||
ORJSON = 'orjson' | ||
CBOR = 'cbor' | ||
CBOR2 = 'cbor2' | ||
DEFAULT = 'ion_binary' | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from enum import Enum | ||
|
||
|
||
class Io_type(Enum): | ||
"""Enumeration of the IO types.""" | ||
FILE = 'file' | ||
BUFFER = 'buffer' | ||
DEFAULT = 'file' |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changed. |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
sthis is a test file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The file format convert logic will go in here.