MCPcopy Create free account
hub / github.com/internetarchive/openlibrary / Series

Class Series

openlibrary/plugins/admin/graphs.py:53–76  ·  view source on GitHub ↗

One series in the GraphiteGraph.

Source from the content-addressed store, hash-verified

51
52
53class Series:
54 """One series in the GraphiteGraph."""
55
56 def __init__(self, name):
57 self.name = name
58
59 def apply(self, funcname, *args):
60 """Applies a function to this series.
61
62 :return: Returns self
63 """
64 self.name = "{}({}, {})".format(funcname, self.name, ", ".join(repr(a) for a in args))
65 return self
66
67 def alias(self, name):
68 """Shorthand for calling s.apply("alias", name)"""
69 return self.apply("alias", name)
70
71 def __repr__(self):
72 return "<series: %r>" % self.name
73
74 def __str__(self):
75 # Returning empty string to allow template use $g.add("foo") without printing anything.
76 return ""
77
78
79def setup():

Callers 1

addMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected