final post-split cleanup

This commit is contained in:
Lukasz Forynski 2014-11-22 22:18:00 +00:00
parent 9d818c5674
commit 9d314f19d2
6 changed files with 3 additions and 137 deletions

View File

@ -1,9 +1,9 @@
python_data_structures
multi_key_dict
======================
distribution can be found on pypi:
* https://pypi.python.org/pypi?:action=display&name=multi_key_dict
Build status (on Travis CI) [![Build Status](https://travis-ci.org/formiaczek/python_data_structures.svg?branch=master)](https://travis-ci.org/formiaczek/python_data_structures)
Build status (on Travis CI) [![Build Status](https://travis-ci.org/formiaczek/multi_key_dict.svg?branch=master)](https://travis-ci.org/formiaczek/multi_key_dict)

View File

@ -32,9 +32,3 @@ Multi-key dict provides also extended interface for iterating over items and key
It can be useful for many many other similar use-cases, and there is no limit to the number of keys used to map to the value.
There are few other useful methods, e.g. to iterate over dictionary (by/using) selected key type, finding other keys mapping to the same value etc. Refer to example/test code to see it in action.
Distributions can be found on pypi:
* https://pypi.python.org/pypi?:action=display&name=multi_key_dict
Build status (on Travis CI) [![Build Status](https://travis-ci.org/formiaczek/python_data_structures.svg?branch=master)](https://travis-ci.org/formiaczek/python_data_structures)

View File

@ -12,7 +12,7 @@ setup(name='multi_key_dict',
description='Multi key dictionary implementation',
author='Lukasz Forynski',
author_email='lukasz.forynski@gmail.com',
url='https://github.com/formiaczek/python_data_structures',
url='https://github.com/formiaczek/multi_key_dict',
py_modules=['multi_key_dict'],
license=['License :: OSI Approved :: MIT License (http://opensource.org/licenses/MIT)'],
long_description=long_descr,

View File

@ -1,13 +0,0 @@
text_progress_bar
======================
Implementation of a simple text progress bar.
It looks something like this:
[================..............] : downloading xyz (186/335)
distributions can be found on pypi:
* https://pypi.python.org/pypi?:action=display&name=text_progress_bar

View File

@ -1,27 +0,0 @@
#!python
from distutils.core import setup
long_descr=''
with open('README.txt') as readme:
long_descr = readme.read()
setup(name='text_progress_bar',
version='1.0.1',
description='Simple text progress bar',
author='Lukasz Forynski',
author_email='lukasz.forynski@gmail.com',
url='https://github.com/formiaczek/python_data_structures',
py_modules=['text_progress_bar'],
license=['License :: OSI Approved :: MIT License (http://opensource.org/licenses/MIT)'],
long_description=long_descr,
classifiers=[
'Programming Language :: Python',
'License :: OSI Approved :: MIT License',
'Development Status :: 4 - Beta',
'Operating System :: OS Independent',
'Intended Audience :: Developers',
'Topic :: Software Development :: Libraries :: Python Modules'
]
)

View File

@ -1,88 +0,0 @@
'''
Created on 5 Jun 2013
@author: lukasz.forynski
@brief Simple text progress-bar.
https://github.com/formiaczek/python_data_structures
___________________________________
Copyright (c) 2013 Lukasz Forynski <lukasz.forynski@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify, merge,
publish, distribute, sub-license, and/or sell copies of the Software, and to permit persons
to whom the Software is furnished to do so, subject to the following conditions:
- The above copyright notice and this permission notice shall be included in all copies
or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
'''
import sys
import time
class text_progress_bar(object):
## Init method.
# @param length_in_chars lenght of the progress bar.
def __init__(self, length_in_chars, str_to_write_on_finished = '\n'):
self.length = length_in_chars
self.str_on_finished = str_to_write_on_finished
self.reset()
## resets the progress bar
def reset(self):
self.current = 0
self.total = 0
self.description = ''
self.bar = list('.' * self.length)
## method to set the progress description
# @description test to be displayed next to the progress bar
# (e.g. name of the task for which the progress is displayed)
def set_description(self, description):
if len(description):
self.description = ': %s' % description
## Callback to indicate (update and display) the progress
# @param current - current value of the progress
# @param total total value (i.e. he number current is converging to)
def progress_callback(self, current, total):
if self.total != total:
self.total = total
if total:
new_current = (current * self.length)
new_current /= self.total
if new_current > self.current:
for i in xrange(self.current,new_current):
self.bar[i] = '='
self.current = new_current
sys.stdout.write('\r[%s] %s (%d/%d) ' % (''.join(self.bar),
self.description,
current,
total))
if current == self.total:
self.reset()
sys.stdout.write('\n')
def test_progress_bar():
b = text_progress_bar(30)
b.set_description('testing progress')
for i in xrange(0, 335+1): # say our task is from 0-335 steps..
b.progress_callback(i, 335)
time.sleep(0.025)
if __name__ == '__main__':
test_progress_bar()