Beispiel #1
0
 def __init__(self, item):
     self.dh = item
     self.search_item = self.dh.id
     self.fh = open(self.dh.fn, 'w')
     self.founditem = self.itemfound = False
     self.dontwrite = False
     XMLGenerator.__init__(self, self.fh)
Beispiel #2
0
    def __init__(self, out, enc, reader):
        XMLGenerator.__init__(self, GetFile(out, "w"), enc)
        self.reader = reader

        self.num_read_nodes = 0
        self.num_read_ways = 0
        self.num_read_relations = 0
Beispiel #3
0
    def __init__(self, encodingError, content):
        '''
        Construct the XML object renderer.
        
        @param encodingError: string
            The encoding error resolving.
        @param content: Content
            The content to render in.
        '''
        assert isinstance(content, Content), 'Invalid content %s' % content
        assert isinstance(content.charSet,
                          str), 'Invalid content char set %s' % content.charSet

        self._outb = BytesIO()
        XMLGenerator.__init__(self,
                              out=getwriter(content.charSet)(self._outb,
                                                             encodingError),
                              encoding=content.charSet,
                              short_empty_elements=True)

        self._content = content
        self._stack = deque()

        self._adjust = True
        self._block = False
        self._pendingStart = None
        self._indexes = []
Beispiel #4
0
 def __init__(self, item):
     self.sh = item
     self.search_item = self.sh.id
     self.tekstrefs = self.sh.tekstrefs
     self.fh = open(self.sh._fn, 'w')
     self.founditem = self.itemfound = False
     XMLGenerator.__init__(self, self.fh, encoding='utf-8')
 def __init__(self, destination, encoding):
     XMLGenerator.__init__(self, destination, encoding)
     # The following was added as a hack to address an upstream issue which
     # has been present in beatbox-20.x, for the past three years.
     # https://github.com/ebottabi/salesforce-beatbox/issues/14
     # https://code.google.com/archive/p/salesforce-beatbox/issues/14
     self._out = destination
Beispiel #6
0
 def __init__(self,
              elems,
              attributes,
              values,
              index,
              sourceElems=[],
              sourceAttributes=[],
              sourceValues=[],
              targetElems=[],
              targetAttributes=[],
              targetValues=[]):
     if not sourceElems:
         sourceElems = []
     if not sourceAttributes:
         sourceAttributes = []
     if not sourceValues:
         sourceValues = []
     if not targetElems:
         targetElems = []
     if not targetAttributes:
         targetAttributes = []
     if not targetValues:
         targetValues = []
     if not index:
         index = 0
     StreamRewriterBase.__init__(self, elems, attributes, values, index,
                                 sourceElems, sourceAttributes,
                                 sourceValues, targetElems,
                                 targetAttributes, targetValues)
     XMLGenerator.__init__(self, self.buffer, 'UTF-8')
Beispiel #7
0
 def __init__(self, item):
     self.dh = item
     self.zoek_hst = self.dh.hst
     self.vlgnrhst = 0
     self.fh = open(self.dh.fn, 'w')
     self.founditem = self.itemfound = False
     XMLGenerator.__init__(self, self.fh)
Beispiel #8
0
    def __init__(self, out, enc, reader):
        XMLGenerator.__init__(self, GetFile(out, "w"), enc)
        self.reader = reader

        self.num_read_nodes = 0
        self.num_read_ways = 0
        self.num_read_relations = 0
Beispiel #9
0
 def __init__(self, item):
     self.ah = item
     self.search_item = self.ah.Id
     self._out = open(self.ah.fn, 'w')
     self.founditem = 0
     self.itemfound = 0
     XMLGenerator.__init__(self, self._out)
Beispiel #10
0
 def __init__(self, out = sys.stdout, encoding = "utf-8", indent = "", addindent = "", newl = ""):
     XMLGenerator.__init__(self, out, encoding)
     # XMLGenerator does not export _write()
     self.write = self.ignorableWhitespace
     self.indents = [indent]
     self.addindent = addindent
     self.newl = newl
Beispiel #11
0
 def __init__(self, break_into=None, break_after=1000, out=None, *args, **kwargs):
     XMLGenerator.__init__(self, out, encoding='utf-8', *args, **kwargs)
     self.out_file = out
     self.break_into = break_into
     self.break_after = break_after
     self.context = []
     self.count = 0
