Permalink
Browse files

exmaples: python: unbreak doctests

  • Loading branch information...
SaveTheRbtz committed Dec 9, 2012
1 parent 0191e95 commit 121625e3d7388467efe26b19f52affdf6d1945e9
Showing with 10 additions and 6 deletions.
  1. +10 −6 examples/python_example.py
View
@@ -11,8 +11,9 @@ def __init__(self, host='localhost', port=8125):
def timing(self, stat, time, sample_rate=1):
"""
Log timing information
- >>> from python_example import Statsd
- >>> Statsd.timing('some.time', 500)
+ >>> from python_example import StatsdClient
+ >>> client = StatsdClient()
+ >>> client.timing('some.time', 500)
"""
stats = {}
stats[stat] = "%d|ms" % time
@@ -21,22 +22,25 @@ def timing(self, stat, time, sample_rate=1):
def increment(self, stats, sample_rate=1):
"""
Increments one or more stats counters
- >>> Statsd.increment('some.int')
- >>> Statsd.increment('some.int',0.5)
+ >>> client = StatsdClient()
+ >>> client.increment('some.int')
+ >>> client.increment('some.int',0.5)
"""
self.update_stats(stats, 1, sample_rate)
def decrement(self, stats, sample_rate=1):
"""
Decrements one or more stats counters
- >>> Statsd.decrement('some.int')
+ >>> client = StatsdClient()
+ >>> client.decrement('some.int')
"""
self.update_stats(stats, -1, sample_rate)
def update_stats(self, stats, delta=1, sampleRate=1):
"""
Updates one or more stats counters by arbitrary amounts
- >>> Statsd.update_stats('some.int',10)
+ >>> client = StatsdClient()
+ >>> client.update_stats('some.int',10)
"""
if isinstance(stats, list):
stats = [stats]

0 comments on commit 121625e

Please sign in to comment.