mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	markdown: Use immutable type for extension config.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
		@@ -28,7 +28,7 @@ class MarkdownArgumentsTableGenerator(Extension):
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class APIArgumentsTablePreprocessor(Preprocessor):
 | 
			
		||||
    def __init__(self, md: markdown.Markdown, config: Dict[str, Any]) -> None:
 | 
			
		||||
    def __init__(self, md: markdown.Markdown, config: Mapping[str, Any]) -> None:
 | 
			
		||||
        super().__init__(md)
 | 
			
		||||
        self.base_path = config['base_path']
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -22,7 +22,7 @@ class MarkdownReturnValuesTableGenerator(Extension):
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class APIReturnValuesTablePreprocessor(Preprocessor):
 | 
			
		||||
    def __init__(self, md: markdown.Markdown, config: Dict[str, Any]) -> None:
 | 
			
		||||
    def __init__(self, md: markdown.Markdown, config: Mapping[str, Any]) -> None:
 | 
			
		||||
        super().__init__(md)
 | 
			
		||||
 | 
			
		||||
    def run(self, lines: List[str]) -> List[str]:
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
from typing import Any, Dict, List, Optional, Tuple
 | 
			
		||||
from typing import Any, List, Mapping, Optional, Tuple
 | 
			
		||||
from xml.etree.ElementTree import Element, SubElement
 | 
			
		||||
 | 
			
		||||
import markdown
 | 
			
		||||
@@ -16,7 +16,7 @@ class NestedCodeBlocksRenderer(Extension):
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
class NestedCodeBlocksRendererTreeProcessor(markdown.treeprocessors.Treeprocessor):
 | 
			
		||||
    def __init__(self, md: markdown.Markdown, config: Dict[str, Any]) -> None:
 | 
			
		||||
    def __init__(self, md: markdown.Markdown, config: Mapping[str, Any]) -> None:
 | 
			
		||||
        super().__init__(md)
 | 
			
		||||
 | 
			
		||||
    def run(self, root: Element) -> None:
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
import re
 | 
			
		||||
from typing import Any, Dict, List, Optional
 | 
			
		||||
from typing import Any, Dict, List, Mapping, Optional
 | 
			
		||||
 | 
			
		||||
import markdown
 | 
			
		||||
from markdown.extensions import Extension
 | 
			
		||||
@@ -85,7 +85,7 @@ class TabbedSectionsGenerator(Extension):
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
class TabbedSectionsPreprocessor(Preprocessor):
 | 
			
		||||
    def __init__(self, md: markdown.Markdown, config: Dict[str, Any]) -> None:
 | 
			
		||||
    def __init__(self, md: markdown.Markdown, config: Mapping[str, Any]) -> None:
 | 
			
		||||
        super().__init__(md)
 | 
			
		||||
 | 
			
		||||
    def run(self, lines: List[str]) -> List[str]:
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,7 @@ import inspect
 | 
			
		||||
import json
 | 
			
		||||
import re
 | 
			
		||||
import shlex
 | 
			
		||||
from typing import Any, Dict, List, Optional, Pattern, Tuple
 | 
			
		||||
from typing import Any, Dict, List, Mapping, Optional, Pattern, Tuple
 | 
			
		||||
 | 
			
		||||
import markdown
 | 
			
		||||
from django.conf import settings
 | 
			
		||||
@@ -358,7 +358,7 @@ class APIMarkdownExtension(Extension):
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
class APICodeExamplesPreprocessor(Preprocessor):
 | 
			
		||||
    def __init__(self, md: markdown.Markdown, config: Dict[str, Any]) -> None:
 | 
			
		||||
    def __init__(self, md: markdown.Markdown, config: Mapping[str, Any]) -> None:
 | 
			
		||||
        super().__init__(md)
 | 
			
		||||
        self.api_url = config['api_url']
 | 
			
		||||
 | 
			
		||||
@@ -416,7 +416,7 @@ class APICodeExamplesPreprocessor(Preprocessor):
 | 
			
		||||
        return fixture
 | 
			
		||||
 | 
			
		||||
class APIDescriptionPreprocessor(Preprocessor):
 | 
			
		||||
    def __init__(self, md: markdown.Markdown, config: Dict[str, Any]) -> None:
 | 
			
		||||
    def __init__(self, md: markdown.Markdown, config: Mapping[str, Any]) -> None:
 | 
			
		||||
        super().__init__(md)
 | 
			
		||||
        self.api_url = config['api_url']
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user