Esempio n. 1
0
 def __init__( self, request, validate = True ):
   if validate:
     EnsureRequestValid( request )
   self._request = request
   self._computed_key = {
     'line_value': self._CurrentLine,
     'start_column': self.CompletionStartColumn,
     'query': self._Query,
     'filetypes': self._Filetypes,
   }
   self._cached_computed = {}
Esempio n. 2
0
  def __init__( self, request, validate = True ):
    if validate:
      EnsureRequestValid( request )
    self._request = request

    # Maps the keys returned by this objects __getitem__ to a # tuple of
    # ( getter_method, setter_method ). Values computed by getter_method (or set
    # by setter_method) are cached in _cached_computed.  setter_method may be
    # None for read-only items.
    self._computed_key = {
      # Unicode string representation of the current line. If the line requested
      # is not in the file, returns ''.
      'line_value': ( self._CurrentLine, None ),

      # The calculated start column, as a codepoint offset into the
      # unicode string line_value
      'start_codepoint': ( self._GetCompletionStartCodepoint,
                           self._SetCompletionStartCodepoint ),

      # The 'column_num' as a unicode codepoint offset
      'column_codepoint': ( lambda: ByteOffsetToCodepointOffset(
                              self[ 'line_bytes' ],
                              self[ 'column_num' ] ),
                            None ),

      # Bytes string representation of the current line
      'line_bytes': ( lambda: ToBytes( self[ 'line_value' ] ),
                      None ),

      # The calculated start column, as a byte offset into the UTF-8 encoded
      # bytes returned by line_bytes
      'start_column': ( self._GetCompletionStartColumn,
                        self._SetCompletionStartColumn ),

      # Note: column_num is the byte offset into the UTF-8 encoded bytes
      # returned by line_bytes

      # unicode string representation of the 'query' after the beginning
      # of the identifier to be completed
      'query': ( self._Query, None ),

      # Unicode string representation of the line value up to the character
      # before the start of 'query'
      'prefix': ( self._Prefix, None ),

      'filetypes': ( self._Filetypes, None ),

      'first_filetype': ( self._FirstFiletype, None ),

      'force_semantic': ( self._GetForceSemantic, None ),

      'lines': ( self._CurrentLines, None )
    }
    self._cached_computed = {}
Esempio n. 3
0
    def __init__(self, request, validate=True):
        if validate:
            EnsureRequestValid(request)
        self._request = request
        self._computed_key = {
            # Unicode string representation of the current line
            'line_value':
            self._CurrentLine,

            # The calculated start column, as a codepoint offset into the
            # unicode string line_value
            'start_codepoint':
            self.CompletionStartCodepoint,

            # The 'column_num' as a unicode codepoint offset
            'column_codepoint': (lambda: ByteOffsetToCodepointOffset(
                self['line_bytes'], self['column_num'])),

            # Bytes string representation of the current line
            'line_bytes':
            lambda: ToBytes(self['line_value']),

            # The calculated start column, as a byte offset into the UTF-8 encoded
            # bytes returned by line_bytes
            'start_column':
            self.CompletionStartColumn,

            # Note: column_num is the byte offset into the UTF-8 encoded bytes
            # returned by line_bytes

            # unicode string representation of the 'query' after the beginning
            # of the identifier to be completed
            'query':
            self._Query,
            'filetypes':
            self._Filetypes,
        }
        self._cached_computed = {}
Esempio n. 4
0
def EnsureRequestValid_AllOk_test():
  ok_( EnsureRequestValid( BasicData() ) )
def EnsureRequestValid_AllOk_test():
    assert_that(EnsureRequestValid(BasicData()))
Esempio n. 6
0
 def test_EnsureRequestValid_AllOk(self):
     assert_that(EnsureRequestValid(BasicData()))