Skip to content

Commit

Permalink
PEP code cleanups in providers.py
Browse files Browse the repository at this point in the history
  • Loading branch information
vdboor committed Mar 17, 2013
1 parent d996f46 commit 700e180
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions micawber/providers.py
Expand Up @@ -3,7 +3,6 @@
import re
import socket
import urllib2
import sys
from urllib import urlencode
try:
import simplejson as json
Expand Down Expand Up @@ -72,6 +71,7 @@ def handle_response(self, response, url):
def make_key(*args, **kwargs):
return hashlib.md5(pickle.dumps((args, kwargs))).hexdigest()


def url_cache(fn):
def inner(self, url, **params):
if self.cache:
Expand All @@ -84,6 +84,7 @@ def inner(self, url, **params):
return fn(self, url, **params)
return inner


class ProviderRegistry(object):
def __init__(self, cache=None):
self._registry = {}
Expand Down Expand Up @@ -114,9 +115,9 @@ def request(self, url, **params):
def bootstrap_basic(cache=None):
# complements of oembed.com#section7
pr = ProviderRegistry(cache)

# b
pr.register('http://blip.tv/\S+', Provider('http://blip.tv/oembed'))
pr.register('http://blip.tv/\S+', Provider('http://blip.tv/oembed'))

# c
pr.register('http://chirb.it/\S+', Provider('http://chirb.it/oembed.json'))
Expand Down

0 comments on commit 700e180

Please sign in to comment.