LCOV - code coverage report
Current view: top level - Modules/clinic - sha1module.c.h (source / functions) Hit Total Coverage
Test: CPython lcov report Lines: 29 33 87.9 %
Date: 2022-07-07 18:19:46 Functions: 4 4 100.0 %

          Line data    Source code
       1             : /*[clinic input]
       2             : preserve
       3             : [clinic start generated code]*/
       4             : 
       5             : PyDoc_STRVAR(SHA1Type_copy__doc__,
       6             : "copy($self, /)\n"
       7             : "--\n"
       8             : "\n"
       9             : "Return a copy of the hash object.");
      10             : 
      11             : #define SHA1TYPE_COPY_METHODDEF    \
      12             :     {"copy", _PyCFunction_CAST(SHA1Type_copy), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, SHA1Type_copy__doc__},
      13             : 
      14             : static PyObject *
      15             : SHA1Type_copy_impl(SHA1object *self, PyTypeObject *cls);
      16             : 
      17             : static PyObject *
      18           1 : SHA1Type_copy(SHA1object *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
      19             : {
      20           1 :     if (nargs) {
      21           0 :         PyErr_SetString(PyExc_TypeError, "copy() takes no arguments");
      22           0 :         return NULL;
      23             :     }
      24           1 :     return SHA1Type_copy_impl(self, cls);
      25             : }
      26             : 
      27             : PyDoc_STRVAR(SHA1Type_digest__doc__,
      28             : "digest($self, /)\n"
      29             : "--\n"
      30             : "\n"
      31             : "Return the digest value as a bytes object.");
      32             : 
      33             : #define SHA1TYPE_DIGEST_METHODDEF    \
      34             :     {"digest", (PyCFunction)SHA1Type_digest, METH_NOARGS, SHA1Type_digest__doc__},
      35             : 
      36             : static PyObject *
      37             : SHA1Type_digest_impl(SHA1object *self);
      38             : 
      39             : static PyObject *
      40          15 : SHA1Type_digest(SHA1object *self, PyObject *Py_UNUSED(ignored))
      41             : {
      42          15 :     return SHA1Type_digest_impl(self);
      43             : }
      44             : 
      45             : PyDoc_STRVAR(SHA1Type_hexdigest__doc__,
      46             : "hexdigest($self, /)\n"
      47             : "--\n"
      48             : "\n"
      49             : "Return the digest value as a string of hexadecimal digits.");
      50             : 
      51             : #define SHA1TYPE_HEXDIGEST_METHODDEF    \
      52             :     {"hexdigest", (PyCFunction)SHA1Type_hexdigest, METH_NOARGS, SHA1Type_hexdigest__doc__},
      53             : 
      54             : static PyObject *
      55             : SHA1Type_hexdigest_impl(SHA1object *self);
      56             : 
      57             : static PyObject *
      58          15 : SHA1Type_hexdigest(SHA1object *self, PyObject *Py_UNUSED(ignored))
      59             : {
      60          15 :     return SHA1Type_hexdigest_impl(self);
      61             : }
      62             : 
      63             : PyDoc_STRVAR(SHA1Type_update__doc__,
      64             : "update($self, obj, /)\n"
      65             : "--\n"
      66             : "\n"
      67             : "Update this hash object\'s state with the provided string.");
      68             : 
      69             : #define SHA1TYPE_UPDATE_METHODDEF    \
      70             :     {"update", (PyCFunction)SHA1Type_update, METH_O, SHA1Type_update__doc__},
      71             : 
      72             : PyDoc_STRVAR(_sha1_sha1__doc__,
      73             : "sha1($module, /, string=b\'\', *, usedforsecurity=True)\n"
      74             : "--\n"
      75             : "\n"
      76             : "Return a new SHA1 hash object; optionally initialized with a string.");
      77             : 
      78             : #define _SHA1_SHA1_METHODDEF    \
      79             :     {"sha1", _PyCFunction_CAST(_sha1_sha1), METH_FASTCALL|METH_KEYWORDS, _sha1_sha1__doc__},
      80             : 
      81             : static PyObject *
      82             : _sha1_sha1_impl(PyObject *module, PyObject *string, int usedforsecurity);
      83             : 
      84             : static PyObject *
      85          30 : _sha1_sha1(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
      86             : {
      87          30 :     PyObject *return_value = NULL;
      88             :     static const char * const _keywords[] = {"string", "usedforsecurity", NULL};
      89             :     static _PyArg_Parser _parser = {NULL, _keywords, "sha1", 0};
      90             :     PyObject *argsbuf[2];
      91          30 :     Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
      92          30 :     PyObject *string = NULL;
      93          30 :     int usedforsecurity = 1;
      94             : 
      95          30 :     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
      96          30 :     if (!args) {
      97           0 :         goto exit;
      98             :     }
      99          30 :     if (!noptargs) {
     100          10 :         goto skip_optional_pos;
     101             :     }
     102          20 :     if (args[0]) {
     103          11 :         string = args[0];
     104          11 :         if (!--noptargs) {
     105           5 :             goto skip_optional_pos;
     106             :         }
     107             :     }
     108          15 : skip_optional_pos:
     109          30 :     if (!noptargs) {
     110          15 :         goto skip_optional_kwonly;
     111             :     }
     112          15 :     usedforsecurity = PyObject_IsTrue(args[1]);
     113          15 :     if (usedforsecurity < 0) {
     114           0 :         goto exit;
     115             :     }
     116          15 : skip_optional_kwonly:
     117          30 :     return_value = _sha1_sha1_impl(module, string, usedforsecurity);
     118             : 
     119          30 : exit:
     120          30 :     return return_value;
     121             : }
     122             : /*[clinic end generated code: output=322d77ba0a4282fc input=a9049054013a1b77]*/

Generated by: LCOV version 1.14