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

SwissDataScienceCenter / renku-python / 5529030370

pending completion
5529030370

push

github-actions

Ralf Grubenmann
fix docker build, pin versions

24252 of 28479 relevant lines covered (85.16%)

2.95 hits per line

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

23.81
/renku/domain_model/sort.py
1
# -*- coding: utf-8 -*-
2
#
3
# Copyright 2018-2022- Swiss Data Science Center (SDSC)
4
# A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and
5
# Eidgenössische Technische Hochschule Zürich (ETHZ).
6
#
7
# Licensed under the Apache License, Version 2.0 (the "License");
8
# you may not use this file except in compliance with the License.
9
# You may obtain a copy of the License at
10
#
11
#     http://www.apache.org/licenses/LICENSE-2.0
12
#
13
# Unless required by applicable law or agreed to in writing, software
14
# distributed under the License is distributed on an "AS IS" BASIS,
15
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
# See the License for the specific language governing permissions and
17
# limitations under the License.
18
"""Process Git repository."""
2✔
19

20
from collections import deque
2✔
21
from typing import Any, Deque
2✔
22

23
GRAY, BLACK = 0, 1
2✔
24

25

26
def topological(nodes):
2✔
27
    """Return nodes in a topological order."""
28
    order: Deque[Any]
29
    order, enter, state = deque(), set(nodes), {}
×
30

31
    def dfs(node):
×
32
        """Visit nodes in depth-first order."""
33
        state[node] = GRAY
×
34
        for parent in nodes.get(node, ()):
×
35
            color = state.get(parent, None)
×
36
            if color == GRAY:
×
37
                raise ValueError("cycle")
×
38
            if color == BLACK:
×
39
                continue
×
40
            enter.discard(parent)
×
41
            dfs(parent)
×
42
        order.appendleft(node)
×
43
        state[node] = BLACK
×
44

45
    while enter:
×
46
        dfs(enter.pop())
×
47

48
    return order
×
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