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 |
|---|---|---|---|---|---|
certbot | certbot/src/certbot/_internal/tests/plugins/apache/fedora_test.py | .py | """Test for certbot._internal.plugins.apache.configurator for Fedora 29+ overrides"""
import sys
from unittest import mock
import pytest
from certbot import errors
from certbot.compat import filesystem
from certbot.compat import os
from certbot._internal.plugins.apache import obj
from certbot._internal.plugins.apache... | 196 | 8,233 |
certbot | certbot/src/certbot/_internal/tests/plugins/apache/http_01_test.py | .py | """Test for certbot._internal.plugins.apache.http_01."""
import errno
import sys
from unittest import mock
import pytest
from acme import challenges, messages
from certbot import achallenges
from certbot import errors
from certbot.compat import filesystem
from certbot.compat import os
from certbot.tests import acme_u... | 244 | 10,247 |
certbot | certbot/src/certbot/_internal/tests/plugins/apache/augeasnode_test.py | .py | """Tests for AugeasParserNode classes"""
import os
from unittest import mock
import pytest
from certbot import errors
from certbot._internal.plugins.apache import assertions
from certbot._internal.plugins.apache import augeasparser
from certbot._internal.tests.plugins.apache import util
def _get_augeasnode_mock(fil... | 321 | 13,007 |
certbot | certbot/src/certbot/_internal/tests/plugins/apache/gentoo_test.py | .py | """Test for certbot._internal.plugins.apache.configurator for Gentoo overrides"""
import sys
from unittest import mock
import pytest
from certbot import errors
from certbot.compat import filesystem
from certbot.compat import os
from certbot._internal.plugins.apache import obj
from certbot._internal.plugins.apache imp... | 137 | 5,654 |
certbot | certbot/src/certbot/_internal/tests/plugins/apache/constants_test.py | .py | """Tests for certbot._internal.plugins.apache.constants"""
import sys
import os.path
import pytest
from certbot._internal.plugins.apache import constants
def test_augeas_lens_dir_exists():
assert os.path.exists(constants.AUGEAS_LENS_DIR)
if __name__ == "__main__":
sys.exit(pytest.main(sys.argv[1:] + [__fi... | 16 | 348 |
certbot | certbot/src/certbot/_internal/tests/plugins/apache/obj_test.py | .py | """Tests for certbot._internal.plugins.apache.obj."""
import sys
import unittest
import pytest
class VirtualHostTest(unittest.TestCase):
"""Test the VirtualHost class."""
def setUp(self):
from certbot._internal.plugins.apache.obj import Addr
from certbot._internal.plugins.apache.obj import V... | 141 | 5,237 |
certbot | certbot/src/certbot/_internal/tests/plugins/apache/util.py | .py | """Common test utilities for the apache plugin."""
import shutil
from typing import Optional
import unittest
from unittest import mock
import augeas
import josepy as jose
from certbot import util
from certbot.compat import os
from certbot.plugins import common
from certbot.tests import util as test_util
from certbot.... | 242 | 11,230 |
certbot | certbot/src/certbot/_internal/tests/plugins/apache/__init__.py | .py | """certbot-apache tests"""
import pytest
# Make sure we're only running these tests if our apache plugin dependencies are installed
pytest.importorskip("augeas")
| 8 | 165 |
certbot | certbot/src/certbot/_internal/tests/plugins/apache/parsernode_util_test.py | .py | """ Tests for ParserNode utils """
import sys
import pytest
from certbot._internal.plugins.apache import parsernode_util as util
def _setup_parsernode():
""" Sets up kwargs dict for ParserNode """
return {
"ancestor": None,
"dirty": False,
"filepath": "/tmp",
}
def _setup_commen... | 121 | 3,283 |
certbot | certbot/src/certbot/_internal/tests/plugins/apache/parser_test.py | .py | """Tests for certbot._internal.plugins.apache.parser."""
import sys
from unittest import mock
import pytest
from certbot import errors
from certbot.compat import os
from certbot._internal.tests.plugins.apache import util
class BasicParserTest(util.ParserTest):
"""Apache Parser Test."""
def test_bad_parse(s... | 386 | 16,455 |
certbot | certbot/src/certbot/_internal/tests/plugins/apache/centos_test.py | .py | """Test for certbot._internal.plugins.apache.configurator for Centos overrides"""
import sys
from unittest import mock
import pytest
from certbot import errors
from certbot.compat import filesystem
from certbot.compat import os
from certbot._internal.plugins.apache import obj
from certbot._internal.plugins.apache imp... | 243 | 11,044 |
certbot | certbot/src/certbot/_internal/tests/plugins/apache/configurator_test.py | .py | # pylint: disable=too-many-lines
"""Test for certbot._internal.plugins.apache.configurator."""
import copy
import shutil
import socket
import sys
import tempfile
from unittest import mock
import pytest
from acme import challenges, messages
from certbot import achallenges
from certbot import crypto_util
from certbot i... | 1,793 | 79,907 |
certbot | certbot/src/certbot/_internal/tests/plugins/apache/autohsts_test.py | .py | # pylint: disable=too-many-lines
"""Test for certbot._internal.plugins.apache.configurator AutoHSTS functionality"""
import re
import sys
from unittest import mock
import pytest
from certbot import errors
from certbot._internal.plugins.apache import constants
from certbot._internal.tests.plugins.apache import util
... | 183 | 9,091 |
certbot | certbot/src/certbot/_internal/tests/plugins/apache/parsernode_configurator_test.py | .py | """Tests for ApacheConfigurator for AugeasParserNode classes"""
import importlib
import sys
import unittest
from unittest import mock
import pytest
from certbot._internal.tests.plugins.apache import util
if importlib.util.find_spec('apacheconfig'):
HAS_APACHECONFIG = True
else: # pragma: no cover
HAS_APACH... | 48 | 1,653 |
certbot | certbot/src/certbot/_internal/tests/plugins/apache/display_ops_test.py | .py | """Test certbot._internal.plugins.apache.display_ops."""
import sys
import unittest
from unittest import mock
import pytest
from certbot import errors
from certbot.display import util as display_util
from certbot.tests import util as certbot_util
from certbot._internal.plugins.apache import obj
from certbot._internal... | 107 | 3,820 |
certbot | certbot/src/certbot/_internal/tests/plugins/apache/dualnode_test.py | .py | """Tests for DualParserNode implementation"""
import unittest
from unittest import mock
from certbot._internal.plugins.apache import assertions
from certbot._internal.plugins.apache import augeasparser
from certbot._internal.plugins.apache import dualparser
import pytest
class DualParserNodeTest(unittest.TestCase): ... | 446 | 24,047 |
certbot | certbot/src/certbot/_internal/tests/plugins/apache/entrypoint_test.py | .py | """Test for certbot._internal.plugins.apache.entrypoint for override class resolution"""
import sys
from unittest import mock
import pytest
from certbot._internal.plugins.apache import configurator
from certbot._internal.plugins.apache import entrypoint
def test_get_configurator():
with mock.patch("certbot.util... | 43 | 1,742 |
certbot | certbot/src/certbot/_internal/tests/plugins/apache/debian_test.py | .py | """Test for certbot._internal.plugins.apache.configurator for Debian overrides"""
import shutil
import sys
from unittest import mock
import pytest
from certbot import errors
from certbot.compat import os
from certbot.tests import util as certbot_util
from certbot._internal.plugins.apache import apache_util
from certb... | 212 | 9,331 |
certbot | certbot/src/certbot/_internal/tests/plugins/apache/complex_parsing_test.py | .py | """Tests for certbot._internal.plugins.apache.parser."""
import sys
import pytest
from certbot import errors
from certbot.compat import os
from certbot._internal.tests.plugins.apache import util
class ComplexParserTest(util.ParserTest):
"""Apache Parser Test."""
def setUp(self): # pylint: disable=argument... | 122 | 4,264 |
certbot | certbot/src/certbot/_internal/tests/plugins/apache/parsernode_test.py | .py | """ Tests for ParserNode interface """
import sys
import pytest
from certbot._internal.plugins.apache import interfaces
from certbot._internal.plugins.apache import parsernode_util as util
class DummyParserNode(interfaces.ParserNode):
""" A dummy class implementing ParserNode interface """
def __init__(se... | 129 | 3,596 |
certbot | certbot/src/certbot/_internal/tests/plugins/apache/configurator_reverter_test.py | .py | """Test for certbot._internal.plugins.apache.configurator implementations of reverter"""
import sys
from unittest import mock
import pytest
from certbot import errors
from certbot._internal.tests.plugins.apache import util
class ConfiguratorReverterTest(util.ApacheTest):
"""Test for ApacheConfigurator reverter ... | 76 | 2,664 |
certbot | certbot/src/certbot/_internal/tests/plugins/apache/apache-conf-files/apache-conf-test-pebble.py | .py | #!/usr/bin/env python
"""
This executable script wraps the apache-conf-test bash script, in order to setup a pebble instance
before its execution. Directory URL is passed through the SERVER environment variable.
"""
import os
import subprocess
import sys
from certbot_integration_tests.utils import acme_server
SCRIPT_... | 27 | 752 |
certbot | certbot/src/certbot/_internal/cli/cli_constants.py | .py | """Certbot command line constants"""
cli_command = "certbot"
# Argparse's help formatting has a lot of unhelpful peculiarities, so we want
# to replace as much of it as we can...
# This is the stub to include in help generated by argparse
SHORT_USAGE = """
{0} [SUBCOMMAND] [options] [-d DOMAIN] [-d DOMAIN] ...
Ce... | 98 | 3,975 |
certbot | certbot/src/certbot/_internal/cli/subparsers.py | .py | """This module creates subparsers for the argument parser"""
from typing import TYPE_CHECKING
from certbot import interfaces
from certbot._internal import constants
from certbot._internal.cli.cli_utils import _EncodeReasonAction
from certbot._internal.cli.cli_utils import _user_agent_comment_type
from certbot._interna... | 74 | 4,192 |
certbot | certbot/src/certbot/_internal/cli/cli_utils.py | .py | """Certbot command line util function"""
import argparse
import copy
import glob
import inspect
from typing import Any
from typing import Iterable
from typing import Optional
from typing import Sequence
from typing import TYPE_CHECKING
from typing import Union
from acme import challenges
from certbot import configurat... | 291 | 11,163 |
certbot | certbot/src/certbot/_internal/cli/paths_parser.py | .py | """This is a module that adds configuration to the argument parser regarding
paths for certificates"""
from typing import TYPE_CHECKING
from typing import Union
from certbot._internal.cli.cli_utils import config_help
from certbot._internal.cli.cli_utils import flag_default
from certbot.compat import os
if TYPE_CHECKI... | 51 | 2,055 |
certbot | certbot/src/certbot/_internal/cli/__init__.py | .py | """Certbot command line argument & config processing."""
# pylint: disable=too-many-lines
# ruff: noqa: F401
import argparse
import logging
import logging.handlers
import sys
from typing import Any
from typing import List
from typing import Optional
from typing import Type
import certbot
from certbot.configuration imp... | 510 | 26,772 |
certbot | certbot/src/certbot/_internal/cli/helpful.py | .py | """Certbot command line argument parser"""
import argparse
import functools
import sys
from typing import Any
from typing import Iterable
from typing import Optional
from typing import Union
import configargparse
from cryptography import x509
from certbot import crypto_util
from certbot import errors
from certbot im... | 535 | 22,843 |
certbot | certbot/src/certbot/_internal/cli/group_adder.py | .py | """This module contains a function to add the groups of arguments for the help
display"""
from typing import TYPE_CHECKING
from certbot._internal.cli.verb_help import VERB_HELP
if TYPE_CHECKING:
from certbot._internal.cli import helpful
def _add_all_groups(helpful: "helpful.HelpfulArgumentParser") -> None:
... | 25 | 1,073 |
certbot | certbot/src/certbot/_internal/cli/verb_help.py | .py | """This module contain help information for verbs supported by certbot"""
from certbot._internal.cli.cli_constants import SHORT_USAGE
# The attributes here are:
# short: a string that will be displayed by "certbot -h commands"
# opts: a string that heads the section of flags with which this command is documented,
# ... | 106 | 5,223 |
certbot | certbot/src/certbot/_internal/cli/plugins_parsing.py | .py | """This is a module that handles parsing of plugins for the argument parser"""
from typing import TYPE_CHECKING
from certbot._internal.cli.cli_utils import flag_default
from certbot._internal.plugins import disco
if TYPE_CHECKING:
from certbot._internal.cli import helpful
def _plugins_parsing(helpful: "helpful.... | 101 | 6,210 |
certbot | certbot/src/certbot/_internal/plugins/webroot.py | .py | """Webroot plugin."""
import argparse
import collections
import json
import logging
from typing import Any
from typing import Callable
from typing import Iterable
from typing import Optional
from typing import Sequence
from typing import Union
from acme import challenges, messages
from certbot import crypto_util
from ... | 355 | 16,643 |
certbot | certbot/src/certbot/_internal/plugins/selection.py | .py | """Decide which plugins to use for authentication & installation"""
import logging
from typing import cast
from typing import Iterable
from typing import Optional
from typing import TypeVar
from certbot import configuration
from certbot import errors
from certbot import interfaces
from certbot._internal.plugins impor... | 372 | 15,699 |
certbot | certbot/src/certbot/_internal/plugins/standalone.py | .py | """Standalone Authenticator."""
import collections
import errno
import logging
from typing import Any
from typing import Callable
from typing import Iterable
from typing import TYPE_CHECKING
from acme import challenges
from acme import standalone as acme_standalone
from certbot import achallenges
from certbot import e... | 207 | 8,589 |
certbot | certbot/src/certbot/_internal/plugins/disco.py | .py | """Utilities for plugins discovery and selection."""
import logging
import sys
from typing import Callable
from typing import cast
from typing import Iterable
from typing import Iterator
from typing import Mapping
from typing import Optional
from typing import Union
from certbot import configuration
from certbot impor... | 286 | 11,334 |
certbot | certbot/src/certbot/_internal/plugins/null.py | .py | """Null plugin."""
import logging
from typing import Callable
from typing import Optional
from typing import Union
from certbot import interfaces
from certbot.plugins import common
logger = logging.getLogger(__name__)
class Installer(common.Plugin, interfaces.Installer):
"""Null installer."""
description =... | 59 | 1,555 |
certbot | certbot/src/certbot/_internal/plugins/manual.py | .py | """Manual authenticator plugin"""
import logging
from typing import Any
from typing import Callable
from typing import Iterable
from acme import challenges, messages
from certbot import achallenges
from certbot import errors
from certbot import interfaces
from certbot import reverter
from certbot import util
from cert... | 260 | 12,152 |
certbot | certbot/src/certbot/_internal/plugins/nginx/configurator.py | .py | # pylint: disable=too-many-lines
"""Nginx Configuration"""
import atexit
from contextlib import ExitStack
import logging
import importlib.resources
import re
import socket
import subprocess
import tempfile
import time
from typing import Any
from typing import Callable
from typing import Iterable
from typing import Mapp... | 1,333 | 56,645 |
certbot | certbot/src/certbot/_internal/plugins/nginx/parser.py | .py | """NginxParser is a member object of the NginxConfigurator class."""
from __future__ import annotations
import copy
import functools
import glob
import logging
import re
from typing import Any
from typing import Callable
from typing import cast
from typing import Iterable
from typing import Mapping
from typing import O... | 837 | 34,040 |
certbot | certbot/src/certbot/_internal/plugins/nginx/nginxparser.py | .py | """Very low-level nginx config parser based on pyparsing."""
# Forked from https://github.com/fatiherikli/nginxparser (MIT Licensed)
import copy
import logging
import operator
import typing
from typing import Any
from typing import IO
from typing import Iterable
from typing import Iterator
from typing import overload
f... | 325 | 11,884 |
certbot | certbot/src/certbot/_internal/plugins/nginx/http_01.py | .py | """A class that performs HTTP-01 challenges for Nginx"""
import logging
from typing import Any
from typing import Optional
from typing import TYPE_CHECKING
from acme import challenges, messages
from acme.challenges import KeyAuthorizationChallengeResponse
from certbot import errors
from certbot.achallenges import Key... | 245 | 10,071 |
certbot | certbot/src/certbot/_internal/plugins/nginx/display_ops.py | .py | """Contains UI methods for Nginx operations."""
import logging
from typing import Iterable
from typing import Optional
from certbot.display import util as display_util
from certbot._internal.plugins.nginx.obj import VirtualHost
logger = logging.getLogger(__name__)
def select_vhost_multiple(vhosts: Optional[Iterable... | 44 | 1,538 |
certbot | certbot/src/certbot/_internal/plugins/nginx/constants.py | .py | """nginx plugin constants."""
import platform
from typing import Any
FREEBSD_DARWIN_SERVER_ROOT = "/usr/local/etc/nginx"
LINUX_SERVER_ROOT = "/etc/nginx"
PKGSRC_SERVER_ROOT = "/usr/pkg/etc/nginx"
if platform.system() in ('FreeBSD', 'Darwin'):
server_root_tmp = FREEBSD_DARWIN_SERVER_ROOT
elif platform.system() in ... | 80 | 3,467 |
certbot | certbot/src/certbot/_internal/plugins/nginx/parser_obj.py | .py | # type: ignore
# This module is not used for now, so we just skip type checking for the sake
# of simplicity.
""" This file contains parsing routines and object classes to help derive meaning from
raw lists of tokens from pyparsing. """
import abc
import logging
from typing import Any
from typing import Callable
from ... | 409 | 15,979 |
certbot | certbot/src/certbot/_internal/plugins/nginx/obj.py | .py | """Module contains classes used by the Nginx Configurator."""
import re
from typing import Any
from typing import Optional
from typing import Sequence
from typing import Union
from certbot.plugins import common
ADD_HEADER_DIRECTIVE = 'add_header'
class SocketAddrError(Exception):
"""Raised when a UNIX-domain so... | 282 | 10,160 |
certbot | certbot/src/certbot/_internal/plugins/apache/override_arch.py | .py | """ Distribution specific override class for Arch Linux """
from certbot._internal.plugins.apache import configurator
from certbot._internal.plugins.apache.configurator import OsOptions
class ArchConfigurator(configurator.ApacheConfigurator):
"""Arch Linux specific ApacheConfigurator override class"""
OS_DEF... | 20 | 692 |
certbot | certbot/src/certbot/_internal/plugins/apache/configurator.py | .py | """Apache Configurator."""
# pylint: disable=too-many-lines
from collections import defaultdict
import copy
import fnmatch
import logging
import re
import socket
import time
from typing import Any
from typing import Callable
from typing import cast
from typing import Iterable
from typing import Optional
from typing imp... | 2,702 | 113,483 |
certbot | certbot/src/certbot/_internal/plugins/apache/apache_util.py | .py | """ Utility functions for certbot-apache plugin """
import atexit
import binascii
import fnmatch
import importlib.resources
import logging
import re
import subprocess
from contextlib import ExitStack
from typing import Iterable
from typing import Optional
from certbot import errors
from certbot import util
from certbo... | 255 | 7,543 |
certbot | certbot/src/certbot/_internal/plugins/apache/parser.py | .py | """ApacheParser is a member object of the ApacheConfigurator class."""
import copy
import fnmatch
import logging
import re
from typing import Collection
from typing import Iterable
from typing import Mapping
from typing import Optional
from typing import TYPE_CHECKING
from typing import Union
from certbot import error... | 961 | 36,740 |
certbot | certbot/src/certbot/_internal/plugins/apache/http_01.py | .py | """A class that performs HTTP-01 challenges for Apache"""
import errno
import logging
from typing import TYPE_CHECKING
from acme.challenges import KeyAuthorizationChallengeResponse
from acme import messages
from certbot import errors
from certbot.achallenges import KeyAuthorizationAnnotatedChallenge
from certbot.compa... | 208 | 8,699 |
certbot | certbot/src/certbot/_internal/plugins/apache/override_gentoo.py | .py | """ Distribution specific override class for Gentoo Linux """
from typing import Any
from certbot._internal.plugins.apache import apache_util
from certbot._internal.plugins.apache import configurator
from certbot._internal.plugins.apache import parser
from certbot._internal.plugins.apache.configurator import OsOptions... | 62 | 2,459 |
certbot | certbot/src/certbot/_internal/plugins/apache/display_ops.py | .py | """Contains UI methods for Apache operations."""
import logging
from typing import Iterable
from typing import Optional
from typing import Sequence
from certbot import errors
from certbot.compat import os
from certbot.display import util as display_util
from certbot._internal.plugins.apache.obj import VirtualHost
log... | 132 | 4,543 |
certbot | certbot/src/certbot/_internal/plugins/apache/constants.py | .py | """Apache plugin constants."""
import atexit
import importlib.resources
from contextlib import ExitStack
MOD_SSL_CONF_DEST = "options-ssl-apache.conf"
"""Name of the mod_ssl config file as saved
in `certbot.configuration.NamespaceConfig.config_dir`."""
UPDATED_MOD_SSL_CONF_DIGEST = ".updated-options-ssl-apache-conf... | 86 | 4,140 |
certbot | certbot/src/certbot/_internal/plugins/apache/entrypoint.py | .py | """ Entry point for Apache Plugin """
from certbot import util
from certbot._internal.plugins.apache import configurator
from certbot._internal.plugins.apache import override_alpine
from certbot._internal.plugins.apache import override_arch
from certbot._internal.plugins.apache import override_centos
from certbot._int... | 67 | 2,971 |
certbot | certbot/src/certbot/_internal/plugins/apache/augeasparser.py | .py | """
Augeas implementation of the ParserNode interfaces.
Augeas works internally by using XPATH notation. The following is a short example
of how this all works internally, to better understand what's going on under the
hood.
A configuration file /etc/apache2/apache2.conf with the following content:
# First comme... | 564 | 21,056 |
certbot | certbot/src/certbot/_internal/plugins/apache/override_fedora.py | .py | """ Distribution specific override class for Fedora 29+ """
from typing import Any
from certbot import errors
from certbot import util
from certbot._internal.plugins.apache import apache_util
from certbot._internal.plugins.apache import configurator
from certbot._internal.plugins.apache import parser
from certbot._int... | 89 | 3,492 |
certbot | certbot/src/certbot/_internal/plugins/apache/override_centos.py | .py | """ Distribution specific override class for CentOS family (RHEL, Fedora) """
import logging
from typing import Any
from certbot import errors
from certbot import util
from certbot._internal.plugins.apache import apache_util
from certbot._internal.plugins.apache import configurator
from certbot._internal.plugins.apach... | 124 | 4,732 |
certbot | certbot/src/certbot/_internal/plugins/apache/dualparser.py | .py | """ Dual ParserNode implementation """
from typing import Any
from typing import Generic
from typing import Iterable
from typing import Optional
from typing import TYPE_CHECKING
from typing import TypeVar
from certbot._internal.plugins.apache import apacheparser
from certbot._internal.plugins.apache import assertions
... | 332 | 15,027 |
certbot | certbot/src/certbot/_internal/plugins/apache/apacheparser.py | .py | """ apacheconfig implementation of the ParserNode interfaces """
from typing import Any
from typing import Iterable
from typing import Optional
from certbot._internal.plugins.apache import assertions
from certbot._internal.plugins.apache import interfaces
from certbot._internal.plugins.apache import parsernode_util as... | 183 | 8,055 |
certbot | certbot/src/certbot/_internal/plugins/apache/parsernode_util.py | .py | """ParserNode utils"""
from typing import Any
from typing import Iterable
from typing import Optional
from certbot._internal.plugins.apache.interfaces import ParserNode
def validate_kwargs(kwargs: dict[str, Any], required_names: Iterable[str]) -> dict[str, Any]:
"""
Ensures that the kwargs dict has all the e... | 137 | 5,782 |
certbot | certbot/src/certbot/_internal/plugins/apache/override_suse.py | .py | """ Distribution specific override class for OpenSUSE """
from certbot._internal.plugins.apache import configurator
from certbot._internal.plugins.apache.configurator import OsOptions
class OpenSUSEConfigurator(configurator.ApacheConfigurator):
"""OpenSUSE specific ApacheConfigurator override class"""
OS_DEF... | 20 | 686 |
certbot | certbot/src/certbot/_internal/plugins/apache/interfaces.py | .py | """ParserNode interface for interacting with configuration tree.
General description
-------------------
The ParserNode interfaces are designed to be able to contain all the parsing logic,
while allowing their users to interact with the configuration tree in a Pythonic
and well structured manner.
The structure allow... | 528 | 22,752 |
certbot | certbot/src/certbot/_internal/plugins/apache/override_alpine.py | .py | """ Distribution specific override class for Alpine Linux """
from certbot._internal.plugins.apache import configurator
from certbot._internal.plugins.apache.configurator import OsOptions
class AlpineConfigurator(configurator.ApacheConfigurator):
"""Alpine Linux specific ApacheConfigurator override class"""
... | 20 | 710 |
certbot | certbot/src/certbot/_internal/plugins/apache/override_debian.py | .py | """ Distribution specific override class for Debian family (Ubuntu/Debian) """
import logging
from certbot import errors
from certbot import util
from certbot.compat import filesystem
from certbot.compat import os
from certbot._internal.plugins.apache import apache_util
from certbot._internal.plugins.apache import con... | 130 | 5,325 |
certbot | certbot/src/certbot/_internal/plugins/apache/obj.py | .py | """Module contains classes used by the Apache Configurator."""
import re
from typing import Any
from typing import Iterable
from typing import Optional
from typing import Union
from certbot.plugins import common
from certbot._internal.plugins.apache.apacheparser import ApacheBlockNode
from certbot._internal.plugins.ap... | 263 | 9,289 |
certbot | certbot/src/certbot/_internal/plugins/apache/override_void.py | .py | """ Distribution specific override class for Void Linux """
from certbot._internal.plugins.apache import configurator
from certbot._internal.plugins.apache.configurator import OsOptions
class VoidConfigurator(configurator.ApacheConfigurator):
"""Void Linux specific ApacheConfigurator override class"""
OS_DEF... | 20 | 697 |
certbot | certbot/src/certbot/_internal/plugins/apache/assertions.py | .py | """Dual parser node assertions"""
import fnmatch
from typing import Any
from typing import Iterable
from typing import Optional
from typing import Union
from certbot._internal.plugins.apache import interfaces
from certbot._internal.plugins.apache.interfaces import CommentNode
from certbot._internal.plugins.apache.inte... | 165 | 5,909 |
certbot | certbot/src/certbot/_internal/plugins/apache/override_darwin.py | .py | """ Distribution specific override class for macOS """
from certbot._internal.plugins.apache import configurator
from certbot._internal.plugins.apache.configurator import OsOptions
class DarwinConfigurator(configurator.ApacheConfigurator):
"""macOS specific ApacheConfigurator override class"""
OS_DEFAULTS = ... | 18 | 620 |
changedetection.io | setup.py | .py | #!/usr/bin/env python
import os.path
import re
from setuptools import setup, find_packages
from setuptools.command.build_py import build_py
import shutil
here = os.path.abspath(os.path.dirname(__file__))
def read(*parts):
with open(os.path.join(here, *parts), 'r', encoding='utf-8') as f:
return f.read()... | 89 | 3,712 |
changedetection.io | changedetection.py | .py | #!/usr/bin/env python3
# Only exists for direct CLI usage
import changedetectionio
if __name__ == '__main__':
changedetectionio.main()
| 9 | 142 |
changedetection.io | changedetectionio/validate_url.py | .py | import ipaddress
import socket
from functools import lru_cache
from loguru import logger
from urllib.parse import urlparse, urlunparse, parse_qsl, urlencode, quote, unquote
def normalize_url_encoding(url):
"""
Safely encode a URL's query parameters, regardless of whether they're already encoded.
Why this... | 263 | 11,263 |
changedetection.io | changedetectionio/rss_tools.py | .py | """
RSS/Atom feed processing tools for changedetection.io
"""
from loguru import logger
import re
def cdata_in_document_to_text(html_content: str, render_anchor_tag_content=False) -> str:
"""
Process CDATA sections in HTML/XML content - inline replacement.
Args:
html_content: The HTML/XML conten... | 205 | 7,755 |
changedetection.io | changedetectionio/custom_queue.py | .py | import queue
import asyncio
from blinker import signal
from loguru import logger
class NotificationQueue(queue.Queue):
"""
Extended Queue that sends a 'notification_event' signal when notifications are added.
This class extends the standard Queue and adds a signal emission after a notification
is... | 538 | 20,739 |
changedetection.io | changedetectionio/pluggy_interface.py | .py | import pluggy
import os
import importlib
import sys
from loguru import logger
# Global plugin namespace for changedetection.io
PLUGIN_NAMESPACE = "changedetectionio"
hookspec = pluggy.HookspecMarker(PLUGIN_NAMESPACE)
hookimpl = pluggy.HookimplMarker(PLUGIN_NAMESPACE)
class ChangeDetectionSpec:
"""Hook specifica... | 694 | 26,934 |
changedetection.io | changedetectionio/queuedWatchMetaData.py | .py | from dataclasses import dataclass, field
from typing import Any
# So that we can queue some metadata in `item`
# https://docs.python.org/3/library/queue.html#queue.PriorityQueue
#
@dataclass(order=True)
class PrioritizedItem:
priority: int
item: Any=field(compare=False)
| 11 | 280 |
changedetection.io | changedetectionio/notification_service.py | .py | #!/usr/bin/env python3
"""
Notification Service Module
Extracted from update_worker.py to provide standalone notification functionality
for both sync and async workers
"""
import datetime
import pytz
from loguru import logger
import time
from changedetectionio.notification import default_notification_format, valid_n... | 574 | 27,100 |
changedetection.io | changedetectionio/languages.py | .py | """
Language configuration for i18n support
Automatically discovers available languages from translations directory
"""
import os
from pathlib import Path
def get_timeago_locale(flask_locale, short=False):
"""
Convert Flask-Babel locale codes to timeago library locale codes.
The Python timeago library (h... | 201 | 8,595 |
changedetection.io | changedetectionio/favicon_utils.py | .py | """
Favicon utilities for changedetection.io
Handles favicon MIME type detection with caching
"""
from functools import lru_cache
@lru_cache(maxsize=1000)
def get_favicon_mime_type(filepath):
"""
Detect MIME type of favicon by reading file content using puremagic.
Results are cached to avoid repeatedly r... | 44 | 1,075 |
changedetection.io | changedetectionio/strtobool.py | .py | # Because strtobool was removed in python 3.12 distutils
_MAP = {
'y': True,
'yes': True,
't': True,
'true': True,
'on': True,
'1': True,
'n': False,
'no': False,
'f': False,
'false': False,
'off': False,
'0': False
}
def strtobool(value):
if not value:
ret... | 26 | 473 |
changedetection.io | changedetectionio/__init__.py | .py | #!/usr/bin/env python3
# Read more https://github.com/dgtlmoon/changedetection.io/wiki
# Semver means never use .01, or 00. Should be .1.
__version__ = '0.55.8'
from changedetectionio.strtobool import strtobool
from json.decoder import JSONDecodeError
from loguru import logger
import getopt
import logging
import os
... | 700 | 31,691 |
changedetection.io | changedetectionio/flask_app.py | .py | #!/usr/bin/env python3
import flask_login
import locale
import os
import queue
import re
import sys
import threading
import time
import timeago
from blinker import signal
from pathlib import Path
from changedetectionio.strtobool import strtobool
from threading import Event
from changedetectionio.queue_handlers import... | 1,357 | 58,966 |
changedetection.io | changedetectionio/queue_handlers.py | .py | from blinker import signal
from loguru import logger
from typing import Dict, List, Any, Optional
import heapq
import queue
import threading
# Janus is no longer required - we use pure threading.Queue for multi-loop support
# try:
# import janus
# except ImportError:
# pass # Not needed anymore
class Rechec... | 561 | 24,854 |
changedetection.io | changedetectionio/worker.py | .py | from blinker import signal
from .processors.exceptions import ProcessorException
import changedetectionio.content_fetchers.exceptions as content_fetchers_exceptions
from changedetectionio.processors.text_json_diff.processor import FilterNotFoundInResponse
from changedetectionio import html_tools
from changedetectionio ... | 821 | 47,528 |
changedetection.io | changedetectionio/html_tools.py | .py | from functools import lru_cache
from loguru import logger
from typing import List
import html
import json
import os
import re
# HTML added to be sure each result matching a filter (.example) gets converted to a new line by Inscriptis
TEXT_FILTER_LIST_LINE_SUFFIX = "<br>"
TRANSLATE_WHITESPACE_TABLE = str.maketrans('',... | 860 | 37,740 |
changedetection.io | changedetectionio/auth_decorator.py | .py | import os
from functools import wraps
from flask import current_app, redirect, request
from loguru import logger
# Endpoints exempt from auth when `shared_diff_access` is enabled.
# Must be exact endpoint names — substring matching (GHSA-vwgh-2hvh-4xm5)
# let the state-changing `/diff/<uuid>/extract` endpoints slip th... | 43 | 1,835 |
changedetection.io | changedetectionio/is_safe_url.py | .py | """
URL redirect validation module for preventing open redirect vulnerabilities.
This module provides functionality to safely validate redirect URLs, ensuring they:
1. Point to internal routes only (no external redirects)
2. Are properly normalized (preventing browser parsing differences)
3. Match registered Flask rou... | 114 | 4,478 |
changedetection.io | changedetectionio/gc_cleanup.py | .py | #!/usr/bin/env python3
import ctypes
import gc
import re
import psutil
import sys
import threading
import importlib
from loguru import logger
def memory_cleanup(app=None):
"""
Perform comprehensive memory cleanup operations and log memory usage
at each step with nicely formatted numbers.
Args:
... | 162 | 6,871 |
changedetection.io | changedetectionio/forms.py | .py | import os
import re
from loguru import logger
from wtforms.widgets.core import TimeInput
from flask_babel import lazy_gettext as _l, gettext
from changedetectionio.blueprint.rss import RSS_FORMAT_TYPES, RSS_TEMPLATE_TYPE_OPTIONS, RSS_TEMPLATE_HTML_DEFAULT
from changedetectionio.llm.ui_strings import LLM_INTENT_WATCH_P... | 1,311 | 60,867 |
changedetection.io | changedetectionio/time_handler.py | .py | from functools import lru_cache
import arrow
from enum import IntEnum
class Weekday(IntEnum):
"""Enumeration for days of the week."""
Monday = 0
Tuesday = 1
Wednesday = 2
Thursday = 3
Friday = 4
Saturday = 5
Sunday = 6
def am_i_inside_time(
day_of_week: str,
time_str:... | 117 | 4,279 |
changedetection.io | changedetectionio/worker_pool.py | .py | """
Worker management module for changedetection.io
Handles asynchronous workers for dynamic worker scaling.
Each worker runs in its own thread with its own event loop for isolation.
"""
import asyncio
import os
import threading
import time
from concurrent.futures import ThreadPoolExecutor
from loguru import logger
... | 623 | 22,361 |
changedetection.io | changedetectionio/content_fetchers/puppeteer.py | .py | import asyncio
import gc
import json
import os
import websockets.exceptions
from urllib.parse import urlparse
from loguru import logger
from changedetectionio.content_fetchers import SCREENSHOT_MAX_HEIGHT_DEFAULT, visualselector_xpath_selectors, \
SCREENSHOT_SIZE_STITCH_THRESHOLD, SCREENSHOT_DEFAULT_QUALITY, XPAT... | 561 | 27,276 |
changedetection.io | changedetectionio/content_fetchers/playwright.py | .py | import asyncio
import gc
import json
import os
from urllib.parse import urlparse
from loguru import logger
from changedetectionio.content_fetchers import SCREENSHOT_MAX_HEIGHT_DEFAULT, visualselector_xpath_selectors, \
SCREENSHOT_SIZE_STITCH_THRESHOLD, SCREENSHOT_MAX_TOTAL_HEIGHT, XPATH_ELEMENT_JS, INSTOCK_DATA_J... | 475 | 22,593 |
changedetection.io | changedetectionio/content_fetchers/__init__.py | .py | import sys
from changedetectionio.strtobool import strtobool
from loguru import logger
from changedetectionio.content_fetchers.exceptions import BrowserStepsStepException
import os
# Visual Selector scraper - 'Button' is there because some sites have <button>OUT OF STOCK</button>.
visualselector_xpath_selectors = 'div... | 199 | 9,526 |
changedetection.io | changedetectionio/content_fetchers/requests.py | .py | from flask_babel import lazy_gettext as _l
from loguru import logger
from urllib.parse import urljoin, urlparse
import hashlib
import os
import re
import asyncio
from changedetectionio import strtobool
from changedetectionio.content_fetchers.exceptions import BrowserStepsInUnsupportedFetcher, EmptyReply, Non200ErrorCo... | 271 | 13,077 |
changedetection.io | changedetectionio/content_fetchers/webdriver_selenium.py | .py | import os
import time
from loguru import logger
from changedetectionio.content_fetchers.base import Fetcher
class fetcher(Fetcher):
if os.getenv("WEBDRIVER_URL"):
fetcher_description = f"WebDriver Chrome/Javascript via \"{os.getenv('WEBDRIVER_URL', '')}\""
else:
fetcher_description = "WebDriv... | 202 | 8,460 |
changedetection.io | changedetectionio/content_fetchers/base.py | .py | import os
from abc import abstractmethod
from loguru import logger
from pydantic import BaseModel
from changedetectionio.content_fetchers import BrowserStepsStepException
class FetcherCapabilities(BaseModel):
"""Typed view of what a content fetcher can do.
Single source of truth for the fetcher capability f... | 242 | 9,732 |
changedetection.io | changedetectionio/content_fetchers/screenshot_handler.py | .py | # Pages with a vertical height longer than this will use the 'stitch together' method.
# - Many GPUs have a max texture size of 16384x16384px (or lower on older devices).
# - If a page is taller than ~8000–10000px, it risks exceeding GPU memory limits.
# - This is especially important on headless Chromium, where Playw... | 99 | 3,915 |
changedetection.io | changedetectionio/content_fetchers/exceptions/__init__.py | .py | from loguru import logger
class Non200ErrorCodeReceived(Exception):
def __init__(self, status_code, url, screenshot=None, xpath_data=None, page_html=None):
# Set this so we can use it in other parts of the app
self.status_code = status_code
self.url = url
self.screenshot = screensho... | 98 | 3,110 |
changedetection.io | changedetectionio/diff/__init__.py | .py | """
Diff rendering module for change detection.
This module provides functions for rendering differences between text content,
with support for various output formats and tokenization strategies.
"""
import difflib
from typing import List, Iterator, Union
from loguru import logger
import diff_match_patch as dmp_modul... | 522 | 22,517 |
changedetection.io | changedetectionio/diff/tokenizers/natural_text.py | .py | """
Simple word tokenizer using whitespace boundaries.
This is a simpler tokenizer that treats all whitespace as token boundaries
without special handling for HTML tags or other markup.
"""
from typing import List
def tokenize_words(text: str) -> List[str]:
"""
Split text into words using simple whitespace ... | 45 | 1,048 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.