Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
fastkml
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Aurélien Vermylen
fastkml
Commits
4d87a601
Commit
4d87a601
authored
Apr 29, 2016
by
heltonbiker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed "NS" to "KMLNS" for legibility
parent
c682997d
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
14 deletions
+14
-14
fastkml/atom.py
fastkml/atom.py
+3
-3
fastkml/base.py
fastkml/base.py
+2
-2
fastkml/config.py
fastkml/config.py
+2
-2
fastkml/kml.py
fastkml/kml.py
+1
-1
fastkml/test_main.py
fastkml/test_main.py
+6
-6
No files found.
fastkml/atom.py
View file @
4d87a601
...
@@ -36,7 +36,7 @@ import logging
...
@@ -36,7 +36,7 @@ import logging
logger
=
logging
.
getLogger
(
'fastkml.atom'
)
logger
=
logging
.
getLogger
(
'fastkml.atom'
)
from
.config
import
etree
from
.config
import
etree
from
.config
import
ATOMNS
as
NS
from
.config
import
ATOMNS
from
.config
import
LXML
from
.config
import
LXML
import
re
import
re
...
@@ -88,7 +88,7 @@ class Link(object):
...
@@ -88,7 +88,7 @@ class Link(object):
hreflang
=
None
,
title
=
None
,
length
=
None
hreflang
=
None
,
title
=
None
,
length
=
None
):
):
if
ns
is
None
:
if
ns
is
None
:
self
.
ns
=
NS
self
.
ns
=
ATOM
NS
else
:
else
:
self
.
ns
=
ns
self
.
ns
=
ns
self
.
href
=
href
self
.
href
=
href
...
@@ -172,7 +172,7 @@ class _Person(object):
...
@@ -172,7 +172,7 @@ class _Person(object):
def
__init__
(
self
,
ns
=
None
,
name
=
None
,
uri
=
None
,
email
=
None
):
def
__init__
(
self
,
ns
=
None
,
name
=
None
,
uri
=
None
,
email
=
None
):
if
ns
is
None
:
if
ns
is
None
:
self
.
ns
=
NS
self
.
ns
=
ATOM
NS
else
:
else
:
self
.
ns
=
ns
self
.
ns
=
ns
self
.
name
=
name
self
.
name
=
name
...
...
fastkml/base.py
View file @
4d87a601
...
@@ -29,7 +29,7 @@ class _XMLObject(object):
...
@@ -29,7 +29,7 @@ class _XMLObject(object):
def
__init__
(
self
,
ns
=
None
):
def
__init__
(
self
,
ns
=
None
):
if
ns
is
None
:
if
ns
is
None
:
self
.
ns
=
config
.
NS
self
.
ns
=
config
.
KML
NS
else
:
else
:
self
.
ns
=
ns
self
.
ns
=
ns
...
@@ -78,7 +78,7 @@ class _BaseObject(_XMLObject):
...
@@ -78,7 +78,7 @@ class _BaseObject(_XMLObject):
super
(
_BaseObject
,
self
).
__init__
(
ns
)
super
(
_BaseObject
,
self
).
__init__
(
ns
)
self
.
id
=
id
self
.
id
=
id
if
ns
is
None
:
if
ns
is
None
:
self
.
ns
=
config
.
NS
self
.
ns
=
config
.
KML
NS
else
:
else
:
self
.
ns
=
ns
self
.
ns
=
ns
...
...
fastkml/config.py
View file @
4d87a601
...
@@ -29,12 +29,12 @@ except ImportError:
...
@@ -29,12 +29,12 @@ except ImportError:
LXML
=
False
LXML
=
False
NS
=
'{http://www.opengis.net/kml/2.2}'
KML
NS
=
'{http://www.opengis.net/kml/2.2}'
ATOMNS
=
'{http://www.w3.org/2005/Atom}'
ATOMNS
=
'{http://www.w3.org/2005/Atom}'
GXNS
=
'{http://www.google.com/kml/ext/2.2}'
GXNS
=
'{http://www.google.com/kml/ext/2.2}'
if
hasattr
(
etree
,
'register_namespace'
):
if
hasattr
(
etree
,
'register_namespace'
):
etree
.
register_namespace
(
'kml'
,
NS
[
1
:
-
1
])
etree
.
register_namespace
(
'kml'
,
KML
NS
[
1
:
-
1
])
etree
.
register_namespace
(
'atom'
,
ATOMNS
[
1
:
-
1
])
etree
.
register_namespace
(
'atom'
,
ATOMNS
[
1
:
-
1
])
etree
.
register_namespace
(
'gx'
,
GXNS
[
1
:
-
1
])
etree
.
register_namespace
(
'gx'
,
GXNS
[
1
:
-
1
])
...
...
fastkml/kml.py
View file @
4d87a601
...
@@ -79,7 +79,7 @@ class KML(object):
...
@@ -79,7 +79,7 @@ class KML(object):
self
.
_features
=
[]
self
.
_features
=
[]
if
ns
is
None
:
if
ns
is
None
:
self
.
ns
=
config
.
NS
self
.
ns
=
config
.
KML
NS
else
:
else
:
self
.
ns
=
ns
self
.
ns
=
ns
...
...
fastkml/test_main.py
View file @
4d87a601
...
@@ -45,7 +45,7 @@ class BaseClassesTestCase(unittest.TestCase):
...
@@ -45,7 +45,7 @@ class BaseClassesTestCase(unittest.TestCase):
def
test_base_object
(
self
):
def
test_base_object
(
self
):
bo
=
base
.
_BaseObject
(
id
=
'id0'
)
bo
=
base
.
_BaseObject
(
id
=
'id0'
)
self
.
assertEqual
(
bo
.
id
,
'id0'
)
self
.
assertEqual
(
bo
.
id
,
'id0'
)
self
.
assertEqual
(
bo
.
ns
,
config
.
NS
)
self
.
assertEqual
(
bo
.
ns
,
config
.
KML
NS
)
self
.
assertEqual
(
bo
.
targetId
,
None
)
self
.
assertEqual
(
bo
.
targetId
,
None
)
self
.
assertEqual
(
bo
.
__name__
,
None
)
self
.
assertEqual
(
bo
.
__name__
,
None
)
bo
.
targetId
=
'target'
bo
.
targetId
=
'target'
...
@@ -55,17 +55,17 @@ class BaseClassesTestCase(unittest.TestCase):
...
@@ -55,17 +55,17 @@ class BaseClassesTestCase(unittest.TestCase):
self
.
assertEqual
(
bo
.
id
,
None
)
self
.
assertEqual
(
bo
.
id
,
None
)
self
.
assertEqual
(
bo
.
ns
,
''
)
self
.
assertEqual
(
bo
.
ns
,
''
)
self
.
assertRaises
(
NotImplementedError
,
bo
.
etree_element
)
self
.
assertRaises
(
NotImplementedError
,
bo
.
etree_element
)
element
=
etree
.
Element
(
config
.
NS
+
'Base'
)
element
=
etree
.
Element
(
config
.
KML
NS
+
'Base'
)
self
.
assertRaises
(
TypeError
,
bo
.
from_element
)
self
.
assertRaises
(
TypeError
,
bo
.
from_element
)
self
.
assertRaises
(
TypeError
,
bo
.
from_element
,
element
)
self
.
assertRaises
(
TypeError
,
bo
.
from_element
,
element
)
bo
.
__name__
=
'NotABaseObject'
bo
.
__name__
=
'NotABaseObject'
self
.
assertRaises
(
TypeError
,
bo
.
from_element
,
element
)
self
.
assertRaises
(
TypeError
,
bo
.
from_element
,
element
)
# Note that we can coax baseclasses not to throw errors
# Note that we can coax baseclasses not to throw errors
bo
.
__name__
=
'Base'
bo
.
__name__
=
'Base'
bo
.
ns
=
config
.
NS
bo
.
ns
=
config
.
KML
NS
bo
.
from_element
(
element
)
bo
.
from_element
(
element
)
self
.
assertEqual
(
bo
.
id
,
None
)
self
.
assertEqual
(
bo
.
id
,
None
)
self
.
assertEqual
(
bo
.
ns
,
config
.
NS
)
self
.
assertEqual
(
bo
.
ns
,
config
.
KML
NS
)
self
.
assertFalse
(
bo
.
etree_element
(),
None
)
self
.
assertFalse
(
bo
.
etree_element
(),
None
)
self
.
assertTrue
(
len
(
bo
.
to_string
())
>
1
)
self
.
assertTrue
(
len
(
bo
.
to_string
())
>
1
)
...
@@ -808,7 +808,7 @@ class KmlFromStringTestCase(unittest.TestCase):
...
@@ -808,7 +808,7 @@ class KmlFromStringTestCase(unittest.TestCase):
k
.
from_string
(
doc1
)
k
.
from_string
(
doc1
)
d
=
list
(
k
.
features
())[
0
]
d
=
list
(
k
.
features
())[
0
]
s2
=
list
(
d
.
schemata
())[
0
]
s2
=
list
(
d
.
schemata
())[
0
]
s
.
ns
=
config
.
NS
s
.
ns
=
config
.
KML
NS
self
.
assertEqual
(
s
.
to_string
(),
s2
.
to_string
())
self
.
assertEqual
(
s
.
to_string
(),
s2
.
to_string
())
k1
=
kml
.
KML
()
k1
=
kml
.
KML
()
k1
.
from_string
(
k
.
to_string
())
k1
.
from_string
(
k
.
to_string
())
...
@@ -948,7 +948,7 @@ class StyleTestCase(unittest.TestCase):
...
@@ -948,7 +948,7 @@ class StyleTestCase(unittest.TestCase):
f
.
styleUrl
=
'#somestyle'
f
.
styleUrl
=
'#somestyle'
self
.
assertEqual
(
f
.
styleUrl
,
'#somestyle'
)
self
.
assertEqual
(
f
.
styleUrl
,
'#somestyle'
)
self
.
assertTrue
(
isinstance
(
f
.
_styleUrl
,
styles
.
StyleUrl
))
self
.
assertTrue
(
isinstance
(
f
.
_styleUrl
,
styles
.
StyleUrl
))
s
=
styles
.
StyleUrl
(
config
.
NS
,
url
=
'#otherstyle'
)
s
=
styles
.
StyleUrl
(
config
.
KML
NS
,
url
=
'#otherstyle'
)
f
.
styleUrl
=
s
f
.
styleUrl
=
s
self
.
assertTrue
(
isinstance
(
f
.
_styleUrl
,
styles
.
StyleUrl
))
self
.
assertTrue
(
isinstance
(
f
.
_styleUrl
,
styles
.
StyleUrl
))
self
.
assertEqual
(
f
.
styleUrl
,
'#otherstyle'
)
self
.
assertEqual
(
f
.
styleUrl
,
'#otherstyle'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment