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.

tests   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 7
eloc 19
dl 0
loc 44
rs 10
c 0
b 0
f 0

3 Functions

Rating   Name   Duplication   Size   Complexity  
A example() 0 4 1
A touch() 0 5 2
A await_condition() 0 11 4
1
# -*- coding: utf-8 -*-
2
# -----------------------------------------------------------------------------
3
# Copyright (c) 2015 Yann Lanthony
4
# Copyright (c) 2017-2018 Spyder Project Contributors
5
#
6
# Licensed under the terms of the MIT License
7
# (See LICENSE.txt for details)
8
# -----------------------------------------------------------------------------
9
10
# Standard library imports
11
from os.path import dirname, join, normpath
12
import os
13
import time
14
15
16
PROJECT_DIR = normpath(dirname(dirname(__file__)))
17
EXAMPLES_DIR = normpath(join(PROJECT_DIR, 'examples'))
18
19
20
def example(*paths):
21
    """Get path to an example."""
22
23
    return normpath(join(dirname(__file__), '..', 'examples', *paths))
24
25
26
def touch(file):
27
    """Touch a file."""
28
29
    with open(str(file), 'a'):
30
        os.utime(str(file), None)
31
32
33
def await_condition(condition, timeout=20, qt_app=None):
34
    """Return True if a condition is met in the given timeout period"""
35
36
    for _ in range(timeout):
37
        if qt_app:
38
            # pump event loop while waiting for condition
39
            qt_app.processEvents()
40
        if condition():
41
            return True
42
        time.sleep(0.1)
43
    return False
44