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

[import] add imports for aggregators, canvas, cmdlog #2045

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions visidata/aggregators.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import collections
import statistics

from visidata import vd, Progress, Column, vlen
from visidata import *
from visidata import Progress, Sheet, Column, ColumnsSheet, VisiData
from visidata import vd, anytype, vlen, asyncthread, wrapply


vd.option('null_value', None, 'a value to be counted as null', replay=True)
Expand Down
3 changes: 2 additions & 1 deletion visidata/canvas.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
import random

from collections import defaultdict, Counter, OrderedDict
from visidata import *
from visidata import vd, asyncthread, ENTER, colors, update_attr, clipdraw, dispwidth
from visidata import BaseSheet, Column, Progress, ColorAttr
from visidata.bezier import bezier

# see www/design/graphics.md
Expand Down
15 changes: 8 additions & 7 deletions visidata/cmdlog.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import threading

from visidata import *
from visidata import vd, UNLOADED, namedlist, vlen, asyncthread, globalCommand, date
from visidata import VisiData, BaseSheet, Sheet, ColumnAttr, VisiDataMetaSheet, JsonLinesSheet, TypedWrapper, AttrDict, Progress, OptionsSheet, ErrorSheet, CompleteKey, Path
import visidata

vd.option('replay_wait', 0.0, 'time to wait between replayed commands, in seconds', sheettype=None)
Expand Down Expand Up @@ -74,7 +75,7 @@ def indexMatch(L, func):
return i

def keystr(k):
return options.rowkey_prefix+','.join(map(str, k))
return vd.options.rowkey_prefix+','.join(map(str, k))

@VisiData.api
def isLoggableCommand(vd, longname):
Expand Down Expand Up @@ -218,11 +219,11 @@ def afterExecSheet(self, sheet, escaped, err):
if isLoggableSheet(sheet): # don't record actions from cmdlog or other internal sheets on global cmdlog
self.addRow(vd.activeCommand) # add to global cmdlog
sheet.cmdlog_sheet.addRow(vd.activeCommand) # add to sheet-specific cmdlog
if options.cmdlog_histfile:
name = date().strftime(options.cmdlog_histfile)
if vd.options.cmdlog_histfile:
name = date().strftime(vd.options.cmdlog_histfile)
p = Path(name)
if not p.is_absolute():
p = Path(options.visidata_dir)/f'{name}.jsonl'
p = Path(sheet.options.visidata_dir)/f'{name}.jsonl'
if not getattr(vd, 'sessionlog', None):
vd.sessionlog = vd.loadInternalSheet(CommandLog, p)
vd.sessionlog.append_tsv_row(vd.activeCommand)
Expand Down Expand Up @@ -301,7 +302,7 @@ def moveToReplayContext(vd, r, vs):
@VisiData.api
def delay(vd, factor=1):
'returns True if delay satisfied'
acquired = vd.semaphore.acquire(timeout=options.replay_wait*factor if not vd.paused else None)
acquired = vd.semaphore.acquire(timeout=vd.options.replay_wait*factor if not vd.paused else None)
return acquired or not vd.paused


Expand Down Expand Up @@ -427,7 +428,7 @@ def setLastArgs(vd, args):

@VisiData.property
def replayStatus(vd):
x = options.disp_replay_pause if vd.paused else options.disp_replay_play
x = vd.options.disp_replay_pause if vd.paused else vd.options.disp_replay_play
return ' │ %s %s/%s' % (x, vd.currentReplay.cursorRowIndex, len(vd.currentReplay.rows))


Expand Down
3 changes: 2 additions & 1 deletion visidata/features/freeze.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from visidata import *
import collections
from visidata import Column, Sheet, VisiData, ColumnItem, Progress, TypedExceptionWrapper, SettableColumn
from visidata import asyncthread, vd


@Column.api
Expand Down
4 changes: 2 additions & 2 deletions visidata/features/melt.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import re
from copy import copy

from visidata import *

from visidata import Sheet, SubColumnItem, ColumnItem, Column, Progress
from visidata import asyncthread, vd

melt_var_colname = 'Variable' # column name to use for the melted variable name
melt_value_colname = 'Value' # column name to use for the melted value
Expand Down
4 changes: 3 additions & 1 deletion visidata/graph.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from visidata import *
import math

from visidata import VisiData, Canvas, Sheet, Progress, BoundingBox, Point
from visidata import vd, asyncthread, dispwidth, colors, clipstr

vd.option('color_graph_axis', 'bold', 'color for graph axis labels')
vd.option('disp_graph_tick_x', '╵', 'character for graph x-axis ticks')

Expand Down