-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds JSON/CBOR comparison and an Io-type option (#243)
- Loading branch information
Showing
9 changed files
with
618 additions
and
175 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,36 @@ | ||
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) | ||
|
||
|
||
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) | ||
|
||
|
||
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' | ||
CBOR = 'cbor' | ||
CBOR2 = 'cbor2' | ||
DEFAULT = 'ion_binary' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
sthis is a test file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"name":"John", "age":30, "car":null} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters