• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

geopython / OWSLib / 3663701074

pending completion
3663701074

Pull #851

github

GitHub
Merge 6cd54d613 into 13b1443f7
Pull Request #851: Adding Python 3.10 in CI

7461 of 12701 relevant lines covered (58.74%)

0.59 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

65.22
/owslib/etree.py
1
# =============================================================================
2
# OWSLib. Copyright (C) 2005 Sean C. Gillies
3
#
4
# Contact email: sgillies@frii.com
5
# =============================================================================
6

7
from owslib.namespaces import Namespaces
1✔
8

9

10
def patch_well_known_namespaces(etree_module):
1✔
11
    """Monkey patches the etree module to add some well-known namespaces."""
12

13
    ns = Namespaces()
1✔
14

15
    try:
1✔
16
        register_namespace = etree_module.register_namespace
1✔
17
    except AttributeError:
×
18
        etree_module._namespace_map
×
19

20
        def register_namespace(prefix, uri):
×
21
            etree_module._namespace_map[uri] = prefix
×
22

23
    for k, v in list(ns.get_namespaces().items()):
1✔
24
        register_namespace(k, v)
1✔
25

26

27
# try to find lxml or elementtree
28
try:
1✔
29
    from lxml import etree
1✔
30
    from lxml.etree import ParseError
×
31
    ElementType = etree._Element
×
32
except ImportError:
1✔
33
    import xml.etree.ElementTree as etree
1✔
34
    ElementType = etree.Element
1✔
35
    try:
1✔
36
        from xml.etree.ElementTree import ParseError
1✔
37
    except ImportError:
×
38
        from xml.parsers.expat import ExpatError as ParseError
×
39

40
patch_well_known_namespaces(etree)
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc