Did I find the right examples for you? yes no

All Samples(48)  |  Call(42)  |  Derive(0)  |  Import(6)
A helper to run xpath with the proper namespaces for the Washington
Legislative API.

        def xpath(elem, path):
    """
    A helper to run xpath with the proper namespaces for the Washington
    Legislative API.
    """
    return elem.xpath(path, namespaces=NS)
        


src/o/p/openstates-HEAD/openstates/wa/bills.py   openstates(Download)
 
from .actions import Categorizer, committees_abbrs
from .utils import xpath
from billy.scrape.bills import BillScraper, Bill
from billy.scrape.votes import Vote
                continue  # future years.
 
            for leg_info in xpath(page, "//wa:LegislationInfo"):
                bill_id = xpath(leg_info, "string(wa:BillId)")
                bill_num = int(bill_id.split()[1])
        page = self.urlopen(url)
        page = lxml.etree.fromstring(page.bytes)
        page = xpath(page, "//wa:Legislation")[0]
 
        title = xpath(page, "string(wa:LongDescription)")

src/o/p/openstates-HEAD/openstates/wa/legislators.py   openstates(Download)
from .utils import xpath
from billy.scrape.legislators import LegislatorScraper, Legislator
 
import scrapelib
import lxml.html
        page = lxml.etree.fromstring(page.bytes)
 
        for member in xpath(page, "//wa:Member"):
 
            mchamber = xpath(member, "string(wa:Agency)")
                continue
 
            party = xpath(member, "string(wa:Party)")
            party = {'R': 'Republican', 'D': 'Democratic'}.get(
                party, party)
 
            district = xpath(member, "string(wa:District)")

src/o/p/openstates-HEAD/openstates/wa/committees.py   openstates(Download)
from .utils import xpath
from billy.scrape.committees import CommitteeScraper, Committee
 
import lxml.etree
 
        page = lxml.etree.fromstring(page.bytes)
 
        for comm in xpath(page, "//wa:Committee"):
            agency = xpath(comm, "string(wa:Agency)")
            comm_chamber = {'House': 'lower', 'Senate': 'upper'}[agency]
            if comm_chamber != chamber:
                continue
 
            name = xpath(comm, "string(wa:Name)")
            comm_id = xpath(comm, "string(wa:Id)")

src/i/n/indivo_server-HEAD/indivo/tests/integration/test_modules/sharing.py   indivo_server(Download)
import data
 
from utils import assert_403, assert_404, assert_200, parse_xml, xpath
 
PRD = 'prd'
 
    # post four documents to Alice's record, 2 allergies and 2 immunizations
    document_1_id = xpath(parse_xml(alice_chrome_client.post_document(data=data.allergy)), "/Document/@id")[0]
    document_2_id = xpath(parse_xml(alice_chrome_client.post_document(data=data.allergy)), "/Document/@id")[0]
    document_3_id = xpath(parse_xml(alice_chrome_client.post_document(data=data.immunization)), "/Document/@id")[0]
    document_4_id = xpath(parse_xml(alice_chrome_client.post_document(data=data.immunization)), "/Document/@id")[0]

src/i/n/indivo_server-HEAD/indivo/tests/integration/test_modules/special_document_handling.py   indivo_server(Download)
import os
import data
 
from utils import parse_xml, xpath
 
 
    # make sure the label of the record was updated
    record_label = xpath(record_doc,'/Record/@label')[0]
    #TODO: update below to work with new smart demographics
#    contact_fullname = xpath(parse_xml(data.contact02), '/ns:Contact/ns:name/ns:fullName/text()', namespaces={'ns':'http://indivo.org/vocab/xml/documents#'})[0]

src/i/n/indivo_server-HEAD/indivo/tests/integration/test_modules/accounting.py   indivo_server(Download)
from xml.etree import ElementTree
 
from utils import parse_xml, xpath, assert_403, assert_200
 
def test_account(IndivoClient):