Skip to content

Commit

Permalink
fixed packaging of example files
Browse files Browse the repository at this point in the history
  • Loading branch information
rasbt committed Feb 3, 2014
1 parent f411904 commit 3d0cd04
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 17 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
VERSION 2.0.1
==============
- fixed packaging of example files


VERSION 2.0.0
==============
- ProgBar and ProgPerc inherit data members from parent class Prog
Expand Down
7 changes: 5 additions & 2 deletions MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ LICENSE.txt
README.html
README.txt
setup.py
examples/ex1_percentage_indicator.py
examples/ex1_progress_bar.py
examples/ex1_percentage_indicator_stderr.py
examples/ex1_percentage_indicator_stdout.py
examples/ex1_progress_bar_stderr.py
examples/ex1_progress_bar_stdout.py
pyprind/__init__.py
pyprind/prog_class.py
pyprind/progbar.py
pyprind/progpercent.py
Binary file modified pyprind/.progbar.py.swo
Binary file not shown.
2 changes: 1 addition & 1 deletion pyprind/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@
from .progbar import ProgBar
from .progpercent import ProgPercent

__version__ = '2.0.0'
__version__ = '2.0.1'
4 changes: 2 additions & 2 deletions pyprind/prog_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ def __init__(self, iterations, track_time, stream):
self.track = track_time
self.time = [time.clock(), 0]
self.stream = stream
self.__check_stream()
self._check_stream()

def __check_stream(self):
def _check_stream(self):
if self.stream == 1 and os.isatty(sys.stdout.fileno()):
self._stream_out = sys.stdout.write
self._stream_flush = sys.stdout.flush
Expand Down
8 changes: 4 additions & 4 deletions pyprind/progbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ class ProgBar(Prog):
def __init__(self, iterations, track_time=True, width=50, stream=2):
Prog.__init__(self, iterations, track_time, stream)
self.bar_width = width
self.__adjust_width()
self._adjust_width()
self.bar_interv = self.max_iter // self.bar_width
self.__init_bar()
self._init_bar()

def __adjust_width(self):
def _adjust_width(self):
"""Shrinks bar if number of iterations is less than the bar width"""
if self.bar_width > self.max_iter:
self.bar_width = self.max_iter

def __init_bar(self):
def _init_bar(self):
"""Writes the initial bar frames to the output screen"""
self._stream_out('0%% %s 100%%\n' %(' ' * (self.bar_width - 6)))
self._stream_out('[%s]' % (' ' * self.bar_width))
Expand Down
10 changes: 5 additions & 5 deletions pyprind/progpercent.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ def __init__(self, iterations, track_time=True, stream=2):
Prog.__init__(self, iterations, track_time, stream)
self.perc = 0
self.max_iter = float(self.max_iter) # accommodation for Python 2.x users
self.__print_update()
self._print_update()

def __calc_percent(self):
def _calc_percent(self):
"""Calculates the rel. progress in percent and rounds it to an integer."""
return round(self.cnt/self.max_iter * 100)

def __print_update(self):
def _print_update(self):
"""Prints formatted integer percentage and tracked time to the screen."""
self._stream_out('\r[%3d %%]' % (self.perc))
if self.track:
Expand All @@ -38,10 +38,10 @@ def __print_update(self):
def update(self):
"""Updates the percentage indicator in every iteration of the task."""
self.cnt += 1
next_perc = self.__calc_percent()
next_perc = self._calc_percent()
if next_perc > self.perc:
self.perc = next_perc
self.__print_update()
self._print_update()
self._stream_flush()
if self.cnt == self.max_iter:
self._stream_out('\n')
Expand Down
9 changes: 6 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from distutils.core import setup

setup(name='PyPrind',
version='2.0.0',
version='2.0.1',
description='Python Progress Indicator Utility',
author='Sebastian Raschka',
author_email='[email protected]',
Expand All @@ -11,8 +11,11 @@
('', ['README.html']),
('', ['README.txt']),
('', ['CHANGELOG.txt']),
('examples', ['examples/ex1_percentage_indicator.py']),
('examples', ['examples/ex1_progress_bar.py']),
('examples', ['examples/ex1_percentage_indicator_stderr.py']),
('examples', ['examples/ex1_percentage_indicator_stdout.py']),
('examples', ['examples/ex1_progress_bar_stderr.py']),
('examples', ['examples/ex1_progress_bar_stdout.py']),

],
license='GPLv3',
platforms='any',
Expand Down

0 comments on commit 3d0cd04

Please sign in to comment.