Skip to content
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

Remove cm prefix #397

Closed
wants to merge 1 commit into from
Closed
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 src/canmatrix/formats/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import StringIO

logger = logging.getLogger(__name__)
moduleList = ["arxml", "cmcsv", "dbc", "dbf", "cmjson",
moduleList = ["arxml", "csv", "dbc", "dbf", "json",
"kcd", "fibex", "sym", "xls", "xlsx", "yaml", "scapy"]
loadedFormats = []
supportedFormats = {} # type: typing.MutableMapping[str, typing.MutableSequence[str]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@
logger = logging.getLogger(__name__)
CsvDataType = typing.Union[str, int]

extension = 'csv'


class CsvRow:
def __init__(self): # type: () -> None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@

import canmatrix

extension = 'json'


def dump(db, f, **options):
# type: (canmatrix.CanMatrix, typing.BinaryIO, **str) -> None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def test_export_with_jsonall(default_matrix):
"""Check the jsonAll doesn't raise and export some additional field."""
matrix = default_matrix
out_file = io.BytesIO()
canmatrix.formats.dump(matrix, out_file, "cmjson", jsonAll=True)
canmatrix.formats.dump(matrix, out_file, "json", jsonAll=True)
data = out_file.getvalue().decode("utf-8")
assert "my_value1" in data
assert "my_value2" in data
Expand All @@ -42,7 +42,7 @@ def test_export_with_jsonall(default_matrix):
def test_export_additional_frame_info(default_matrix):
matrix = default_matrix
out_file = io.BytesIO()
canmatrix.formats.dump(matrix, out_file, "cmjson", additionalFrameAttributes="my_attribute1")
canmatrix.formats.dump(matrix, out_file, "json", additionalFrameAttributes="my_attribute1")
data = out_file.getvalue().decode("utf-8")
assert "my_value1" in data

Expand All @@ -57,7 +57,7 @@ def test_export_long_signal_names():
frame.add_signal(signal)

out_file = io.BytesIO()
canmatrix.formats.dump(matrix, out_file, "cmjson", jsonAll=True)
canmatrix.formats.dump(matrix, out_file, "json", jsonAll=True)
data = json.loads(out_file.getvalue().decode("utf-8"))

assert data['messages'][0]['signals'][0]['name'] == long_signal_name
Expand All @@ -70,7 +70,7 @@ def test_export_min_max():
frame.add_signal(signal)
matrix.add_frame(frame)
out_file = io.BytesIO()
canmatrix.formats.dump(matrix, out_file, "cmjson", jsonAll=True)
canmatrix.formats.dump(matrix, out_file, "json", jsonAll=True)
data = json.loads(out_file.getvalue().decode("utf-8"))
assert(data['messages'][0]['signals'][0]['min'] == '-5')
assert(data['messages'][0]['signals'][0]['max'] == '42')
Expand Down Expand Up @@ -106,7 +106,7 @@ def test_import_min_max():
}
]
}"""
matrix = canmatrix.formats.loads_flat(json_input, "cmjson", jsonAll=True)
matrix = canmatrix.formats.loads_flat(json_input, "json", jsonAll=True)
assert matrix.frames[0].signals[0].min == -5
assert matrix.frames[0].signals[0].max == 42

Expand Down