<commit_before>#!/usr/local/bin/python
# -*- coding: utf-8 -*-
'''test_cpymatplotlib
'''

import sys, os

import cpymatplotlib
import numpy as np
import pylab

import ctypes
from ctypes import cast, POINTER, py_object, c_int

# tdll = ctypes.cdll
tdll = ctypes.windll
dllname = 'cpymatplotlib.pyd'
dllm = tdll.LoadLibrary(dllname)
testVoid = dllm.testVoid
testExport = dllm.testExport
testVoid_cdll = ctypes.cdll.LoadLibrary(dllname).testVoid # BAD
testExport_cdll = ctypes.cdll.LoadLibrary(dllname).testExport # BAD

testPyObject = cpymatplotlib.testPyObject # or 'from cpymatplotlib import *'

class TestA(object):
  def __init__(self, a, b, c):
    self.a = a
    self.b = b
    self.c = c

def main():
  print 'in'

  print 'result0: ', testVoid()
  print 'result2: ', testExport(3, 4)
  print 'result0: ', testVoid_cdll() # OK but wrong way
  # print 'result2: ', testExport_cdll(3, 4) # BAD
  ## ValueError: Procedure called with not enough arguments (8 bytes missing)
  ##             or wrong calling convention

  help(cpymatplotlib)

  p = testPyObject(511, 255.0, 'teststring')
  print 'resultPO: ', p

  o = TestA(456, 123, 'enroute')
  p = testPyObject(i=511, d=255.0, s='teststring', a=o)
  print 'resultPO: ', p

  print 'out'

  x = np.arange(0, 2 * np.pi, 0.1)
  y = cpymatplotlib.cos_func_np(x)
  pylab.plot(x, y)
  pylab.show()

if __name__ == '__main__':
  main()
<commit_msg>remove cdll part from src/test_cpymatplotlib.py<commit_after>#!/usr/local/bin/python
# -*- coding: utf-8 -*-
'''test_cpymatplotlib
'''

import sys, os

import cpymatplotlib
import numpy as np
import pylab

import ctypes
from ctypes import cast, POINTER, py_object, c_int

# tdll = ctypes.cdll
tdll = ctypes.windll
dllname = 'cpymatplotlib.pyd'
dllm = tdll.LoadLibrary(dllname)
testVoid = dllm.testVoid
testExport = dllm.testExport

testPyObject = cpymatplotlib.testPyObject # or 'from cpymatplotlib import *'

class TestA(object):
  def __init__(self, a, b, c):
    self.a = a
    self.b = b
    self.c = c

def main():
  print 'in'

  print 'result0: ', testVoid()
  print 'result2: ', testExport(3, 4)

  help(cpymatplotlib)

  p = testPyObject(511, 255.0, 'teststring')
  print 'resultPO: ', p

  o = TestA(456, 123, 'enroute')
  p = testPyObject(i=511, d=255.0, s='teststring', a=o)
  print 'resultPO: ', p

  print 'out'

  x = np.arange(0, 2 * np.pi, 0.1)
  y = cpymatplotlib.cos_func_np(x)
  pylab.plot(x, y)
  pylab.show()

if __name__ == '__main__':
  main()

{'fraction_non_alphanumeric': 0.13839285714285715, 'fraction_numerical': 0.02556818181818182, 'mean_word_length': 3.8715415019762847, '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': '2456076', 'n_tokens_mistral': 1033, 'n_tokens_neox': 990, 'n_words': 240}