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.

split_canonical_name()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
1
# -*- coding: utf-8 -*-
2
3
def human_bytes(n):
4
    """
5
    Return the number of bytes n in more human readable form.
6
    """
7
    if n < 1024:
8
        return '%d B' % n
9
    k = n/1024
10
    if k < 1024:
11
        return '%d KB' % round(k)
12
    m = k/1024
13
    if m < 1024:
14
        return '%.1f MB' % m
15
    g = m/1024
16
    return '%.2f GB' % g
17
18
19
def split_canonical_name(cname):
20
    """
21
    Split a canonical package name into (name, version, build) strings.
22
    """
23
    return tuple(cname.rsplit('-', 2))
24