Beispiel #12
0
    def __init__(self, **kwds):
        self.elems = 'elems' in kwds and kwds['elems'] or []
        self.attributes = 'attributes' in kwds and kwds['attributes'] or []
        self.values = 'values' in kwds and kwds['values'] or []
        self.sourceElems = 'sourceElems' in kwds and kwds['sourceElems'] or []
        self.sourceAttributes = 'sourceAttributes' in kwds and kwds[
            'sourceAttributes'] or []
        self.sourceValues = 'sourceValues' in kwds and kwds[
            'sourceValues'] or []
        self.targetElems = 'targetElems' in kwds and kwds['targetElems'] or []
        self.targetAttributes = 'targetAttributes' in kwds and kwds[
            'targetAttributes'] or []
        self.targetValues = 'targetValues' in kwds and kwds[
            'targetValues'] or []

        self.deleteElems = 'deleteElems' in kwds and kwds['deleteElems'] or []
        self.deleteAttributes = 'deleteAttributes' in kwds and kwds[
            'deleteAttributes'] or []

        self.src_dirs = 'src_dirs' in kwds and kwds['src_dirs'] or []
        self.output_dir = 'output_dir' in kwds and kwds['output_dir'] or None

        self.buffer = io.StringIO()

        XMLGenerator.__init__(self, self.buffer, 'UTF-8')
Beispiel #13
0
 def __init__(self, break_into=None, break_after=1000, out=None, *args, **kwargs):
     XMLGenerator.__init__(self, out, *args, **kwargs)
     self.out_file = out
     self.break_into = break_into
     self.break_after = break_after
     self.context = []
     self.count = 0
 def __init__(self, out, encoding='UTF-8'):
     # note: we have UTF-8 as default, base class has iso-8859-1
     if out is not None and not hasattr(out, 'write'):
         # None is OK (will become stdout by XMLGenerator.__init__)
         # file-like is also OK
         # for everything else (filename?), we try to open it first:
         out = open(out, 'w')
     XMLGenerator.__init__(self, out, encoding)
Beispiel #15
0
 def __init__(self, out=None, encoding="utf-8",
              short_empty_elements=False):
     XMLGenerator.__init__(self, out, encoding)
     self._short_empty_elements = short_empty_elements
     self._pending_start_element = False
     if getattr(self, "_out", None) is None:
         # Python 3.2 removed this for no apparent reason.
         self._out = out
Beispiel #16
0
 def __init__(self, dh):
     self.search_user = dh.user
     #~ self.search_id = id
     #~ self.search_item = naam
     self.fh = open(dh.fn, 'w')
     self.founditem = False
     self.in_cat = False
     self.cats = dh.categorieen
     XMLGenerator.__init__(self, self.fh)
Beispiel #17
0
 def __init__(self, doe, dh):
     self.zoek_naam = dh.naam
     if doe not in ("add", "del", "chg"):
         raise OptionError(doe)
     self.doe = doe
     self.data = dh.pw
     self.fh = open(dh.fn, 'w')
     self.itemfound = False
     XMLGenerator.__init__(self, self.fh)
Beispiel #18
0
 def __init__(self, user):
     self.uh = user
     self.search_item = self.uh.userid
     self._out = open(self.uh.fn, 'w')
     self.founditem = False
     self.itemfound = False
     XMLGenerator.__init__(self, self._out)
     self.utype = 'usr'
     self.blck = 'N'
     self.start = 'start'
Beispiel #19
0
 def __init__(self, root, out, encoding='UTF-8', acceptAttributes=True, acceptUnknownTags=True,
              shortEmptyElements=True):
     '''
     @param out: file object with write
         The file object to write the updated xml, needs to have a 'write' method that accepts text.
         
     @see: Digester.__init__
     @see: XMLGenerator.__init__
     '''
     XMLGenerator.__init__(self, out, encoding, shortEmptyElements)
     Digester.__init__(self, root, acceptAttributes, acceptUnknownTags)
Beispiel #20
0
 def __init__(self, item):
     self.dh = item
     self.search_item = self.dh.id
     self.titel = self.dh.titel
     self.url = self.dh.url
     self.cat = str(self.dh.cat)
     self.trefwoorden = self.dh.trefwoorden
     self.fh = open(self.dh._fn, 'w')
     self.founditem = self.itemfound = False
     self.laatste = 0
     XMLGenerator.__init__(self, self.fh)
Beispiel #21
0
 def __init__(self, root, out, encoding='UTF-8', acceptAttributes=True, acceptUnknownTags=True,
              shortEmptyElements=True):
     '''
     @param out: file object with write
         The file object to write the updated xml, needs to have a 'write' method that accepts text.
         
     @see: Digester.__init__
     @see: XMLGenerator.__init__
     '''
     XMLGenerator.__init__(self, out, encoding, shortEmptyElements)
     Digester.__init__(self, root, acceptAttributes, acceptUnknownTags)
