# Path: opendiamond/server/object_.py
# class Object(EmptyObject):
#     '''A mutable Diamond object.'''
# 
#     def __init__(self, server_id, url, src=None, meta=None, compute_signature=True):
#         EmptyObject.__init__(self)
#         self._id = url
#         self._compute_signature = compute_signature
# 
#         if src:
#             self.src = src
#         if meta:
#             self.meta = meta
# 
#         # Set default attributes
#         self[ATTR_DEVICE_NAME] = server_id + '\0'
#         self[ATTR_OBJ_ID] = url + '\0'
# 
#     def __str__(self):
#         '''Return the object ID.'''
#         return self._id
# 
#     def __repr__(self):
#         return '<Object %s>' % self
# 
#     def __setitem__(self, key, value):
#         self._attrs[key] = value
#         if self._compute_signature:
#             self._signatures[key] = murmur(value)
#         else:
#             self._signatures[key] = 0


from future import standard_library
from builtins import next
from builtins import object
from urllib.parse import urljoin
from xml.sax import make_parser, SAXParseException
from xml.sax.handler import ContentHandler
from opendiamond.server.object_ import Object
import logging
import urllib.request, urllib.error, urllib.parse
import threading
                    buf = fh.read(4096)
                    if not buf:
                        break
                    parser.feed(buf)
                    while self._handler.pending_objects:
                        pending_object = self._handler.pending_objects.pop(0)
                        count += 1
                        yield (pending_object, scope_url)

            except urllib.error.URLError as e:
                _log.warning('Fetching %s: %s', scope_url, e)
            except SAXParseException as e:
                _log.warning('Parsing %s: %s', scope_url, e)
            finally:
                try:
                    parser.close()
                except SAXParseException:
                    # Received malformed XML, such as XML with missing
                    # closing tags.  This is likely caused by a
                    # prematurely-terminated connection.
                    _log.warning('Parsing %s: incomplete scope list',
                                 scope_url)
                parser.reset()
        # Log successful completion
        _log.info('End of scope list (%d)', count)

    def get_count(self):
        '''Return our current understanding of the number of objects in
        scope.'''
        with self._lock:

# Path: opendiamond/server/object_.py
# class Object(EmptyObject):
#     '''A mutable Diamond object.'''
# 
#     def __init__(self, server_id, url, src=None, meta=None, compute_signature=True):
#         EmptyObject.__init__(self)
#         self._id = url
#         self._compute_signature = compute_signature
# 
#         if src:
#             self.src = src
#         if meta:
#             self.meta = meta
# 
#         # Set default attributes
#         self[ATTR_DEVICE_NAME] = server_id + '\0'
#         self[ATTR_OBJ_ID] = url + '\0'
# 
#     def __str__(self):
#         '''Return the object ID.'''
#         return self._id
# 
#     def __repr__(self):
#         return '<Object %s>' % self
# 
#     def __setitem__(self, key, value):
#         self._attrs[key] = value
#         if self._compute_signature:
#             self._signatures[key] = murmur(value)
#         else:
#             self._signatures[key] = 0


# Path: opendiamond/server/scopelist.py
from future import standard_library
from builtins import next
from builtins import object
from urllib.parse import urljoin
from xml.sax import make_parser, SAXParseException
from xml.sax.handler import ContentHandler
from opendiamond.server.object_ import Object
import logging
import urllib.request, urllib.error, urllib.parse
import threading

                    buf = fh.read(4096)
                    if not buf:
                        break
                    parser.feed(buf)
                    while self._handler.pending_objects:
                        pending_object = self._handler.pending_objects.pop(0)
                        count += 1
                        yield (pending_object, scope_url)

            except urllib.error.URLError as e:
                _log.warning('Fetching %s: %s', scope_url, e)
            except SAXParseException as e:
                _log.warning('Parsing %s: %s', scope_url, e)
            finally:
                try:
                    parser.close()
                except SAXParseException:
                    # Received malformed XML, such as XML with missing
                    # closing tags.  This is likely caused by a
                    # prematurely-terminated connection.
                    _log.warning('Parsing %s: incomplete scope list',
                                 scope_url)
                parser.reset()
        # Log successful completion
        _log.info('End of scope list (%d)', count)

    def get_count(self):
        '''Return our current understanding of the number of objects in
        scope.'''
        with self._lock:

            return self._handler.count