<commit_before>#!/usr/bin/python
#
# This is just an example. Please see the test_libhid.c file for more
# comments.
#

import sys

# allow it to run right out of the build dir
import os
libsdir = os.getcwd() + '/.libs'
if os.path.isdir(libsdir) and os.path.isfile(libsdir + '/_hid.so'):
  sys.path.insert(0, libsdir)

from hid import *

def main():
  hid_set_debug(HID_DEBUG_NONE)
  hid_set_debug_stream(sys.stderr)
  hid_set_usb_debug(0)

  ret = hid_init()
  if ret != HID_RET_SUCCESS:
    sys.stderr.write("hid_init failed with return code %d.\n" % ret)

  hid = hid_new_HIDInterface()
  matcher = HIDInterfaceMatcher()
  matcher.vendor_id = 0x046d
  matcher.product_id = 0xc051

  ret = hid_force_open(hid, 0, matcher, 3)
  if ret != HID_RET_SUCCESS:
    sys.stderr.write("hid_force_open failed with return code %d.\n" % ret)

  while 1:
    ret, bytes = hid_get_input_report(hid, (0x00010002, 0x00010030), 2)
    if ret != HID_RET_SUCCESS:
      sys.stderr.write("hid_get_input_report failed with return code %d.\n" % ret)
    else:
      for byte in bytes:
        print "%02x" % ord(byte),
      print ""
<commit_msg>stuff<commit_after>#!/usr/bin/python
#
# This is just an example. Please see the test_libhid.c file for more
# comments.
#

import sys

# allow it to run right out of the build dir
import os
libsdir = os.getcwd() + '/.libs'
if os.path.isdir(libsdir) and os.path.isfile(libsdir + '/_hid.so'):
  sys.path.insert(0, libsdir)

from hid import *

def main():
  hid_set_debug(HID_DEBUG_NONE)
  hid_set_debug_stream(sys.stderr)
  hid_set_usb_debug(0)

  ret = hid_init()
  if ret != HID_RET_SUCCESS:
    sys.stderr.write("hid_init failed with return code %d.\n" % ret)

  hid = hid_new_HIDInterface()
  matcher = HIDInterfaceMatcher()
  matcher.vendor_id = 0x046d
  matcher.product_id = 0xc00c

  ret = hid_force_open(hid, 0, matcher, 3)
  if ret != HID_RET_SUCCESS:
    sys.stderr.write("hid_force_open failed with return code %d.\n" % ret)

  #while 1:
  #  ret, bytes = hid_get_input_report(hid, (0x00010002, 0x00010030), 3)
  #  if ret != HID_RET_SUCCESS:
  #    sys.stderr.write("hid_get_input_report failed with return code %d.\n" % ret)
  #  else:
  #    for byte in bytes:
  #      print "%02x" % ord(byte),
  #    print ""
  while 1:
    ret, bytes = hid_interrupt_read(hid, 0x81, 7, 1000)
    if ret != HID_RET_SUCCESS:
      sys.stderr.write("hid_get_input_report failed with return code %d.\n" % ret)
    else:
      for byte in bytes:
        print "%02x" % ord(byte),
      print ""
	

{'fraction_non_alphanumeric': 0.12236789829161701, 'fraction_numerical': 0.03098927294398093, 'mean_word_length': 3.440917107583774, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1816534', 'n_tokens_mistral': 1027, 'n_tokens_neox': 973, 'n_words': 243}