lakin.wecker avatar lakin.wecker committed 347d3e4

updating whitespace.

Comments (0)

Files changed (1)

         Params:
             -- offset: The number of minutes from GMT. [-720, 720]
         """
-        
+
         if offset < -720:
             offset = -720
         if offset > 720:
             zone = cls.Timezone(offset)
             cls.zones[offset] = zone
         return zone
-    
+
     #---------------------------------------------------------------------------
     @classmethod
     def datetime_from_iso(cls, time):
             YYYY-MM-DDThh:mm:ss.mmm-HH:MM
             YYYY-MM-DDThh:mm:ss.mmm+HH:MM
         """
-       
+
         try:
             time = str(time)
             offset = time[23:29]
-           
+
             if offset[:1] == '-':
                 offset = offset[1:].split(':')
                 offset = -(int(offset[0]) * 60 + int(offset[1]))
                 if offset < -720:
                     offset = -720
             elif offset[:1] == '+':
-                offset = offset[1:].split(':') 
+                offset = offset[1:].split(':')
                 offset = int(offset[0]) * 60 + int(offset[1])
                 if offset > 720:
                     offset = 720
-            else: 
+            else:
                 offset = 0
-           
-            zone = cls.get_timezone(offset) 
+
+            zone = cls.get_timezone(offset)
 
             # Extract the date & time component
             time = time[0:23]
 
             # Make the time, zone aware.
             date = date.replace(tzinfo=zone)
-        
+
         except Exception, e:
             raise ValueError(str(e))
 
         string = "%s%+03d:%02d" % (string, (minutes / 60), abs(minutes) % 60)
         return string
 
-    #---------------------------------------------------------------------------    
+    #---------------------------------------------------------------------------
     @classmethod
     def to_python(cls, type, value):
         lookup = {
             'string': lambda x: unicode(x),
             'boolean': lambda x: bool(x),
             'number': lambda x: decimal.Decimal(x),
-            'datetime': lambda x: cls.datetime_from_iso(x) 
+            'datetime': lambda x: cls.datetime_from_iso(x)
         }
         converter = lookup.get(type)
         if not converter:
             datetime.datetime: lambda x: cls.datetime_to_iso(x),
             type(None): lambda x: 'null'
         }
-       
+
         converter = lookup.get(type(value))
         if not converter:
             raise ParseError(u'Unrecognized variable type %s' % type(value))
     operations = ['eq', 'lt', 'le', 'gt', 'ge', 'ne', 'in', 'out']
     conjunctions = ['and', 'or']
 
-    #--------------------------------------------------------------------------- 
+    #---------------------------------------------------------------------------
     def __init__(self, name='and', args=None, cache=None, parent=None):
         self.name = name
 
     #---------------------------------------------------------------------------
     def expand(self):
         return self.cache.get('expand')
-   
-    #--------------------------------------------------------------------------- 
+
+    #---------------------------------------------------------------------------
     def sort(self):
         return self.cache.get('sort')
 
         id=lt=10 => lt(id,10)
         id=10&title=eagles => eq(id,10)&eq(title,eagles)
     """
-    
+
     operators = [
-        (u'=lt=', u'lt'), 
+        (u'=lt=', u'lt'),
         (u'=le=', u'le'),
-        (u'=ge=', u'ge'), 
+        (u'=ge=', u'ge'),
         (u'=gt=', u'gt'),
         (u'=ne=', u'ne'),
         (u'=eq=', u'eq'),
     if not isinstance(rql, unicode):
         # Note that we are assuming unicode characters are encoded as utf8.
         rql = rql.decode('utf8')
- 
+
     # Search left to right for an appropriate value.
     def find_value(uni, start):
         next = start
                 break
 
         return uni[prev:start]
-        
+
     for op in operators:
         current = 0
         while True:
                 pass
 
     return value
- 
+
 
 #-------------------------------------------------------------------------------
 def parse(rql):
     property_or_value = u''
     for current in range(len(rql)):
 
-        # Conjunction delimiters 
+        # Conjunction delimiters
         if rql[current] == u'&':
             if not term.name:
                 term.name = u'and'
             new_term.parent = term
             term = new_term
 
-            if (term.name == u'sort' or 
+            if (term.name == u'sort' or
                 term.name == u'select' or
                 term.name == u'expand' or
                 term.name == u'limit'):
                 term.name = u'array'
                 if term.parent and (term.parent.name == u'and' or term.parent.name == u'or'):
                     raise ParseError('Conjunctions require operations as arguments, not an array.')
-           
+
             if property_or_value:
                 if term.name == u'and' or term.name == u'or':
                     raise ParseError('Conjunctions require operations as arguments, not values.')
                 property_or_value = u''
 
             if not term.parent:
-                raise ParseError('Closing parenthesis without an opening parenthesis is not allowed.') 
+                raise ParseError('Closing parenthesis without an opening parenthesis is not allowed.')
             term.parent.args.append(term)
             term = term.parent
             continue
-        
+
         if rql[current] in u',=':
             if property_or_value:
                 term.args.append(__convert_to_python(property_or_value))
                 if not arg.parent:
                     outer['term'] = arg
                 return True
-            
+
             if fix(arg):
                 return True
         return False
 #-------------------------------------------------------------------------------
 class DeparseVisitor(object):
 
-    #---------------------------------------------------------------------------  
+    #---------------------------------------------------------------------------
     def visit_and(self, query):
         sub = []
         for s in query.args:
             sub.append(s.walk(self))
-       
+
         if query.parent:
             return u'(%s)' % (u'&'.join(sub))
         else:
             return u'(%s)' % (u'|'.join(sub))
         else:
             return u'|'.join(sub)
- 
-    #--------------------------------------------------------------------------- 
+
+    #---------------------------------------------------------------------------
     def visit_eq(self, query):
         return u'%s=%s' % (query.args[0], Converters.from_python(query.args[1]))
-    
-    #--------------------------------------------------------------------------- 
+
+    #---------------------------------------------------------------------------
     def visit_ne(self, query):
         return u'%s=ne=%s' % (query.args[0], Converters.from_python(query.args[1]))
 
     #---------------------------------------------------------------------------
     def visit_lt(self, query):
         return u'%s=lt=%s' % (query.args[0], Converters.from_python(query.args[1]))
-    
+
     #---------------------------------------------------------------------------
     def visit_le(self, query):
         return u'%s=le=%s' % (query.args[0], Converters.from_python(query.args[1]))
     #---------------------------------------------------------------------------
     def visit_expand(self, query):
         return u'expand(%s)' % (','.join(query.args))
-    
+
     #---------------------------------------------------------------------------
     def visit_select(self, query):
         return u'select(%s)' % (','.join(query.args))
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.