GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

SharedMixin.remove_value()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
dl 0
loc 2
rs 10
c 0
b 0
f 0
1
# Copyright (c) 2014, Salesforce.com, Inc.  All rights reserved.
2
#
3
# Redistribution and use in source and binary forms, with or without
4
# modification, are permitted provided that the following conditions
5
# are met:
6
#
7
# - Redistributions of source code must retain the above copyright
8
#   notice, this list of conditions and the following disclaimer.
9
# - Redistributions in binary form must reproduce the above copyright
10
#   notice, this list of conditions and the following disclaimer in the
11
#   documentation and/or other materials provided with the distribution.
12
# - Neither the name of Salesforce.com nor the names of its contributors
13
#   may be used to endorse or promote products derived from this
14
#   software without specific prior written permission.
15
#
16
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
19
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
20
# COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
21
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
22
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
23
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
25
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
26
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28
import warnings
29
import functools
30
31
32
def deprecated(message='function will be removed in the future'):
33
34
    def decorator(fun):
35
36
        @functools.wraps(fun)
37
        def deprecated_fun(*args, **kwargs):
38
            warnings.warn('DEPRECATED {}: {}'.format(fun.__name__, message))
39
            return fun(*args, **kwargs)
40
41
        return deprecated_fun
42
43
    return decorator
44
45
46
class ComponentModel(object):
47
    pass
48
49
50
class SharedMixin(object):
51
    def add_value(self, value):
52
        pass
53
54
    def remove_value(self, value):
55
        pass
56
57
    def realize(self):
58
        pass
59
60
61
class ProtobufSerializable(object):
62
    @classmethod
63
    def to_protobuf(cls, raw, message):
64
        model = cls()
65
        model.load(raw)
66
        model.protobuf_dump(message)
67
68
    @classmethod
69
    def from_protobuf(cls, message):
70
        model = cls()
71
        model.protobuf_load(message)
72
        return model.dump()
73
74
    @deprecated('use protobuf_dump(message) instead')
75
    def dump_protobuf(self, message):
76
        self.protobuf_dump(message)
77
78
    @deprecated('use protobuf_load(message) instead')
79
    def load_protobuf(self, message):
80
        self.protobuf_load(message)
81
82
83
class GroupIoMixin(ProtobufSerializable):
84
    @classmethod
85
    def from_values(cls, model, values=[]):
86
        group = cls()
87
        group.init(model)
88
        for value in values:
89
            group.add_value(model, value)
90
        return group
91
92
    @classmethod
93
    def from_dict(cls, raw):
94
        group = cls()
95
        group.load(raw)
96
        return group
97
98
99
class SharedIoMixin(ProtobufSerializable):
100
    @classmethod
101
    def from_dict(cls, raw):
102
        model = cls()
103
        model.load(raw)
104
        return model
105