mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	Add annotations to avatar.py, db.py, logging_util.py, unminify.py.
Also, fixed a a small type annotation in users.py because email must be a string because emails don't support UTF-8 at this time (according a comment in gravatar_hash in avatar.py).
This commit is contained in:
		@@ -4,16 +4,21 @@ import re
 | 
			
		||||
import os.path
 | 
			
		||||
import sourcemap
 | 
			
		||||
from six.moves import map
 | 
			
		||||
from six import text_type
 | 
			
		||||
 | 
			
		||||
from typing import Dict
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class SourceMap(object):
 | 
			
		||||
    '''Map (line, column) pairs from generated to source file.'''
 | 
			
		||||
 | 
			
		||||
    def __init__(self, sourcemap_dir):
 | 
			
		||||
        # type: (text_type) -> None
 | 
			
		||||
        self._dir = sourcemap_dir
 | 
			
		||||
        self._indices = {} # type: Dict[str, sourcemap.SourceMapDecoder]
 | 
			
		||||
        self._indices = {} # type: Dict[text_type, sourcemap.SourceMapDecoder]
 | 
			
		||||
 | 
			
		||||
    def _index_for(self, minified_src):
 | 
			
		||||
        # type: (text_type) -> sourcemap.SourceMapDecoder
 | 
			
		||||
        '''Return the source map index for minified_src, loading it if not
 | 
			
		||||
           already loaded.'''
 | 
			
		||||
        if minified_src not in self._indices:
 | 
			
		||||
@@ -23,7 +28,8 @@ class SourceMap(object):
 | 
			
		||||
        return self._indices[minified_src]
 | 
			
		||||
 | 
			
		||||
    def annotate_stacktrace(self, stacktrace):
 | 
			
		||||
        out = ''
 | 
			
		||||
        # type: (text_type) -> text_type
 | 
			
		||||
        out = '' # type: text_type
 | 
			
		||||
        for ln in stacktrace.splitlines():
 | 
			
		||||
            out += ln + '\n'
 | 
			
		||||
            match = re.search(r'/static/min/(.+)(\.[0-9a-f]+)\.js:(\d+):(\d+)', ln)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user