about summary refs log tree commit diff stats
Commit message (Collapse)AuthorAgeFilesLines
* Add links to READMEAndinus2020-08-292-1/+5
|
* Add timeline commandAndinus2020-08-291-1/+35
| | | | | | | | | | | | | | | After this I'll make it possible to call single user timeline, like `pyxis timeline <user>'. We will check in early in code & read only this file. Also, need to append user information in `%twtxt' along with support for multiple entries in single date. Currently only one entry will show up if there is a date clash. I'll fix these by changing the data structure to hash table of a list of hash table. So the list will contain 2 hashes - user & entry & the list of this will be store in hash table so as to not over write multiple entries of same time.
* Remove un-used moduleAndinus2020-08-291-1/+0
|
* Add example config file & document itAndinus2020-08-292-2/+45
|
* Comment user-agent changeAndinus2020-08-291-1/+1
| | | | | | That's basically giving my IP address to people because I don't think anyone else will be using this. So feed owners could just link the IP to me directly which is not good.
* Change user-agent stringAndinus2020-08-291-1/+6
|
* Add fetch featureAndinus2020-08-291-0/+67
|
* Initial commitAndinus2020-08-293-0/+39
y?h=v1.9.0b1&id=cb41ff7ba0c1a60044bb4329812ceb9920965f03'>^
d1a1173d ^

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46

                                                                 
 
                                        
                                                                    
 






                                      
 



























                                                                     

                          

                     
# This file is part of ranger, the console file manager.
# License: GNU GPL version 3, see the file "AUTHORS" for details.

def human_readable(byte, separator=' '):
    """Convert a large number of bytes to an easily readable format.

    >>> human_readable(54)
    '54 B'
    >>> human_readable(1500)
    '1.46 K'
    >>> human_readable(2 ** 20 * 1023)
    '1023 M'
    """

    # I know this can be written much shorter, but this long version
    # performs much better than what I had before.  If you attempt to
    # shorten this code, take performance into consideration.
    if byte <= 0:
        return '0'
    if byte < 2**10:
        return '%d%sB'   % (byte, separator)
    if byte < 2**10 * 999:
        return '%.3g%sK' % (byte / 2**10.0, separator)
    if byte < 2**20:
        return '%.4g%sK' % (byte / 2**10.0, separator)
    if byte < 2**20 * 999:
        return '%.3g%sM' % (byte / 2**20.0, separator)
    if byte < 2**30:
        return '%.4g%sM' % (byte / 2**20.0, separator)
    if byte < 2**30 * 999:
        return '%.3g%sG' % (byte / 2**30.0, separator)
    if byte < 2**40:
        return '%.4g%sG' % (byte / 2**30.0, separator)
    if byte < 2**40 * 999:
        return '%.3g%sT' % (byte / 2**40.0, separator)
    if byte < 2**50:
        return '%.4g%sT' % (byte / 2**40.0, separator)
    if byte < 2**50 * 999:
        return '%.3g%sP' % (byte / 2**50.0, separator)
    if byte < 2**60:
        return '%.4g%sP' % (byte / 2**50.0, separator)
    return '>9000'

if __name__ == '__main__':
    import doctest
    doctest.testmod()