• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

zopefoundation / Zope / 6263629025

21 Sep 2023 03:12PM UTC coverage: 82.146% (-0.01%) from 82.159%
6263629025

Pull #1164

github

web-flow
[pre-commit.ci lite] apply automatic fixes
Pull Request #1164: Move all linters to pre-commit.

4353 of 6963 branches covered (0.0%)

Branch coverage included in aggregate %.

487 of 487 new or added lines in 186 files covered. (100.0%)

27394 of 31684 relevant lines covered (86.46%)

0.86 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

77.14
/src/Shared/DC/Scripts/Signature.py
1
##############################################################################
2
#
3
# Copyright (c) 2002 Zope Foundation and Contributors.
4
#
5
# This software is subject to the provisions of the Zope Public License,
6
# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
7
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
8
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
9
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
10
# FOR A PARTICULAR PURPOSE
11
#
12
##############################################################################
13
"""Signature module.
1✔
14

15
This provides support for simulating function signatures
16
"""
17

18
from functools import total_ordering
1✔
19

20

21
@total_ordering
1✔
22
class FuncCode:
1✔
23

24
    def __init__(self, varnames=(), argcount=-1):
1✔
25
        # The default values are needed for unpickling instances of this class
26
        # which where created before 4.0b2 where this class was still an old
27
        # style class. For details see
28
        # https://github.com/zopefoundation/Zope/issues/205
29
        self.co_varnames = varnames
1✔
30
        self.co_argcount = argcount
1✔
31

32
    def __eq__(self, other):
1✔
33
        if not isinstance(other, FuncCode):
1✔
34
            return False
1✔
35
        # fmt: off
36
        return ((self.co_argcount, self.co_varnames) ==  # NOQA: W504
1✔
37
                (other.co_argcount, other.co_varnames))
38
        # fmt: on
39

40
    def __lt__(self, other):
1✔
41
        if not isinstance(other, FuncCode):
×
42
            return False
×
43
        # fmt: off
44
        return ((self.co_argcount, self.co_varnames) <  # NOQA: W504
×
45
                (other.co_argcount, other.co_varnames))
46
        # fmt: on
47

48

49
def _setFuncSignature(self, defaults=None, varnames=(), argcount=-1):
1✔
50
    # This is meant to be imported directly into a class.
51
    # Simplify calls.
52
    if argcount < 0 and varnames:
1✔
53
        argcount = len(varnames)
1✔
54
    # Generate a change only if we have to.
55
    if self.__defaults__ != defaults:
1!
56
        self.__defaults__ = defaults
×
57
    code = FuncCode(varnames, argcount)
1✔
58
    if self.__code__ != code:
1!
59
        self.__code__ = code
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc