8000 Fixes for new Sphinx formatting (for example latest Django docs) by avkoval · Pull Request #35 · tsgates/pylookup · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fixes for new Sphinx formatting (for example latest Django docs) #35

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension 8000

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 23 additions & 12 deletions pylookup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,7 @@
from os.path import join, dirname, exists, abspath, expanduser
from contextlib import closing

if sys.version_info[0] == 3:
import html.parser as htmllib
import urllib.parse as urlparse
import urllib.request as urllib
else:
import htmllib, urllib, urlparse
import htmllib, urllib, urlparse

VERBOSE = False
FORMATS = {
Expand Down Expand Up @@ -140,13 +135,29 @@ def __init__( self, writer, dirn):
def start_dd( self, att ):
self.list_entry = True

def start_ul( self, att ):
self.list_entry = True

def end_dd( self ):
self.list_entry = False

def start_li( self, att ):
def end_ul( self ):
self.list_entry = False

def start_dt( self, att ):
self.one_entry = True
self.num_of_a = 0

def start_li( self, att ):
self.one_entry = True
self.num_of_a = 0

def end_dt( self ):
self.do_entry = False

def end_li( self ):
self.do_entry = False

def start_a(self, att):
if self.one_entry:
self.url = join(self.dirn, dict(att)['href'])
Expand Down Expand Up @@ -220,8 +231,8 @@ def update(db, urls, append=False):
success = False
for index_url in potential_urls:
try:
print "Wait for a few seconds..."
print "Fetching index from '%s'" % index_url
print("Wait for a few seconds...")
print("Fetching index from '%s'" % index_url)

index = urllib.urlopen(index_url).read()
if not issubclass(type(index), str):
Expand All @@ -232,14 +243,14 @@ def update(db, urls, append=False):
parser.feed(index)

# success, we don't need to try other potential urls
print "Loaded index from '%s'" % index_url
print("Loaded index from '%s'" % index_url)
success = True
break
except IOError:
print "Error: fetching file from '%s'" % index_url
print("Error: fetching file from '%s'" % index_url)

if not success:
print "Failed to load index for input '%s'" % url
print("Failed to load index for input '%s'" % url)


def lookup(db, key, format_spec, out=sys.stdout, insensitive=True, desc=True):
Expand Down
0