Beispiel #22
0
 def __init__(self,
              indent='  ',
              newline='\n',
              out=None,
              encoding="iso-8859-1"):
     self.indent = indent
     self.newline = newline
     self.indents = [newline]  # stack of indents for the tag levels
     # remember type of last element seen (start, end, characters)
     self.last = 'c'
     XMLGenerator.__init__(self, out, encoding)
Beispiel #23
0
 def __init__(self, out=None, encoding="iso-8859-1", increment=2):
     """out        Opened output file; sys.stdout if None given.
     encoding   Character encoding to use.
     increment  Indentation increment to use.
     """
     XMLGenerator.__init__(self, out=out, encoding=encoding)
     self._element_stack = []
     self._in_cdata = False
     self._indent_increment = increment
     self._newline_flag = False
     self._indent_level = 0
Beispiel #24
0
 def __init__(self, out=None, encoding="iso-8859-1", increment=2):
     """out        Opened output file; sys.stdout if None given.
     encoding   Character encoding to use.
     increment  Indentation increment to use.
     """
     XMLGenerator.__init__(self, out=out, encoding=encoding)
     self._element_stack = []
     self._in_cdata = False
     self._indent_increment = increment
     self._newline_flag = False
     self._indent_level = 0
Beispiel #25
0
    def __init__(self, out, enc, reader=None, check_intersection=None, poly=None, poly_buffered=None):
        XMLGenerator.__init__(self, GetFile(out, "w"), enc)
        self.reader = reader
        self.check_intersection = check_intersection
        self.poly = []
        self.poly.append(poly)
        self.poly.append(poly_buffered)
        self.poly_num = 2

        self.num_read_nodes = 0
        self.num_read_ways = 0
        self.num_read_relations = 0
Beispiel #26
0
    def __init__(self, out, enc, reader = None, check_intersection = None, poly = None, poly_buffered = None):
        XMLGenerator.__init__(self, GetFile(out, "w"), enc)
        self.reader = reader
        self.check_intersection = check_intersection
        self.poly = []
        self.poly.append(poly)
        self.poly.append(poly_buffered)
        self.poly_num = 2

        self.num_read_nodes = 0
        self.num_read_ways = 0
        self.num_read_relations = 0
Beispiel #27
0
 def __init__(self,
              break_into=None,
              break_after=200,
              out=None,
              *args,
              **kwargs):
     XMLGenerator.__init__(self, out, *args, **kwargs)
     self.out_file = out
     self.break_into = break_into
     self.break_after = break_after
     self.context = []
     self.count = 0
     print('XMLBreaker __init__ : ', break_into, break_after)
Beispiel #28
0
 def __init__(self, out, chunked, aliases, headers,
         content_length_index=None, encoding='utf-8'):
     self.aliases = {}
     for account, name in aliases.iteritems():
         self.aliases[account] = name.encode('utf-8') \
             if isinstance(name, unicode) else name
     self.rules = self.build_rules()
     self.trans = False
     self.chunked = chunked
     self.headers= headers
     self.content_length_index = content_length_index
     XMLGenerator.__init__(self, out=out, encoding=encoding)
     self.out = out
     self._write = self.write
     self._flush = self.flush
     self.content = ''
Beispiel #29
0
 def __init__(self, out, encoding='utf-8', indent=" ", increment=2):
     XMLGenerator.__init__(self, out, encoding)
     # the indentation character
     self._indent = indent
     # nest level
     self._level = 0
     # how many indentation character should we increment per level
     self._increment = increment
     # container for names of tags with children
     self._parent_stack = []
     # determine writer method
     try:
         # this should work for all platforms except Jython
         self.write = self._write
     except AttributeError:
         # Jython uses self._out.write
         self.write = self._out.write
Beispiel #30
0
    def __init__(self, **kwds):
        self.elems = kwds.has_key('elems') and kwds['elems'] or []
        self.attributes = kwds.has_key('attributes') and kwds['attributes'] or []
        self.values = kwds.has_key('values') and kwds['values'] or []
        self.sourceElems = kwds.has_key('sourceElems') and kwds['sourceElems'] or []
        self.sourceAttributes = kwds.has_key('sourceAttributes') and kwds['sourceAttributes'] or []
        self.sourceValues = kwds.has_key('sourceValues') and kwds['sourceValues'] or []
        self.targetElems = kwds.has_key('targetElems') and kwds['targetElems'] or []
        self.targetAttributes = kwds.has_key('targetAttributes') and kwds['targetAttributes'] or []
        self.targetValues = kwds.has_key('targetValues') and kwds['targetValues'] or []

        self.deleteElems = kwds.has_key('deleteElems') and kwds['deleteElems'] or []
        self.deleteAttributes = kwds.has_key('deleteAttributes') and kwds['deleteAttributes'] or []

        self.src_dirs = kwds.has_key('src_dirs') and kwds['src_dirs'] or []
        self.output_dir = kwds.has_key('output_dir') and kwds['output_dir'] or None

        self.buffer = StringIO.StringIO()

        XMLGenerator.__init__(self, self.buffer, 'UTF-8')
