<commit_before>#=========================================================================
# EventQueue.py
#=========================================================================

from cffi import FFI
ffi = FFI()

# Header file

ffi.cdef("""
  typedef  void (*FuncPtr)( void );
  void     enq  ( FuncPtr func_ptr );
  FuncPtr  deq  ( void     );
  int      len  ( void     );
""")

# Open the dynamic shared library

try:
  cpp_queue = ffi.dlopen( 'libEventQueue.so' )
except OSError as e:
  raise OSError( "{}\n\n{}\n{}\n\n{}\n".format( e,
                 "You probably didn't build the C components!",
                 "Try running the following command first:",
                 "    make -f ../new_pymtl/Make_cffi" )
               )

def cpp_callback( func ):
  return ffi.callback( 'FuncPtr', func )
<commit_msg>[new_pymtl] fix dlopen call bug on brg-06<commit_after>#=========================================================================
# EventQueue.py
#=========================================================================

from cffi import FFI
ffi = FFI()

# Header file

ffi.cdef("""
  typedef  void (*FuncPtr)( void );
  void     enq  ( FuncPtr func_ptr );
  FuncPtr  deq  ( void     );
  int      len  ( void     );
""")

# Open the dynamic shared library

try:
  cpp_queue = ffi.dlopen( './libEventQueue.so' )
except OSError as e:
  raise OSError( "{}\n\n{}\n{}\n\n{}\n".format( e,
                 "You probably didn't build the C components!",
                 "Try running the following command first:",
                 "    make -f ../new_pymtl/Make_cffi" )
               )

def cpp_callback( func ):
  return ffi.callback( 'FuncPtr', func )

{'fraction_non_alphanumeric': 0.2876794258373206, 'fraction_numerical': 0.0011961722488038277, 'mean_word_length': 2.8371559633027523, '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': '7114229', 'n_tokens_mistral': 530, 'n_tokens_neox': 493, 'n_words': 136}