Skip to content

Commit

Permalink
[features-] update jsvine plugins to import
Browse files Browse the repository at this point in the history
  • Loading branch information
saulpw committed Oct 26, 2023
1 parent c3d5026 commit 001ec08
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
4 changes: 3 additions & 1 deletion visidata/features/dedupe.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
__version__ = "0.2.0"
__author__ = "Jeremy Singer-Vine <jsvine@gmail.com>"

from visidata import Sheet, BaseSheet, asyncthread, copy, Progress, vd
from copy import copy

from visidata import Sheet, BaseSheet, asyncthread, Progress, vd


def gen_identify_duplicates(sheet):
Expand Down
21 changes: 9 additions & 12 deletions visidata/loaders/fec.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,17 @@
"""

from copy import copy
from visidata import (
vd,
Path,
Sheet,
TextSheet,
joinSheetnames,
Column,
ColumnAttr,
ColumnItem,
ENTER,
asyncthread,
copy,
status,
warning,
Progress,
addGlobals,
)
Expand Down Expand Up @@ -112,21 +109,21 @@ def reload(self):
self.addRow(item)

except Exception as e:
warning("Can't dive on lists with heterogenous item types.")
vd.warning("Can't dive on lists with heterogenous item types.")
return False

def dive(self):
if self.is_keyvalue:
cell = self.cursorRow["value"]
name = joinSheetnames(self.name, self.cursorRow["key"])
name = vd.joinSheetnames(self.name, self.cursorRow["key"])

if isinstance(cell, (list, dict)):
vs = self.__class__(name, source = cell)
else:
warning("Nothing to dive into.")
vd.warning("Nothing to dive into.")
return
else:
name = joinSheetnames(self.name, "row")
name = vd.joinSheetnames(self.name, "row")
vs = self.__class__(name, source = self.cursorRow)

success = vs.reload()
Expand Down Expand Up @@ -165,7 +162,7 @@ def set_columns_from_row(self, row):
self.addColumn(ColumnItem(name))
def dive(self):
vs = DiveSheet(
joinSheetnames(self.name, "detail"),
vd.joinSheetnames(self.name, "detail"),
source = self.cursorRow
)
vs.reload()
Expand Down Expand Up @@ -196,7 +193,7 @@ def reload(self):

for schedule_name in self.source.keys():
vs = FECItemizationSheet(
joinSheetnames(self.name, schedule_name),
vd.joinSheetnames(self.name, schedule_name),
schedule_name = schedule_name,
source = self.source[schedule_name],
size = len(self.source[schedule_name]),
Expand Down Expand Up @@ -250,7 +247,7 @@ def addSheetRow(component_name):
] else dict

vs = cls(
joinSheetnames(self.name, component_name),
vd.joinSheetnames(self.name, component_name),
component_name = component_name,
source = source_cls(),
size = 0,
Expand Down Expand Up @@ -295,7 +292,7 @@ def addSheetRow(component_name):
if form_type not in sheet_row.source:
sheet_row.source[form_type] = [ ]
subsheet = FECItemizationSheet(
joinSheetnames(sheet_row.name, form_type),
vd.joinSheetnames(sheet_row.name, form_type),
schedule_name = form_type,
source = [ ],
size = 0,
Expand Down

0 comments on commit 001ec08

Please sign in to comment.