Beispiel #31
0
 def __init__(self, encodingError, content):
     '''
     Construct the XML object renderer.
     
     @param encodingError: string
         The encoding error resolving.
     @param content: Content
         The content to render in.
     '''
     assert isinstance(content, Content), 'Invalid content %s' % content
     assert isinstance(content.charSet, str), 'Invalid content char set %s' % content.charSet
     
     self._outb = BytesIO()
     XMLGenerator.__init__(self, out=getwriter(content.charSet)(self._outb, encodingError),
                           encoding=content.charSet, short_empty_elements=True)
     
     self._content = content
     self._stack = deque()
     
     self._adjust = True
     self._block = False
     self._pendingStart = None
     self._indexes = []
Beispiel #32
0
 def __init__(self, out = None, encoding = 'ascii', standalone = 'yes'):
     XMLGenerator.__init__(self, out, encoding)
     self._standalone = standalone
    def __init__ (self, fh=stdout, indent=4) :
        XMLGenerator.__init__(self, out=fh, encoding="utf8")

        self.__level  = 0
        self.__indent = indent
        self.__last   = None
Beispiel #34
0
 def __init__(self, *args, **kwargs):
     XMLGenerator.__init__(self, *args, **kwargs)
     self.depth = 0
     self.chars = False
Beispiel #35
0
 def __init__(self, out=None, encoding="iso-8859-1"):
     XMLGenerator.__init__(self, out, encoding)
     self.location = None
Beispiel #36
0
 def __init__(self, out):
     XMLGenerator.__init__(self, out)
     self.count = {}
     self._tags = []
Beispiel #37
0
 def __init__(self, destination, encoding):
     self._out = destination
     XMLGenerator.__init__(self, destination, encoding)
Beispiel #38
0
 def __init__(self, out=None, encoding="iso-8859-1"):
     self.stack = 0
     self.lastWrittenName = ""
     self.contentWritten = True
     XMLGenerator.__init__(self, out, encoding)
Beispiel #39
0
 def __init__(self, out, enc):
     if type(out) == str:
         XMLGenerator.__init__(self, open(out, "w"), enc)
     else:
         XMLGenerator.__init__(self, out, enc)
Beispiel #40
0
 def __init__(self, out, enc, reader=None):
     XMLGenerator.__init__(self, GetFile(out, "w"), enc)
     self.reader = reader
Beispiel #41
0
 def __init__(self, dest, detail_dir):
     self.fh = open(dest, 'wb')
     XMLGenerator.__init__(self, self.fh, "UTF-8")
     self.detail_dir = detail_dir
     self._test = None
     self._in_name = False
Beispiel #42
0
 def __init__( self, file ):
     XMLGenerator.__init__( self, file )
     self.indent = 0
Beispiel #43
0
 def __init__(self, path, encoding='utf-8'):
     fh = _get_fh(path, mode='wb')
     XMLGenerator.__init__(self, fh, encoding)
     self._data_types = {}
Beispiel #44
0
    def __init__(self, destination, encoding):
        XMLGenerator.__init__(self, destination, encoding)

        if hasattr(self, '_out') and self._out:
            self._write = self._out.write
            self._flush = self._out.flush
Beispiel #45
0
 def __init__(self, encoding='utf-8'):
     self.output = StringIO()
     XMLGenerator.__init__(self, out=self.output, encoding=encoding)
Beispiel #46
0
    def __init__(self, destination, encoding):
        XMLGenerator.__init__(self, destination, encoding)

        if hasattr(self, '_out') and self._out:
            self._write = self._out.write
            self._flush = self._out.flush
Beispiel #47
0
 def __init__(self, destination, encoding):
     XMLGenerator.__init__(self, destination, encoding)
Beispiel #48
0
 def __init__(self):
     XMLGenerator.__init__(self, outfile, 'utf-8') #super constructor
     self.record_count = 0
 def __init__(self):
     self.__buffer = cStringIO.StringIO()
     
     XMLGenerator.__init__(self, self.__buffer)
 def __init__(self, destination, encoding):
     XMLGenerator.__init__(self, destination, encoding)
     self._out = destination
Beispiel #51
0
 def __init__(self, cr, uid, pool, fp):
     self.pool = pool
     self.padding = 0
     XMLGenerator.__init__(self, fp, 'UTF-8')