Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(6)  |  Call(4)  |  Derive(0)  |  Import(2)

src/c/a/cablemap-HEAD/helpers/fix_subjects.py   cablemap(Download)
import codecs
import urllib2
from cablemap.core.reader import parse_subject
 
# Pattern to extract the cable ids from <http://aebr.home.xs4all.nl/wl/*/>
            page = urllib2.urlopen(source_iri).read().decode('utf-8', 'ignore')
            ap_iri = _AP_SOURCE_PATTERN.search(page).group(1)
            subject = parse_subject(page)
            if not subject:
                if cable_id == u'09OSLO399': # This cable is malformed
            source_iri = _RR_IRI + cable_id + '.html'
            page = urllib2.urlopen(source_iri).read().decode('utf-8', 'ignore')
            subject = parse_subject(page)
            if not subject:
                print '-------- ERROR, cannot parse subject of ' + source_iri

src/c/a/cablemap-HEAD/cablemap.core/tests/test_reader_subject.py   cablemap(Download)
import codecs
from nose.tools import eq_
from cablemap.core.reader import parse_subject
from cablemap.core import cable_from_file
 
    def check(content, clean, expected):
        eq_(expected, parse_subject(content, clean=clean))
    for test in _TEST_DATA:
        clean = True
        if len(test) == 3:
    def check(expected, input):
        eq_(expected, parse_subject(input))
    base = os.path.join(os.path.dirname(__file__), _DATA_DIR)
    for name in [name for name in os.listdir(os.path.join(base, 'in')) if name.endswith('.html')]:
        input = cable_from_file(os.path.join(base, 'in', name)).content