Skip to content

Commit

Permalink
improved docstrings.
Browse files Browse the repository at this point in the history
  • Loading branch information
mhahsler committed Jun 23, 2023
1 parent d6f63b8 commit b9563f9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
2 changes: 2 additions & 0 deletions src/arulespy/arules.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,5 +350,7 @@ def from_df(x, itemLabels = None):
eclat.__doc__ = R_arules.eclat.__doc__

def concat(list):
"""Combining Association and Transaction Objects"""

conc = methods.selectMethod("c", tuple(list[0].rclass)[0])
return arules2py(conc(*list))
19 changes: 14 additions & 5 deletions src/arulespy/arulesViz.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""The arules module provides an interface to R's arules package."""

import rpy2.robjects.packages as packages
from arulespy.arules import arules2py_decor

### activate automatic conversion of pandas dataframes to R dataframes
#pandas2ri.activate()
Expand All @@ -9,14 +10,22 @@

# get the generic for plot
base = packages.importr('base')
plot = base.plot
#plot.__doc__ = R_arulesViz.plot.__doc__
plot = arules2py_decor(base.plot)
# we use the decorator so we can set docstrings, otherwise it would only show
# the docstring for the plot generic.
plot.__doc__ = """Visualize Association Rules and Itemsets
plot(x, method = NULL, measure = "support", shading = "lift", limit = NULL,
interactive = NULL, engine = "default", data = NULL, control = NULL, ...)
For details see https://mhahsler.r-universe.dev/arulesViz/doc/manual.html#plot
"""

### FIXME: Not quite sure why I cannot set __doc__ here
inspectDT = R_arulesViz.inspectDT
#inspectDT.__doc__ = R_arulesViz.inspectDT.__doc__
# gets doc automatically inspectDT.__doc__ = R_arulesViz.inspectDT.__doc__

def ruleExplorer(x, sidebarWidth = 2, graphHeight = '600px'):
app = R_arulesViz.ruleExplorer(x, sidebarWidth = sidebarWidth, graphHeight = graphHeight)
print(app)
#ruleExplorer.__doc__ = R_arulesViz.ruleExplorer.__doc__
ruleExplorer.__doc__ = R_arulesViz.ruleExplorer.__doc__

0 comments on commit b9563f9

Please sign in to comment.