Skip to content

Instantly share code, notes, and snippets.

async def _on_message(message : Message):
print(f'[received message] {message}')
print((message.arbitration_id, binascii.hexlify(message.data)))
if message.arbitration_id == 0x0241 and binascii.hexlify(message.data) == b'0008021a90':
print(f'FOUND MESSAGE! {message}')
found_message.set_result((True, binascii.hexlify(message.data)))
async with pcan.listen_message(_on_message):
print('Listening for messages!')
print('Sending obd_driver')
@munro
munro / example.py
Last active December 10, 2015 03:27 — forked from djmunro/foo.py
print_grid(
columns=('Function', 'Occurences', 'Sender'),
values=[(x['function'], 1337, x['sender']) for x in messages if 'function' in x]
)
@munro
munro / parser.py
Last active December 9, 2015 02:35 — forked from djmunro/parser.py
import re
import sys
import json
import itertools
from collections import Counter
from collections import defaultdict
SPLIT_MESSAGES = re.compile(r'\n.?\w{3} \w+ +\d+ \d+:\d+:\d+ \d+[\r\s]*\n')
MATCH_SIGNAL = re.compile(r'signal sender=(?P<sender>.*) -> dest=(?P<dest>.*) serial=(?P<serial>.*) path=(?P<path>.*) interface=(?P<interface>.*) member=(?P<member>.*)\n\s+string (?P<function>.*)\n\s+string (?P<params>.*)')
MATCH_METHOD_CALL = re.compile(r'method call sender=(?P<sender>.*) -> dest=(?P<dest>.*) serial=(?P<serial>.*) path=(?P<path>.*) interface=(?P<interface>.*) member=(?P<member>.*)\n\s+string (?P<function>.*)\n\s+string (?P<params>.*)')
fetchDependencies: (version, value) ->
promises = []
for x in version.dependencies
promise = @searchTerm(x.name).then (data) =>
d = _.first(data)
dep_search = _.last(d.versions)
if dep_search.scripts.length > 0
el = document.createElement("script")
el.setAttribute("data-require", value.name + "@*")
el.setAttribute("data-semver", version.semver)