mirror of
https://github.com/Kilian/Trimage.git
synced 2026-01-26 10:08:40 -05:00
add copyright info for filesize.py, update homepage link in control
This commit is contained in:
parent
454d5e6d9f
commit
8715233259
4 changed files with 117 additions and 20 deletions
2
debian/control
vendored
2
debian/control
vendored
|
|
@ -5,7 +5,7 @@ Maintainer: Kilian Valkhof <kilian@kilianvalkhof.com>
|
||||||
Build-Depends: cdbs (>=0.4.49), debhelper (>=7), python-support (>=0.8.7), python
|
Build-Depends: cdbs (>=0.4.49), debhelper (>=7), python-support (>=0.8.7), python
|
||||||
XS-Python-Version: >=2.6
|
XS-Python-Version: >=2.6
|
||||||
Standards-Version: 3.8.0
|
Standards-Version: 3.8.0
|
||||||
Homepage: https://trimage.org
|
Homepage: http://trimage.org
|
||||||
|
|
||||||
Package: trimage
|
Package: trimage
|
||||||
Architecture: all
|
Architecture: all
|
||||||
|
|
|
||||||
43
debian/copyright
vendored
43
debian/copyright
vendored
|
|
@ -39,3 +39,46 @@ The Debian packaging is:
|
||||||
|
|
||||||
and is licensed under the MIT license, see above.
|
and is licensed under the MIT license, see above.
|
||||||
|
|
||||||
|
hurry.filesize is:
|
||||||
|
|
||||||
|
Copyright (C) Martijn Faassen, Startifact
|
||||||
|
|
||||||
|
License:
|
||||||
|
|
||||||
|
Zope Public License (ZPL) Version 2.1
|
||||||
|
A copyright notice accompanies this license document that identifies the
|
||||||
|
copyright holders. This license has been certified as open source. It has
|
||||||
|
also been designated as GPL compatible by the Free Software Foundation (FSF).
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
1. Redistributions in source code must retain the accompanying copyright
|
||||||
|
notice, this list of conditions, and the following disclaimer.
|
||||||
|
2. Redistributions in binary form must reproduce the accompanying
|
||||||
|
copyright notice, this list of conditions, and the following disclaimer
|
||||||
|
in the documentation and/or other materials provided with the
|
||||||
|
distribution.
|
||||||
|
3. Names of the copyright holders must not be used to endorse or promote
|
||||||
|
products derived from this software without prior written permission from
|
||||||
|
the copyright holders.
|
||||||
|
4. The right to distribute this software or to use it for any purpose does
|
||||||
|
not give you the right to use Servicemarks (sm) or Trademarks (tm) of the
|
||||||
|
copyright holders. Use of them is covered by separate agreement with the
|
||||||
|
copyright holders.
|
||||||
|
5. If any files are modified, you must cause the modified files to carry
|
||||||
|
prominent notices stating that you changed the files and the date of any
|
||||||
|
change.
|
||||||
|
|
||||||
|
Disclaimer
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
|
||||||
|
EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT,
|
||||||
|
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1 +1,50 @@
|
||||||
|
hurry.filesize
|
||||||
|
==============
|
||||||
|
|
||||||
|
hurry.filesize a simple Python library that can take a number of bytes and
|
||||||
|
returns a human-readable string with the size in it, in kilobytes (K),
|
||||||
|
megabytes (M), etc.
|
||||||
|
|
||||||
|
The default system it uses is "traditional", where multipliers of 1024
|
||||||
|
increase the unit size::
|
||||||
|
|
||||||
|
>>> from hurry.filesize import size
|
||||||
|
>>> size(1024)
|
||||||
|
'1K'
|
||||||
|
|
||||||
|
An alternative, slightly more verbose system::
|
||||||
|
|
||||||
|
>>> from hurry.filesize import alternative
|
||||||
|
>>> size(1, system=alternative)
|
||||||
|
'1 byte'
|
||||||
|
>>> size(10, system=alternative)
|
||||||
|
'10 bytes'
|
||||||
|
>>> size(1024, system=alternative)
|
||||||
|
'1 KB'
|
||||||
|
|
||||||
|
A verbose system::
|
||||||
|
|
||||||
|
>>> from hurry.filesize import verbose
|
||||||
|
>>> size(10, system=verbose)
|
||||||
|
'10 bytes'
|
||||||
|
>>> size(1024, system=verbose)
|
||||||
|
'1 kilobyte'
|
||||||
|
>>> size(2000, system=verbose)
|
||||||
|
'1 kilobyte'
|
||||||
|
>>> size(3000, system=verbose)
|
||||||
|
'2 kilobytes'
|
||||||
|
>>> size(1024 * 1024, system=verbose)
|
||||||
|
'1 megabyte'
|
||||||
|
>>> size(1024 * 1024 * 3, system=verbose)
|
||||||
|
'3 megabytes'
|
||||||
|
|
||||||
|
You can also use the SI system, where multipliers of 1000 increase the unit
|
||||||
|
size::
|
||||||
|
|
||||||
|
>>> from hurry.filesize import si
|
||||||
|
>>> size(1000, system=si)
|
||||||
|
'1K'
|
||||||
|
|
||||||
|
|
||||||
http://pypi.python.org/pypi/hurry.filesize
|
http://pypi.python.org/pypi/hurry.filesize
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,9 @@
|
||||||
|
'''
|
||||||
|
hurry.filesize
|
||||||
|
|
||||||
|
@author: Martijn Faassen, Startifact
|
||||||
|
@license: ZPL 2.1
|
||||||
|
'''
|
||||||
|
|
||||||
traditional = [
|
traditional = [
|
||||||
(1024 ** 5, 'P'),
|
(1024 ** 5, 'P'),
|
||||||
|
|
@ -107,4 +113,3 @@ def size(bytes, system=traditional):
|
||||||
else:
|
else:
|
||||||
suffix = multiple
|
suffix = multiple
|
||||||
return str(amount) + suffix
|
return str(amount) + suffix
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue