/usr/lib/python3/dist-packages/osmium/osm/mutable.py is in python3-pyosmium 2.11.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | class OSMObject(object):
"""Mutable version of ``osmium.osm.OSMObject``. It exposes the following
attributes ``id``, ``version``, ``visible``, ``changeset``, ``timestamp``,
``uid`` and ``tags``. Timestamps may be strings or datetime objects.
Tags can be an osmium.osm.TagList, a dict-like object
or a list of tuples, where each tuple contains a (key value) string pair.
If the ``base`` parameter is given in the constructor, then the object
will be initialised first from the attributes of this base object.
"""
def __init__(self, base=None, id=None, version=None, visible=None, changeset=None,
timestamp=None, uid=None, tags=None):
if base is None:
self.id = id
self.version = version
self.visible = visible
self.changeset = changeset
self.timestamp = timestamp
self.uid = uid
self.tags = tags
else:
self.id = base.id if id is None else id
self.version = base.version if version is None else version
self.visible = base.visible if visible is None else visible
self.changeset = base.changeset if changeset is None else changeset
self.timestamp = base.timestamp if timestamp is None else timestamp
self.uid = base.uid if uid is None else uid
self.tags = base.tags if tags is None else tags
class Node(OSMObject):
"""The mutable version of ``osmium.osm.Node``. It inherits all attributes
from osmium.osm.mutable.OSMObject and adds a `location` attribute. This
may either be an `osmium.osm.Location` or a tuple of lon/lat coordinates.
"""
def __init__(self, base=None, location=None, **attrs):
OSMObject.__init__(self, base=base, **attrs)
if base is None:
self.location = location
else:
self.location = loctation if location is not None else base.location
class Way(OSMObject):
"""The mutable version of ``osmium.osm.Way``. It inherits all attributes
from osmium.osm.mutable.OSMObject and adds a `nodes` attribute. This may
either be and ``osmium.osm.NodeList`` or a list consisting of
``osmium.osm.NodeRef`` or simple node ids.
"""
def __init__(self, base=None, nodes=None, **attrs):
OSMObject.__init__(self, base=base, **attrs)
if base is None:
self.nodes = nodes
else:
self.nodes = nodes if nodes is not None else base.nodes
class Relation(OSMObject):
"""The mutable version of ``osmium.osm.Relation``. It inherits all attributes
from osmium.osm.mutable.OSMObject and adds a `members` attribute. This
may either be an ``osmium.osm.RelationMemberList`` or a list consisting
of ``osmium.osm.RelationMember`` or tuples of (type, id, role). The
member type should be a single character 'n', 'w' or 'r'.
"""
def __init__(self, base=None, members=None, **attrs):
OSMObject.__init__(self, base=base, **attrs)
if base is None:
self.members = members
else:
self.members = members if members is not None else base.members
|