repo stringclasses 454
values | file_path stringlengths 5 201 | extension stringclasses 1
value | content stringlengths 8 509k | num_lines int64 3 16.9k | size_bytes int64 8 511k |
|---|---|---|---|---|---|
sphinx | sphinx/ext/autodoc/_dynamic/_docstrings.py | .py | from __future__ import annotations
from typing import TYPE_CHECKING, TypeVar
from sphinx.errors import PycodeError
from sphinx.ext.autodoc._dynamic._importer import (
_get_attribute_comment,
_is_runtime_instance_attribute_not_commented,
)
from sphinx.ext.autodoc._property_types import _ClassDefProperties
from... | 333 | 10,677 |
sphinx | sphinx/ext/autodoc/_dynamic/_importer.py | .py | """Importer utilities for autodoc"""
from __future__ import annotations
import contextlib
import importlib
import os
import sys
import traceback
import typing
from importlib.abc import FileLoader
from importlib.machinery import EXTENSION_SUFFIXES
from importlib.util import decode_source, find_spec, module_from_spec, ... | 432 | 14,519 |
sphinx | sphinx/ext/autodoc/_dynamic/_mock.py | .py | """mock for autodoc"""
from __future__ import annotations
import contextlib
import os
import sys
from importlib.abc import Loader, MetaPathFinder
from importlib.machinery import ModuleSpec
from types import MethodType, ModuleType
from typing import TYPE_CHECKING
from sphinx.ext.autodoc._shared import LOGGER
from sph... | 221 | 6,379 |
sphinx | sphinx/ext/autodoc/_dynamic/_type_annotations.py | .py | from __future__ import annotations
from typing import TYPE_CHECKING
from sphinx.util import inspect
from sphinx.util.typing import stringify_annotation
if TYPE_CHECKING:
from collections.abc import Mapping
from typing import Any
from sphinx.util.typing import _StringifyMode
def _record_typehints(
... | 46 | 1,387 |
sphinx | sphinx/ext/autodoc/_dynamic/_signatures.py | .py | """Signature utilities for autodoc"""
from __future__ import annotations
import sys
from inspect import Parameter, Signature
from typing import TYPE_CHECKING, NewType, TypeVar
from sphinx.errors import PycodeError
from sphinx.ext.autodoc._dynamic._preserve_defaults import update_default_value
from sphinx.ext.autodoc... | 647 | 23,987 |
sphinx | sphinx/ext/autodoc/_dynamic/_preserve_defaults.py | .py | """Preserve function defaults.
Preserve the default argument values of function signatures in source code
and keep them not evaluated for readability.
"""
from __future__ import annotations
import ast
import inspect
import types
from typing import TYPE_CHECKING
from sphinx.ext.autodoc._shared import LOGGER
from sph... | 158 | 5,436 |
sphinx | sphinx/ext/autodoc/_dynamic/_type_comments.py | .py | """Update annotations info of living objects using type_comments."""
from __future__ import annotations
import ast
import contextlib
import sys
from inspect import Parameter, Signature, getsource
from types import ModuleType
from typing import TYPE_CHECKING, cast
from weakref import WeakSet
from sphinx.errors import... | 231 | 8,408 |
sphinx | sphinx/ext/autodoc/_dynamic/_loader.py | .py | """Object loader for autodoc"""
from __future__ import annotations
import re
from inspect import Parameter
from pathlib import Path
from types import SimpleNamespace
from typing import TYPE_CHECKING, NewType, TypeVar
from sphinx.ext.autodoc._dynamic._docstrings import (
_docstring_lines_for_props,
_get_docst... | 503 | 17,547 |
sphinx | sphinx/ext/autodoc/_dynamic/_member_finder.py | .py | from __future__ import annotations
import operator
import re
from enum import Enum
from typing import TYPE_CHECKING, Literal, NewType, TypeVar
from sphinx.errors import PycodeError
from sphinx.events import EventManager
from sphinx.ext.autodoc._directive_options import _AutoDocumenterOptions
from sphinx.ext.autodoc._... | 872 | 31,491 |
sphinx | sphinx/ext/apidoc/_extension.py | .py | """Sphinx extension for auto-generating API documentation."""
from __future__ import annotations
import fnmatch
import re
from pathlib import Path
from typing import TYPE_CHECKING
from sphinx._cli.util.colour import bold
from sphinx.ext.apidoc._generate import create_modules_toc_file, recurse_tree
from sphinx.ext.ap... | 264 | 7,537 |
sphinx | sphinx/ext/apidoc/_cli.py | .py | from __future__ import annotations
import argparse
import fnmatch
import locale
import re
import sys
from pathlib import Path
from typing import TYPE_CHECKING
import sphinx.locale
from sphinx import __display_version__
from sphinx.cmd.quickstart import EXTENSIONS
from sphinx.ext.apidoc._generate import create_modules... | 357 | 10,182 |
sphinx | sphinx/ext/apidoc/__main__.py | .py | """Command-line interface for the apidoc extension."""
from __future__ import annotations
import sys
from sphinx.ext.apidoc._cli import main
raise SystemExit(main(sys.argv[1:]))
| 10 | 182 |
sphinx | sphinx/ext/apidoc/__init__.py | .py | """Creates reST files corresponding to Python modules for code documentation.
Parses a directory tree looking for Python modules and packages and creates
ReST files appropriately to create code documentation with Sphinx. It also
creates a modules index (named modules.<suffix>).
This is derived from the "sphinx-autop... | 67 | 2,227 |
sphinx | sphinx/ext/apidoc/_shared.py | .py | from __future__ import annotations
import dataclasses
from typing import TYPE_CHECKING
from sphinx.locale import __
from sphinx.util import logging
if TYPE_CHECKING:
from collections.abc import Sequence, Set
from pathlib import Path
from typing import Final, Self
from sphinx.config import Config
LO... | 100 | 2,908 |
sphinx | sphinx/ext/apidoc/_generate.py | .py | from __future__ import annotations
import glob
import os
import os.path
from importlib.machinery import EXTENSION_SUFFIXES
from pathlib import Path
from typing import TYPE_CHECKING
from sphinx import package_dir
from sphinx.ext.apidoc._shared import LOGGER
from sphinx.locale import __
from sphinx.util.osutil import F... | 354 | 11,856 |
sphinx | sphinx/locale/__init__.py | .py | """Locale utilities."""
from __future__ import annotations
import locale
import sys
from gettext import NullTranslations, translation
from pathlib import Path
from typing import TYPE_CHECKING
from sphinx import package_dir
if TYPE_CHECKING:
import os
from collections.abc import Callable, Iterable
from t... | 240 | 7,326 |
mkdocs | setup.py | .py | """Installation using setup.py is no longer supported.
Use `python -m pip install .` instead."""
import sys
from setuptools import setup
sys.exit(__doc__)
# Fake reference so GitHub still considers it a real package for statistics purposes.
setup(
name="mkdocs",
)
| 14 | 273 |
mkdocs | hatch_build.py | .py | import os
from hatchling.builders.hooks.plugin.interface import BuildHookInterface
class CustomBuildHook(BuildHookInterface):
def initialize(self, version, build_data):
from babel.messages.frontend import compile_catalog
for theme in 'mkdocs', 'readthedocs':
cmd = compile_catalog()
... | 15 | 455 |
mkdocs | docs/hooks.py | .py | from __future__ import annotations
import re
from pathlib import Path
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from mkdocs.config.defaults import MkDocsConfig
from mkdocs.structure.nav import Page
def _get_language_of_translation_file(path: Path) -> str:
with path.open(encoding='utf-8') as f:
... | 37 | 1,155 |
mkdocs | docs/img/plugin-events.py | .py | # Run this to re-generate 'plugin-events.svg'.
# Requires `pip install graphviz`.
import contextlib
import pathlib
import re
from graphviz import Digraph
graph = Digraph("MkDocs", format="svg")
graph.attr(compound="true", bgcolor="transparent")
graph.graph_attr.update(fontname="inherit", tooltip=" ")
graph.node_attr... | 172 | 5,724 |
mkdocs | mkdocs/exceptions.py | .py | from __future__ import annotations
from click import ClickException, echo
class MkDocsException(ClickException):
"""
The base class which all MkDocs exceptions inherit from. This should
not be raised directly. One of the subclasses should be raised instead.
"""
class Abort(MkDocsException, SystemEx... | 42 | 1,018 |
mkdocs | mkdocs/__main__.py | .py | #!/usr/bin/env python
from __future__ import annotations
import logging
import os
import shutil
import sys
import textwrap
import traceback
import warnings
import click
from mkdocs import __version__, config, utils
if sys.platform.startswith("win"):
try:
import colorama
except ImportError:
... | 371 | 12,347 |
mkdocs | mkdocs/__init__.py | .py | #!/usr/bin/env python
# For acceptable version formats, see https://www.python.org/dev/peps/pep-0440/
__version__ = '1.6.1'
| 6 | 126 |
mkdocs | mkdocs/localization.py | .py | from __future__ import annotations
import logging
import os
from typing import TYPE_CHECKING, Sequence
from jinja2.ext import Extension, InternationalizationExtension
from mkdocs.config.base import ValidationError
if TYPE_CHECKING:
import jinja2
try:
from babel.core import Locale, UnknownLocaleError
fr... | 93 | 3,049 |
mkdocs | mkdocs/plugins.py | .py | """Implements the plugin API for MkDocs."""
from __future__ import annotations
import logging
import sys
from typing import TYPE_CHECKING, Any, Callable, Generic, Literal, MutableMapping, TypeVar, overload
if sys.version_info >= (3, 10):
from importlib.metadata import EntryPoint, entry_points
else:
from impo... | 698 | 25,265 |
mkdocs | mkdocs/theme.py | .py | from __future__ import annotations
import logging
import os
import warnings
from typing import Any, Collection, MutableMapping
import jinja2
import yaml
try:
from yaml import CSafeLoader as SafeLoader
except ImportError: # pragma: no cover
from yaml import SafeLoader # type: ignore
from mkdocs import loca... | 167 | 5,304 |
mkdocs | mkdocs/config/__init__.py | .py | from mkdocs.config.base import Config, load_config
__all__ = ['load_config', 'Config']
| 4 | 88 |
mkdocs | mkdocs/config/defaults.py | .py | from __future__ import annotations
import logging
from typing import IO, Dict, Mapping
from mkdocs.config import base
from mkdocs.config import config_options as c
from mkdocs.structure.pages import Page, _AbsoluteLinksValidationValue
from mkdocs.utils.yaml import get_yaml_loader, yaml_load
class _LogLevel(c.Option... | 219 | 8,948 |
mkdocs | mkdocs/config/config_options.py | .py | from __future__ import annotations
import functools
import ipaddress
import logging
import os
import string
import sys
import traceback
import types
import warnings
from collections import Counter, UserString
from types import SimpleNamespace
from typing import (
Any,
Callable,
Collection,
Dict,
Ge... | 1,227 | 44,182 |
mkdocs | mkdocs/config/base.py | .py | from __future__ import annotations
import functools
import logging
import os
import sys
import warnings
from collections import UserDict
from contextlib import contextmanager
from typing import (
IO,
TYPE_CHECKING,
Any,
Generic,
Iterator,
List,
Mapping,
Sequence,
Tuple,
TypeVar,... | 393 | 13,159 |
mkdocs | mkdocs/tests/localization_tests.py | .py | #!/usr/bin/env python
import unittest
from unittest import mock
from mkdocs.config.base import ValidationError
from mkdocs.localization import install_translations, parse_locale
from mkdocs.tests.base import tempdir
class LocalizationTests(unittest.TestCase):
def setUp(self):
self.env = mock.Mock()
... | 75 | 2,645 |
mkdocs | mkdocs/tests/theme_tests.py | .py | import os
import unittest
from unittest import mock
import mkdocs
from mkdocs.localization import parse_locale
from mkdocs.tests.base import tempdir
from mkdocs.theme import Theme
abs_path = os.path.abspath(os.path.dirname(__file__))
mkdocs_dir = os.path.abspath(os.path.dirname(mkdocs.__file__))
mkdocs_templates_dir ... | 126 | 4,252 |
mkdocs | mkdocs/tests/plugin_tests.py | .py | #!/usr/bin/env python
from __future__ import annotations
import os
import unittest
from typing import TYPE_CHECKING, Optional
if TYPE_CHECKING:
from typing_extensions import assert_type
from mkdocs.structure.nav import Navigation
else:
def assert_type(val, typ):
return None
from mkdocs import ... | 329 | 11,953 |
mkdocs | mkdocs/tests/gh_deploy_tests.py | .py | import unittest
from unittest import mock
from ghp_import import GhpError # type: ignore
from mkdocs import __version__
from mkdocs.commands import gh_deploy
from mkdocs.exceptions import Abort
from mkdocs.tests.base import load_config
class TestGitHubDeploy(unittest.TestCase):
@mock.patch('subprocess.Popen')
... | 186 | 7,544 |
mkdocs | mkdocs/tests/livereload_tests.py | .py | #!/usr/bin/env python
import contextlib
import email
import io
import sys
import threading
import time
import unittest
from pathlib import Path
from unittest import mock
from mkdocs.livereload import LiveReloadServer
from mkdocs.tests.base import change_dir, tempdir
class FakeRequest:
def __init__(self, content... | 627 | 24,723 |
mkdocs | mkdocs/tests/__init__.py | .py | import logging
import unittest.util
unittest.util._MAX_LENGTH = 100000 # type: ignore[misc]
class DisallowLogsHandler(logging.Handler):
def __init__(self, level=logging.WARNING):
super().__init__(level=level)
self.formatter = logging.Formatter("%(levelname)s:%(name)s:%(message)s")
def emit(... | 17 | 469 |
mkdocs | mkdocs/tests/search_tests.py | .py | #!/usr/bin/env python
import json
import unittest
from unittest import mock
from mkdocs.config.config_options import ValidationError
from mkdocs.contrib import search
from mkdocs.contrib.search import search_index
from mkdocs.structure.files import File
from mkdocs.structure.pages import Page
from mkdocs.structure.to... | 634 | 24,300 |
mkdocs | mkdocs/tests/cli_tests.py | .py | #!/usr/bin/env python
import io
import logging
import unittest
from unittest import mock
from click.testing import CliRunner
from mkdocs import __main__ as cli
class CLITests(unittest.TestCase):
def setUp(self):
self.runner = CliRunner()
@mock.patch('mkdocs.commands.serve.serve', autospec=True)
... | 647 | 25,528 |
mkdocs | mkdocs/tests/build_tests.py | .py | #!/usr/bin/env python
from __future__ import annotations
import contextlib
import io
import os.path
import re
import textwrap
import unittest
from pathlib import Path
from typing import TYPE_CHECKING
from unittest import mock
import markdown.preprocessors
from mkdocs.commands import build
from mkdocs.config import b... | 959 | 40,269 |
mkdocs | mkdocs/tests/new_tests.py | .py | #!/usr/bin/env python
import os
import unittest
from mkdocs.commands import new
from mkdocs.tests.base import change_dir, tempdir
class NewTests(unittest.TestCase):
@tempdir()
def test_new(self, temp_dir):
with change_dir(temp_dir):
new.new("myproject")
expected_paths = [
... | 25 | 699 |
mkdocs | mkdocs/tests/integration.py | .py | """
# MkDocs Integration tests.
This is a simple integration test that builds the MkDocs
documentation against all of the builtin themes.
From the root of the MkDocs git repo, use:
python -m mkdocs.tests.integration --help
TODOs
- Build with different configuration options.
- Build documentation other ... | 76 | 2,156 |
mkdocs | mkdocs/tests/base.py | .py | from __future__ import annotations
import contextlib
import os
import textwrap
from functools import wraps
from tempfile import TemporaryDirectory
import markdown
from mkdocs import utils
from mkdocs.config.defaults import MkDocsConfig
def dedent(text):
return textwrap.dedent(text).strip()
def get_markdown_t... | 130 | 4,374 |
mkdocs | mkdocs/tests/config/base_tests.py | .py | import os
import unittest
from mkdocs import exceptions
from mkdocs.config import base
from mkdocs.config import config_options as c
from mkdocs.config import defaults
from mkdocs.config.base import ValidationError
from mkdocs.tests.base import change_dir, tempdir
class ConfigBaseTests(unittest.TestCase):
def te... | 275 | 10,551 |
mkdocs | mkdocs/tests/config/config_tests.py | .py | #!/usr/bin/env python
import os
import unittest
import mkdocs
from mkdocs import config
from mkdocs.config import config_options as c
from mkdocs.config import defaults
from mkdocs.config.base import ValidationError
from mkdocs.exceptions import ConfigurationError
from mkdocs.localization import parse_locale
from mkd... | 273 | 11,000 |
mkdocs | mkdocs/tests/config/config_options_legacy_tests.py | .py | from __future__ import annotations
import contextlib
import copy
import io
import os
import re
import sys
import textwrap
import unittest
from typing import Any
from unittest import mock
import mkdocs
from mkdocs.config import base
from mkdocs.config import config_options as c
from mkdocs.tests.base import tempdir
fr... | 1,647 | 54,973 |
mkdocs | mkdocs/tests/config/config_options_tests.py | .py | from __future__ import annotations
import contextlib
import copy
import io
import logging
import os
import re
import sys
import textwrap
import unittest
from typing import TYPE_CHECKING, Any, Dict, List, Optional, TypeVar, Union
from unittest import mock
if TYPE_CHECKING:
from typing_extensions import assert_type... | 2,421 | 84,508 |
mkdocs | mkdocs/tests/utils/utils_tests.py | .py | #!/usr/bin/env python
import dataclasses
import datetime
import logging
import os
import posixpath
import stat
import unittest
from unittest import mock
from mkdocs import exceptions, utils
from mkdocs.tests.base import dedent, tempdir
from mkdocs.utils import meta
BASEYML = """
INHERIT: parent.yml
foo: bar
baz:
... | 603 | 21,662 |
mkdocs | mkdocs/tests/utils/templates_tests.py | .py | import unittest
from textwrap import dedent
import yaml
from mkdocs.tests.base import load_config
from mkdocs.utils import templates
class UtilsTemplatesTests(unittest.TestCase):
def test_script_tag(self):
cfg_yaml = dedent(
'''
extra_javascript:
- some_plain_javasc... | 50 | 1,801 |
mkdocs | mkdocs/tests/utils/babel_stub_tests.py | .py | import unittest
from mkdocs.utils.babel_stub import Locale, UnknownLocaleError
class BabelStubTests(unittest.TestCase):
def test_locale_language_only(self):
locale = Locale('es')
self.assertEqual(locale.language, 'es')
self.assertEqual(locale.territory, '')
self.assertEqual(str(lo... | 56 | 1,931 |
mkdocs | mkdocs/tests/structure/nav_tests.py | .py | #!/usr/bin/env python
import sys
import unittest
from mkdocs.structure.files import File, Files, set_exclusions
from mkdocs.structure.nav import Section, _get_by_type, get_navigation
from mkdocs.structure.pages import Page
from mkdocs.tests.base import dedent, load_config
class SiteNavigationTests(unittest.TestCase... | 551 | 22,939 |
mkdocs | mkdocs/tests/structure/file_tests.py | .py | import os
import sys
import unittest
from unittest import mock
from mkdocs.structure.files import File, Files, _sort_files, file_sort_key, get_files
from mkdocs.tests.base import PathAssertionMixin, load_config, tempdir
class TestFiles(PathAssertionMixin, unittest.TestCase):
@unittest.skipUnless(sys.platform.sta... | 747 | 34,496 |
mkdocs | mkdocs/tests/structure/page_tests.py | .py | from __future__ import annotations
import os
import sys
import textwrap
import unittest
from unittest import mock
import markdown
from mkdocs.config.defaults import MkDocsConfig
from mkdocs.structure.files import File, Files
from mkdocs.structure.pages import Page, _ExtractTitleTreeprocessor, _RelativePathTreeproces... | 1,383 | 58,588 |
mkdocs | mkdocs/tests/structure/toc_tests.py | .py | #!/usr/bin/env python
import unittest
from mkdocs.structure.toc import get_toc
from mkdocs.tests.base import dedent, get_markdown_toc
class TableOfContentsTests(unittest.TestCase):
def test_indented_toc(self):
md = dedent(
"""
# Heading 1
## Heading 2
### ... | 199 | 5,255 |
mkdocs | mkdocs/utils/__init__.py | .py | """
Standalone file utils.
Nothing in this module should have an knowledge of config or the layout
and structure of the site and pages in the site.
"""
from __future__ import annotations
import functools
import logging
import os
import posixpath
import re
import shutil
import sys
import warnings
from collections impo... | 411 | 12,280 |
mkdocs | mkdocs/utils/babel_stub.py | .py | from __future__ import annotations
from string import ascii_letters
from typing import NamedTuple
class UnknownLocaleError(Exception):
pass
class Locale(NamedTuple):
language: str
territory: str = ''
def __str__(self):
if self.territory:
return f'{self.language}_{self.territory... | 30 | 860 |
mkdocs | mkdocs/utils/rendering.py | .py | from __future__ import annotations
import copy
from typing import TYPE_CHECKING, Callable
import markdown
import markdown.treeprocessors
if TYPE_CHECKING:
from xml.etree import ElementTree as etree
# TODO: This will become unnecessary after min-versions have Markdown >=3.4
_unescape: Callable[[str], str]
try:
... | 105 | 3,504 |
mkdocs | mkdocs/utils/templates.py | .py | from __future__ import annotations
from typing import TYPE_CHECKING, Sequence, TypedDict
if TYPE_CHECKING:
import datetime
from markupsafe import Markup
try:
from jinja2 import pass_context as contextfilter # type: ignore
except ImportError:
from jinja2 import contextfilter # type: ignore
from mkdocs... | 56 | 1,740 |
mkdocs | mkdocs/utils/cache.py | .py | import datetime
import urllib.request
from typing import Callable
import mkdocs_get_deps.cache
import mkdocs
def download_url(url: str) -> bytes:
req = urllib.request.Request(url, headers={"User-Agent": f"mkdocs/{mkdocs.__version__}"})
with urllib.request.urlopen(req) as resp:
return resp.read()
d... | 37 | 1,127 |
mkdocs | mkdocs/utils/yaml.py | .py | from __future__ import annotations
import functools
import logging
import os
import os.path
from typing import IO, TYPE_CHECKING, Any
import mergedeep # type: ignore
import yaml
import yaml.constructor
import yaml_env_tag # type: ignore
from mkdocs import exceptions
if TYPE_CHECKING:
from mkdocs.config.defaul... | 151 | 5,108 |
mkdocs | mkdocs/utils/meta.py | .py | """
Copyright (c) 2015, Waylan Limberg
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following... | 101 | 3,645 |
mkdocs | mkdocs/contrib/search/__init__.py | .py | from __future__ import annotations
import logging
import os
from typing import TYPE_CHECKING, List
from mkdocs import utils
from mkdocs.config import base
from mkdocs.config import config_options as c
from mkdocs.contrib.search.search_index import SearchIndex
from mkdocs.plugins import BasePlugin
if TYPE_CHECKING:
... | 121 | 5,230 |
mkdocs | mkdocs/contrib/search/search_index.py | .py | from __future__ import annotations
import json
import logging
import os
import re
import subprocess
from html.parser import HTMLParser
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from mkdocs.structure.pages import Page
from mkdocs.structure.toc import AnchorLink, TableOfContents
try:
from lunr imp... | 226 | 7,945 |
mkdocs | mkdocs/livereload/__init__.py | .py | from __future__ import annotations
import functools
import io
import ipaddress
import logging
import mimetypes
import os
import os.path
import pathlib
import posixpath
import re
import socket
import socketserver
import string
import sys
import threading
import time
import traceback
import urllib.parse
import webbrowse... | 382 | 13,530 |
mkdocs | mkdocs/commands/new.py | .py | from __future__ import annotations
import logging
import os
config_text = 'site_name: My Docs\n'
index_text = """# Welcome to MkDocs
For full documentation visit [mkdocs.org](https://www.mkdocs.org).
## Commands
* `mkdocs new [dir-name]` - Create a new project.
* `mkdocs serve` - Start the live-reloading docs serv... | 54 | 1,454 |
mkdocs | mkdocs/commands/serve.py | .py | from __future__ import annotations
import logging
import shutil
import tempfile
from os.path import isdir, isfile, join
from typing import TYPE_CHECKING
from urllib.parse import urlsplit
from mkdocs.commands.build import build
from mkdocs.config import load_config
from mkdocs.livereload import LiveReloadServer, _serv... | 111 | 3,245 |
mkdocs | mkdocs/commands/gh_deploy.py | .py | from __future__ import annotations
import logging
import os
import re
import subprocess
from typing import TYPE_CHECKING
import ghp_import # type: ignore
from packaging import version
import mkdocs
from mkdocs.exceptions import Abort
if TYPE_CHECKING:
from mkdocs.config.defaults import MkDocsConfig
log = logg... | 170 | 5,231 |
mkdocs | mkdocs/commands/build.py | .py | from __future__ import annotations
import gzip
import logging
import os
import time
from typing import TYPE_CHECKING, Sequence
from urllib.parse import urljoin, urlsplit
import jinja2
from jinja2.exceptions import TemplateNotFound
import mkdocs
from mkdocs import utils
from mkdocs.exceptions import Abort, BuildError... | 370 | 13,615 |
mkdocs | mkdocs/structure/files.py | .py | from __future__ import annotations
import enum
import fnmatch
import logging
import os
import posixpath
import shutil
import warnings
from functools import cached_property
from pathlib import PurePath, PurePosixPath
from typing import TYPE_CHECKING, Callable, Iterable, Iterator, Mapping, Sequence, overload
from urllib... | 627 | 23,569 |
mkdocs | mkdocs/structure/pages.py | .py | from __future__ import annotations
import enum
import logging
import posixpath
import warnings
from typing import TYPE_CHECKING, Any, Callable, Iterator, MutableMapping, Sequence
from urllib.parse import unquote as urlunquote
from urllib.parse import urljoin, urlsplit, urlunsplit
import markdown
import markdown.exten... | 570 | 22,168 |
mkdocs | mkdocs/structure/__init__.py | .py | from __future__ import annotations
import abc
from typing import TYPE_CHECKING, Iterable
if TYPE_CHECKING:
from mkdocs.structure.nav import Section
class StructureItem(metaclass=abc.ABCMeta):
"""An item in MkDocs structure - see concrete subclasses Section, Page or Link."""
@abc.abstractmethod
def ... | 37 | 945 |
mkdocs | mkdocs/structure/toc.py | .py | """
Deals with generating the per-page table of contents.
For the sake of simplicity we use the Python-Markdown `toc` extension to
generate a list of dicts for each toc item, and then store it as AnchorLinks to
maintain compatibility with older versions of MkDocs.
"""
from __future__ import annotations
from typing im... | 81 | 2,248 |
mkdocs | mkdocs/structure/nav.py | .py | from __future__ import annotations
import logging
from typing import TYPE_CHECKING, Iterator, TypeVar
from urllib.parse import urlsplit
from mkdocs.exceptions import BuildError
from mkdocs.structure import StructureItem
from mkdocs.structure.files import file_sort_key
from mkdocs.structure.pages import Page, _Absolut... | 252 | 9,033 |
mkdocs-material | includes/debug/cairo-lookup-linux.py | .py | import inspect
import os
import shutil
import subprocess
from ctypes import util
class CustomPopen(subprocess.Popen):
def __init__(self, *args, **kwargs):
print(f"Subprocess command:\n {' '.join(args[0])}")
super().__init__(*args, **kwargs)
def communicate(self, *args, **kwargs):
ou... | 112 | 3,491 |
mkdocs-material | includes/debug/cairo-lookup-macos.py | .py | import os
from ctypes.macholib import dyld
from itertools import chain
library_names = ("cairo-2", "cairo", "libcairo-2")
filenames = ("libcairo.so.2", "libcairo.2.dylib", "libcairo-2.dll")
first_found = ""
names = []
for name in library_names:
names += [
"lib%s.dylib" % name,
"%s.dylib" % name,
... | 50 | 1,303 |
mkdocs-material | includes/debug/cairo-lookup-windows.py | .py | import os
library_names = ("cairo-2", "cairo", "libcairo-2")
filenames = ("libcairo.so.2", "libcairo.2.dylib", "libcairo-2.dll")
first_found = ""
names = []
for name in library_names:
if name.lower().endswith(".dll"):
names += [name]
else:
names += [name, name + ".dll"]
for name in names:
... | 32 | 884 |
mkdocs-material | material/extensions/emoji.py | .py | # Copyright (c) 2016-2025 Martin Donath <martin.donath@squidfunk.com>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, c... | 98 | 3,612 |
mkdocs-material | material/extensions/preview.py | .py | # Copyright (c) 2016-2025 Martin Donath <martin.donath@squidfunk.com>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, c... | 224 | 8,285 |
mkdocs-material | material/overrides/hooks/translations.py | .py | # Copyright (c) 2016-2025 Martin Donath <martin.donath@squidfunk.com>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, c... | 198 | 6,234 |
mkdocs-material | material/overrides/hooks/shortcodes.py | .py | # Copyright (c) 2016-2025 Martin Donath <martin.donath@squidfunk.com>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, c... | 295 | 11,290 |
mkdocs-material | material/utilities/filter/__init__.py | .py | # Copyright (c) 2016-2025 Martin Donath <martin.donath@squidfunk.com>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, c... | 125 | 3,963 |
mkdocs-material | material/utilities/filter/config.py | .py | # Copyright (c) 2016-2025 Martin Donath <martin.donath@squidfunk.com>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, c... | 48 | 1,947 |
mkdocs-material | material/templates/__init__.py | .py | # Copyright (c) 2016-2025 Martin Donath <martin.donath@squidfunk.com>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, c... | 60 | 3,102 |
mkdocs-material | material/plugins/social/layout.py | .py | # Copyright (c) 2016-2025 Martin Donath <martin.donath@squidfunk.com>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, c... | 154 | 5,020 |
mkdocs-material | material/plugins/social/config.py | .py | # Copyright (c) 2016-2025 Martin Donath <martin.donath@squidfunk.com>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, c... | 69 | 2,845 |
mkdocs-material | material/plugins/social/plugin.py | .py | # Copyright (c) 2016-2025 Martin Donath <martin.donath@squidfunk.com>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, c... | 1,128 | 46,725 |
mkdocs-material | material/plugins/tags/config.py | .py | # Copyright (c) 2016-2025 Martin Donath <martin.donath@squidfunk.com>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, c... | 89 | 3,859 |
mkdocs-material | material/plugins/tags/plugin.py | .py | # Copyright (c) 2016-2025 Martin Donath <martin.donath@squidfunk.com>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, c... | 314 | 10,602 |
mkdocs-material | material/plugins/tags/renderer/__init__.py | .py | # Copyright (c) 2016-2025 Martin Donath <martin.donath@squidfunk.com>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, c... | 100 | 3,570 |
mkdocs-material | material/plugins/tags/structure/mapping/__init__.py | .py | # Copyright (c) 2016-2025 Martin Donath <martin.donath@squidfunk.com>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, c... | 99 | 3,532 |
mkdocs-material | material/plugins/tags/structure/mapping/storage/__init__.py | .py | # Copyright (c) 2016-2025 Martin Donath <martin.donath@squidfunk.com>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, c... | 212 | 6,407 |
mkdocs-material | material/plugins/tags/structure/mapping/manager/__init__.py | .py | # Copyright (c) 2016-2025 Martin Donath <martin.donath@squidfunk.com>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, c... | 255 | 8,402 |
mkdocs-material | material/plugins/tags/structure/listing/__init__.py | .py | # Copyright (c) 2016-2025 Martin Donath <martin.donath@squidfunk.com>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, c... | 224 | 7,935 |
mkdocs-material | material/plugins/tags/structure/listing/config.py | .py | # Copyright (c) 2016-2025 Martin Donath <martin.donath@squidfunk.com>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, c... | 116 | 4,226 |
mkdocs-material | material/plugins/tags/structure/listing/manager/__init__.py | .py | # Copyright (c) 2016-2025 Martin Donath <martin.donath@squidfunk.com>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, c... | 522 | 18,572 |
mkdocs-material | material/plugins/tags/structure/listing/manager/toc.py | .py | # Copyright (c) 2016-2025 Martin Donath <martin.donath@squidfunk.com>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, c... | 135 | 4,429 |
mkdocs-material | material/plugins/tags/structure/listing/tree/__init__.py | .py | # Copyright (c) 2016-2025 Martin Donath <martin.donath@squidfunk.com>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, c... | 166 | 5,088 |
mkdocs-material | material/plugins/tags/structure/tag/options.py | .py | # Copyright (c) 2016-2025 Martin Donath <martin.donath@squidfunk.com>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, c... | 109 | 3,916 |
mkdocs-material | material/plugins/tags/structure/tag/__init__.py | .py | # Copyright (c) 2016-2025 Martin Donath <martin.donath@squidfunk.com>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, c... | 179 | 4,963 |
mkdocs-material | material/plugins/tags/structure/tag/reference/__init__.py | .py | # Copyright (c) 2016-2025 Martin Donath <martin.donath@squidfunk.com>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, c... | 81 | 2,829 |
mkdocs-material | material/plugins/offline/plugin.py | .py | # Copyright (c) 2016-2025 Martin Donath <martin.donath@squidfunk.com>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, c... | 70 | 2,884 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.