Skip to content

Commit ff1c337

Browse files
committed
Remove cm prefix (ebroecker#236)
1 parent d11c0d3 commit ff1c337

File tree

4 files changed

+9
-13
lines changed

4 files changed

+9
-13
lines changed

src/canmatrix/formats/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import StringIO
1414

1515
logger = logging.getLogger(__name__)
16-
moduleList = ["arxml", "cmcsv", "dbc", "dbf", "cmjson",
16+
moduleList = ["arxml", "csv", "dbc", "dbf", "json",
1717
"kcd", "fibex", "sym", "xls", "xlsx", "yaml", "scapy"]
1818
loadedFormats = []
1919
supportedFormats = {} # type: typing.MutableMapping[str, typing.MutableSequence[str]]

src/canmatrix/formats/cmcsv.py src/canmatrix/formats/csv.py

-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@
3636
logger = logging.getLogger(__name__)
3737
CsvDataType = typing.Union[str, int]
3838

39-
extension = 'csv'
40-
4139

4240
class CsvRow:
4341
def __init__(self): # type: () -> None

src/canmatrix/formats/cmjson.py src/canmatrix/formats/json.py

-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@
3333

3434
import canmatrix
3535

36-
extension = 'json'
37-
3836

3937
def dump(db, f, **options):
4038
# type: (canmatrix.CanMatrix, typing.BinaryIO, **str) -> None

src/canmatrix/tests/test_cmjson.py src/canmatrix/tests/test_json.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def test_export_with_jsonall(default_matrix):
3333
"""Check the jsonAll doesn't raise and export some additional field."""
3434
matrix = default_matrix
3535
out_file = io.BytesIO()
36-
canmatrix.formats.dump(matrix, out_file, "cmjson", jsonAll=True)
36+
canmatrix.formats.dump(matrix, out_file, "json", jsonAll=True)
3737
data = out_file.getvalue().decode("utf-8")
3838
assert "my_value1" in data
3939
assert "my_value2" in data
@@ -42,7 +42,7 @@ def test_export_with_jsonall(default_matrix):
4242
def test_export_additional_frame_info(default_matrix):
4343
matrix = default_matrix
4444
out_file = io.BytesIO()
45-
canmatrix.formats.dump(matrix, out_file, "cmjson", additionalFrameAttributes="my_attribute1")
45+
canmatrix.formats.dump(matrix, out_file, "json", additionalFrameAttributes="my_attribute1")
4646
data = out_file.getvalue().decode("utf-8")
4747
assert "my_value1" in data
4848

@@ -57,7 +57,7 @@ def test_export_long_signal_names():
5757
frame.add_signal(signal)
5858

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

6363
assert data['messages'][0]['signals'][0]['name'] == long_signal_name
@@ -70,7 +70,7 @@ def test_export_min_max():
7070
frame.add_signal(signal)
7171
matrix.add_frame(frame)
7272
out_file = io.BytesIO()
73-
canmatrix.formats.dump(matrix, out_file, "cmjson", jsonAll=True)
73+
canmatrix.formats.dump(matrix, out_file, "json", jsonAll=True)
7474
data = json.loads(out_file.getvalue().decode("utf-8"))
7575
assert(data['messages'][0]['signals'][0]['min'] == '-5')
7676
assert(data['messages'][0]['signals'][0]['max'] == '42')
@@ -106,7 +106,7 @@ def test_import_min_max():
106106
}
107107
]
108108
}"""
109-
matrix = canmatrix.formats.loads_flat(json_input, "cmjson", jsonAll=True)
109+
matrix = canmatrix.formats.loads_flat(json_input, "json", jsonAll=True)
110110
assert matrix.frames[0].signals[0].min == -5
111111
assert matrix.frames[0].signals[0].max == 42
112112

@@ -140,7 +140,7 @@ def test_import_native():
140140
}
141141
]
142142
}"""
143-
matrix = canmatrix.formats.loads_flat(json_input, "cmjson", jsonAll=True)
143+
matrix = canmatrix.formats.loads_flat(json_input, "json", jsonAll=True)
144144
assert matrix.frames[0].signals[0].min == -4.2
145145
assert matrix.frames[0].signals[0].max == 42
146146
assert matrix.frames[0].signals[0].factor == 0.123
@@ -153,7 +153,7 @@ def test_export_native():
153153
frame.add_signal(signal)
154154
matrix.add_frame(frame)
155155
out_file = io.BytesIO()
156-
canmatrix.formats.dump(matrix, out_file, "cmjson", jsonNativeTypes=True)
156+
canmatrix.formats.dump(matrix, out_file, "json", jsonNativeTypes=True)
157157
data = json.loads(out_file.getvalue().decode("utf-8"))
158158
assert (data['messages'][0]['signals'][0]['factor'] == 0.123)
159159
assert (data['messages'][0]['signals'][0]['offset'] == 1)
@@ -165,7 +165,7 @@ def test_export_all_native():
165165
frame.add_signal(signal)
166166
matrix.add_frame(frame)
167167
out_file = io.BytesIO()
168-
canmatrix.formats.dump(matrix, out_file, "cmjson", jsonAll=True, jsonNativeTypes=True)
168+
canmatrix.formats.dump(matrix, out_file, "json", jsonAll=True, jsonNativeTypes=True)
169169
data = json.loads(out_file.getvalue().decode("utf-8"))
170170
assert (data['messages'][0]['signals'][0]['min'] == -4.2)
171171
assert (data['messages'][0]['signals'][0]['max'] == 42)

0 commit comments

Comments
 (0)