Cython: _tn93.pyx

Generated by Cython 0.25.2

Yellow lines hint at Python interaction.
Click on a line that starts with a "`+`" to see the C code that Cython generated for it.

Raw output: _tn93.c

     01: # Define constants

     02:

    +03: RESOLVE = 0

      if (PyDict_SetItem(__pyx_d, __pyx_n_s_RESOLVE, __pyx_int_0) < 0) __PYX_ERR(0, 3, __pyx_L1_error)

    +04: AVERAGE = 1

      if (PyDict_SetItem(__pyx_d, __pyx_n_s_AVERAGE, __pyx_int_1) < 0) __PYX_ERR(0, 4, __pyx_L1_error)

    +05: SKIP = 2

      if (PyDict_SetItem(__pyx_d, __pyx_n_s_SKIP, __pyx_int_2) < 0) __PYX_ERR(0, 5, __pyx_L1_error)

    +06: GAPMM = 3

      if (PyDict_SetItem(__pyx_d, __pyx_n_s_GAPMM, __pyx_int_3) < 0) __PYX_ERR(0, 6, __pyx_L1_error)

     07:

     08: cdef extern from "./tn93.h":

     09:   double _tn93 "tn93" (const char * s1, const char * s2,  const unsigned long L, const unsigned int matchMode, const unsigned long min_overlap)

     10:

    +11: def tn93(s1,s2,L,matchMode,min_overlap):

    /* Python wrapper */
    static PyObject *__pyx_pw_6BioExt_4tn93_5_tn93_1tn93(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
    static PyMethodDef __pyx_mdef_6BioExt_4tn93_5_tn93_1tn93 = {"tn93", (PyCFunction)__pyx_pw_6BioExt_4tn93_5_tn93_1tn93, METH_VARARGS|METH_KEYWORDS, 0};
    static PyObject *__pyx_pw_6BioExt_4tn93_5_tn93_1tn93(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
      PyObject *__pyx_v_s1 = 0;
      PyObject *__pyx_v_s2 = 0;
      PyObject *__pyx_v_L = 0;
      PyObject *__pyx_v_matchMode = 0;
      PyObject *__pyx_v_min_overlap = 0;
      PyObject *__pyx_r = 0;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("tn93 (wrapper)", 0);
      {
        static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_s1,&__pyx_n_s_s2,&__pyx_n_s_L,&__pyx_n_s_matchMode,&__pyx_n_s_min_overlap,0};
        PyObject* values[5] = {0,0,0,0,0};
        if (unlikely(__pyx_kwds)) {
          Py_ssize_t kw_args;
          const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
          switch (pos_args) {
            case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
            case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
            case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
            case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
            case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
            case  0: break;
            default: goto __pyx_L5_argtuple_error;
          }
          kw_args = PyDict_Size(__pyx_kwds);
          switch (pos_args) {
            case  0:
            if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_s1)) != 0)) kw_args--;
            else goto __pyx_L5_argtuple_error;
            case  1:
            if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_s2)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("tn93", 1, 5, 5, 1); __PYX_ERR(0, 11, __pyx_L3_error)
            }
            case  2:
            if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_L)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("tn93", 1, 5, 5, 2); __PYX_ERR(0, 11, __pyx_L3_error)
            }
            case  3:
            if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_matchMode)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("tn93", 1, 5, 5, 3); __PYX_ERR(0, 11, __pyx_L3_error)
            }
            case  4:
            if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_min_overlap)) != 0)) kw_args--;
            else {
              __Pyx_RaiseArgtupleInvalid("tn93", 1, 5, 5, 4); __PYX_ERR(0, 11, __pyx_L3_error)
            }
          }
          if (unlikely(kw_args > 0)) {
            if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "tn93") < 0)) __PYX_ERR(0, 11, __pyx_L3_error)
          }
        } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
          goto __pyx_L5_argtuple_error;
        } else {
          values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
          values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
          values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
          values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
          values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        }
        __pyx_v_s1 = values[0];
        __pyx_v_s2 = values[1];
        __pyx_v_L = values[2];
        __pyx_v_matchMode = values[3];
        __pyx_v_min_overlap = values[4];
      }
      goto __pyx_L4_argument_unpacking_done;
      __pyx_L5_argtuple_error:;
      __Pyx_RaiseArgtupleInvalid("tn93", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 11, __pyx_L3_error)
      __pyx_L3_error:;
      __Pyx_AddTraceback("BioExt.tn93._tn93.tn93", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __Pyx_RefNannyFinishContext();
      return NULL;
      __pyx_L4_argument_unpacking_done:;
      __pyx_r = __pyx_pf_6BioExt_4tn93_5_tn93_tn93(__pyx_self, __pyx_v_s1, __pyx_v_s2, __pyx_v_L, __pyx_v_matchMode, __pyx_v_min_overlap);

      /* function exit code */
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }

    static PyObject *__pyx_pf_6BioExt_4tn93_5_tn93_tn93(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_s1, PyObject *__pyx_v_s2, PyObject *__pyx_v_L, PyObject *__pyx_v_matchMode, PyObject *__pyx_v_min_overlap) {
      PyObject *__pyx_v_s1b = NULL;
      PyObject *__pyx_v_s2b = NULL;
      PyObject *__pyx_r = NULL;
      __Pyx_RefNannyDeclarations
      __Pyx_RefNannySetupContext("tn93", 0);
    /* … */
      /* function exit code */
      __pyx_L1_error:;
      __Pyx_XDECREF(__pyx_t_1);
      __Pyx_XDECREF(__pyx_t_2);
      __Pyx_AddTraceback("BioExt.tn93._tn93.tn93", __pyx_clineno, __pyx_lineno, __pyx_filename);
      __pyx_r = NULL;
      __pyx_L0:;
      __Pyx_XDECREF(__pyx_v_s1b);
      __Pyx_XDECREF(__pyx_v_s2b);
      __Pyx_XGIVEREF(__pyx_r);
      __Pyx_RefNannyFinishContext();
      return __pyx_r;
    }
    /* … */
      __pyx_tuple_ = PyTuple_Pack(7, __pyx_n_s_s1, __pyx_n_s_s2, __pyx_n_s_L, __pyx_n_s_matchMode, __pyx_n_s_min_overlap, __pyx_n_s_s1b, __pyx_n_s_s2b); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 11, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_tuple_);
      __Pyx_GIVEREF(__pyx_tuple_);
    /* … */
      __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_6BioExt_4tn93_5_tn93_1tn93, NULL, __pyx_n_s_BioExt_tn93__tn93); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_tn93, __pyx_t_1) < 0) __PYX_ERR(0, 11, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    +12:   s1b=bytearray(s1,"ASCII")

      __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 12, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_v_s1);
      __Pyx_GIVEREF(__pyx_v_s1);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_s1);
      __Pyx_INCREF(__pyx_n_s_ASCII);
      __Pyx_GIVEREF(__pyx_n_s_ASCII);
      PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_ASCII);
      __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)(&PyByteArray_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 12, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_v_s1b = ((PyObject*)__pyx_t_2);
      __pyx_t_2 = 0;

    +13:   s2b=bytearray(s2,"ASCII")

      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 13, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_INCREF(__pyx_v_s2);
      __Pyx_GIVEREF(__pyx_v_s2);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_s2);
      __Pyx_INCREF(__pyx_n_s_ASCII);
      __Pyx_GIVEREF(__pyx_n_s_ASCII);
      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_ASCII);
      __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&PyByteArray_Type)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_v_s2b = ((PyObject*)__pyx_t_1);
      __pyx_t_1 = 0;

    +14:   return(_tn93(s1b,s2b,L,matchMode,min_overlap))

      __Pyx_XDECREF(__pyx_r);
      __pyx_t_3 = __Pyx_PyObject_AsString(__pyx_v_s1b); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) __PYX_ERR(0, 14, __pyx_L1_error)
      __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_v_s2b); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) __PYX_ERR(0, 14, __pyx_L1_error)
      __pyx_t_5 = __Pyx_PyInt_As_unsigned_long(__pyx_v_L); if (unlikely((__pyx_t_5 == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(0, 14, __pyx_L1_error)
      __pyx_t_6 = __Pyx_PyInt_As_unsigned_int(__pyx_v_matchMode); if (unlikely((__pyx_t_6 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(0, 14, __pyx_L1_error)
      __pyx_t_7 = __Pyx_PyInt_As_unsigned_long(__pyx_v_min_overlap); if (unlikely((__pyx_t_7 == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(0, 14, __pyx_L1_error)
      __pyx_t_1 = PyFloat_FromDouble(tn93(__pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6, __pyx_t_7)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_r = __pyx_t_1;
      __pyx_t_1 = 0;
      goto __pyx_L0;

     15: