Test Failed
Push — master ( 0496d3...626f66 )
by W
01:28
created

st2common/st2common/exceptions/inquiry.py (10 issues)

Labels
1
# Licensed to the StackStorm, Inc ('StackStorm') under one or more
2
# contributor license agreements.  See the NOTICE file distributed with
3
# this work for additional information regarding copyright ownership.
4
# The ASF licenses this file to You under the Apache License, Version 2.0
5
# (the "License"); you may not use this file except in compliance with
6
# the License.  You may obtain a copy of the License at
7
#
8
#     http://www.apache.org/licenses/LICENSE-2.0
9
#
10
# Unless required by applicable law or agreed to in writing, software
11
# distributed under the License is distributed on an "AS IS" BASIS,
12
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
# See the License for the specific language governing permissions and
14
# limitations under the License.
15
16
from __future__ import absolute_import
17
18
from st2common import exceptions as st2_exc
19
from st2common import log as logging
20
21
22
LOG = logging.getLogger(__name__)
23
24
25
class InvalidInquiryInstance(st2_exc.StackStormBaseException):
26
27
    def __init__(self, inquiry_id):
0 ignored issues
show
The __init__ method of the super-class StackStormBaseException is not called.

It is generally advisable to initialize the super-class by calling its __init__ method:

class SomeParent:
    def __init__(self):
        self.x = 1

class SomeChild(SomeParent):
    def __init__(self):
        # Initialize the super class
        SomeParent.__init__(self)
Loading history...
28
        Exception.__init__(self, 'Action execution "%s" is not an inquiry.' % inquiry_id)
0 ignored issues
show
The __init__ of the immediate ancestor is not called instead this calls
the method of another ancestor Exception.

It is usually advisable to call the __init__ method of the immediate ancestor instead of another ancestor in the inheritance chain:

class NonDirectParent:
    def __init__(self):
        pass

class DirectParent(NonDirectParent):
    def __init__(self):
        NonDirectParent.__init__(self)

class YourClass(DirectParent):
    def __init__(self):
        NonDirectParent.__init__(self) # Bad
        DirectParent.__init__(self)    # Good
Loading history...
29
30
31
class InquiryTimedOut(st2_exc.StackStormBaseException):
32
33
    def __init__(self, inquiry_id):
0 ignored issues
show
The __init__ method of the super-class StackStormBaseException is not called.

It is generally advisable to initialize the super-class by calling its __init__ method:

class SomeParent:
    def __init__(self):
        self.x = 1

class SomeChild(SomeParent):
    def __init__(self):
        # Initialize the super class
        SomeParent.__init__(self)
Loading history...
34
        Exception.__init__(self, 'Inquiry "%s" timed out and cannot be responded to.' % inquiry_id)
0 ignored issues
show
The __init__ of the immediate ancestor is not called instead this calls
the method of another ancestor Exception.

It is usually advisable to call the __init__ method of the immediate ancestor instead of another ancestor in the inheritance chain:

class NonDirectParent:
    def __init__(self):
        pass

class DirectParent(NonDirectParent):
    def __init__(self):
        NonDirectParent.__init__(self)

class YourClass(DirectParent):
    def __init__(self):
        NonDirectParent.__init__(self) # Bad
        DirectParent.__init__(self)    # Good
Loading history...
35
36
37
class InquiryAlreadyResponded(st2_exc.StackStormBaseException):
38
39
    def __init__(self, inquiry_id):
0 ignored issues
show
The __init__ method of the super-class StackStormBaseException is not called.

It is generally advisable to initialize the super-class by calling its __init__ method:

class SomeParent:
    def __init__(self):
        self.x = 1

class SomeChild(SomeParent):
    def __init__(self):
        # Initialize the super class
        SomeParent.__init__(self)
Loading history...
40
        Exception.__init__(self, 'Inquiry "%s" has already been responded to.' % inquiry_id)
0 ignored issues
show
The __init__ of the immediate ancestor is not called instead this calls
the method of another ancestor Exception.

It is usually advisable to call the __init__ method of the immediate ancestor instead of another ancestor in the inheritance chain:

class NonDirectParent:
    def __init__(self):
        pass

class DirectParent(NonDirectParent):
    def __init__(self):
        NonDirectParent.__init__(self)

class YourClass(DirectParent):
    def __init__(self):
        NonDirectParent.__init__(self) # Bad
        DirectParent.__init__(self)    # Good
Loading history...
41
42
43
class InquiryResponseUnauthorized(st2_exc.StackStormBaseException):
44
45
    def __init__(self, inquiry_id, user):
0 ignored issues
show
The __init__ method of the super-class StackStormBaseException is not called.

It is generally advisable to initialize the super-class by calling its __init__ method:

class SomeParent:
    def __init__(self):
        self.x = 1

class SomeChild(SomeParent):
    def __init__(self):
        # Initialize the super class
        SomeParent.__init__(self)
Loading history...
46
        msg = 'User "%s" does not have permission to respond to inquiry "%s".'
47
        Exception.__init__(self, msg % (user, inquiry_id))
0 ignored issues
show
The __init__ of the immediate ancestor is not called instead this calls
the method of another ancestor Exception.

It is usually advisable to call the __init__ method of the immediate ancestor instead of another ancestor in the inheritance chain:

class NonDirectParent:
    def __init__(self):
        pass

class DirectParent(NonDirectParent):
    def __init__(self):
        NonDirectParent.__init__(self)

class YourClass(DirectParent):
    def __init__(self):
        NonDirectParent.__init__(self) # Bad
        DirectParent.__init__(self)    # Good
Loading history...
48
49
50
class InvalidInquiryResponse(st2_exc.StackStormBaseException):
51
52
    def __init__(self, inquiry_id, error):
0 ignored issues
show
The __init__ method of the super-class StackStormBaseException is not called.

It is generally advisable to initialize the super-class by calling its __init__ method:

class SomeParent:
    def __init__(self):
        self.x = 1

class SomeChild(SomeParent):
    def __init__(self):
        # Initialize the super class
        SomeParent.__init__(self)
Loading history...
53
        msg = 'Response for inquiry "%s" did not pass schema validation. %s'
54
        Exception.__init__(self, msg % (inquiry_id, error))
0 ignored issues
show
The __init__ of the immediate ancestor is not called instead this calls
the method of another ancestor Exception.

It is usually advisable to call the __init__ method of the immediate ancestor instead of another ancestor in the inheritance chain:

class NonDirectParent:
    def __init__(self):
        pass

class DirectParent(NonDirectParent):
    def __init__(self):
        NonDirectParent.__init__(self)

class YourClass(DirectParent):
    def __init__(self):
        NonDirectParent.__init__(self) # Bad
        DirectParent.__init__(self)    # Good
Loading history...
55