Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

80 character loading bar #103

Merged
merged 4 commits into from
Dec 14, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions easyaccess/easyaccess.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
import easyaccess.eautils.fun_utils as fun_utils
from easyaccess.eautils.import_utils import Import

except ImportError:
except ImportError as error:
warnings.warn(str(error))
from version import __version__
from version import last_pip_version
import eautils.dircache as dircache
Expand Down Expand Up @@ -125,7 +126,7 @@ def loading():
print()
cc = 0
spinner = itertools.cycle(list(range(13)) + list(range(1, 14, 1))[::-1])
line2 = " Press Ctrl-C to abort "
line2 = " Ctrl-C to abort; "
try:
while True:
line = list(' | |')
Expand Down Expand Up @@ -370,6 +371,7 @@ def do_help(self, arg):
else:
self.do_clear(None)
dl.print_deslogo(color_term)
self.stdout.write(str(self.intro) + "\n")
names = self.get_names()
cmds_doc = []
cmds_undoc = []
Expand Down Expand Up @@ -718,7 +720,7 @@ def query_and_print(self, query, print_time=True, err_arg='No rows selected', su
for kf in range(len(p_functions)):
data = fun_utils.updateDF(data, p_functions, p_args, p_names, kf)
updated = True
rowline = ' Rows : %d, Avg time (rows/sec): %.1f ' % (
rowline = ' Rows : %d, Rows/sec: %d ' % (
self.cur.rowcount, self.cur.rowcount * 1. / (time.time() - t1))
if self.loading_bar: sys.stdout.write(colored(rowline, 'yellow'))
if self.loading_bar: sys.stdout.flush()
Expand Down Expand Up @@ -822,7 +824,7 @@ def query_and_save(self, query, fileout, print_time=True, extra_func=None):
com_it = 0
while True:
data = pd.DataFrame(self.cur.fetchmany())
rowline = ' Rows : %d, Avg time (rows/sec): %.1f ' % (
rowline = ' Rows : %d, Rows/sec: %d ' % (
self.cur.rowcount, self.cur.rowcount * 1. / (time.time() - t1))
if self.loading_bar: sys.stdout.write(colored(rowline, 'yellow'))
if self.loading_bar: sys.stdout.flush()
Expand Down Expand Up @@ -2337,7 +2339,7 @@ def do_version(self, line):
print()
return

# UNDOCCUMENTED DO METHODS
# UNDOCUMENTED DO METHODS

def do_EOF(self, line):
# Exit program on ^D (Ctrl+D)
Expand Down