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.
Passed
Push — master ( 1ffa70...969d8f )
by
unknown
06:42
created

is_use_debugger_flag_provided()   B

Complexity

Conditions 5

Size

Total Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 5
c 1
b 0
f 0
dl 0
loc 13
rs 8.5454
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
#
15
16
"""
17
Module for performing eventlet and other monkey patching.
18
"""
19
20
from __future__ import absolute_import
21
22
import sys
23
24
__all__ = [
25
    'monkey_patch',
26
    'is_use_debugger_flag_provided'
27
]
28
29
USE_DEBUGGER_FLAG = '--use-debugger'
30
PARENT_ARGS_FLAG = '--parent-args='
31
32
33
def monkey_patch():
34
    """
35
    Function which performs eventlet monkey patching and also takes into account "--use-debugger"
36
    argument in the command line arguments.
37
38
    If this argument is found, no monkey patching is performed for the thread module. This allows
39
    user to use remote debuggers.
40
    """
41
    import eventlet
42
43
    patch_thread = not is_use_debugger_flag_provided()
44
    eventlet.monkey_patch(os=True, select=True, socket=True, thread=patch_thread, time=True)
45
46
47
def is_use_debugger_flag_provided():
48
    # 1. Check sys.argv directly
49
    if USE_DEBUGGER_FLAG in sys.argv:
50
        return True
51
52
    # 2. Check "parent-args" arguments. This is used for spawned processes such as sensors and
53
    # Python runner actions
54
55
    for arg in sys.argv:
56
        if arg.startswith(PARENT_ARGS_FLAG) and USE_DEBUGGER_FLAG in arg:
57
            return True
58
59
    return False
60