diff --git a/.changes/unreleased/Dependencies-20240509-093717.yaml b/.changes/unreleased/Dependencies-20240509-093717.yaml new file mode 100644 index 00000000000..82094a3e122 --- /dev/null +++ b/.changes/unreleased/Dependencies-20240509-093717.yaml @@ -0,0 +1,6 @@ +kind: Dependencies +body: Remove logbook dependency +time: 2024-05-09T09:37:17.745129-05:00 +custom: + Author: emmyoop + Issue: "8027" diff --git a/core/dbt/README.md b/core/dbt/README.md index 79123a95f47..6b545ceb888 100644 --- a/core/dbt/README.md +++ b/core/dbt/README.md @@ -22,8 +22,6 @@ ### links.py -### logger.py - ### main.py ### node_types.py diff --git a/core/dbt/artifacts/schemas/base.py b/core/dbt/artifacts/schemas/base.py index c1a8f0b65de..c807257a24b 100644 --- a/core/dbt/artifacts/schemas/base.py +++ b/core/dbt/artifacts/schemas/base.py @@ -88,7 +88,7 @@ def inner(cls: Type[VersionedSchema]): return inner -# This is used in the ArtifactMixin and RemoteResult classes +# This is used in the ArtifactMixin and RemoteCompileResultMixin classes @dataclasses.dataclass class VersionedSchema(dbtClassMixin): dbt_schema_version: ClassVar[SchemaVersion] diff --git a/core/dbt/cli/main.py b/core/dbt/cli/main.py index 387fbc09359..91d9d1d7668 100644 --- a/core/dbt/cli/main.py +++ b/core/dbt/cli/main.py @@ -104,7 +104,6 @@ def global_flags(func): @p.deprecated_favor_state @p.deprecated_print @p.deprecated_state - @p.enable_legacy_logger @p.fail_fast @p.favor_state @p.indirect_selection diff --git a/core/dbt/cli/params.py b/core/dbt/cli/params.py index 701bc95a19d..0c24597a3bc 100644 --- a/core/dbt/cli/params.py +++ b/core/dbt/cli/params.py @@ -91,12 +91,6 @@ is_flag=True, ) -enable_legacy_logger = click.option( - "--enable-legacy-logger/--no-enable-legacy-logger", - envvar="DBT_ENABLE_LEGACY_LOGGER", - hidden=True, -) - exclude = click.option( "--exclude", envvar=None, diff --git a/core/dbt/contracts/sql.py b/core/dbt/contracts/sql.py index 168ceb3e937..931290039bf 100644 --- a/core/dbt/contracts/sql.py +++ b/core/dbt/contracts/sql.py @@ -7,7 +7,6 @@ from dbt.artifacts.schemas.results import ExecutionResult, TimingInfo from dbt.artifacts.schemas.run import RunExecutionResult, RunResult, RunResultsArtifact from dbt.contracts.graph.nodes import ResultNode -from dbt.logger import LogMessage from dbt_common.dataclass_schema import dbtClassMixin TaskTags = Optional[Dict[str, Any]] @@ -17,12 +16,7 @@ @dataclass -class RemoteResult(VersionedSchema): - logs: List[LogMessage] - - -@dataclass -class RemoteCompileResultMixin(RemoteResult): +class RemoteCompileResultMixin(VersionedSchema): raw_code: str compiled_code: str node: ResultNode @@ -41,7 +35,7 @@ def error(self): @dataclass @schema_version("remote-execution-result", 1) -class RemoteExecutionResult(ExecutionResult, RemoteResult): +class RemoteExecutionResult(ExecutionResult): results: Sequence[RunResult] args: Dict[str, Any] = field(default_factory=dict) generated_at: datetime = field(default_factory=datetime.utcnow) @@ -59,14 +53,12 @@ def write(self, path: str): def from_local_result( cls, base: RunExecutionResult, - logs: List[LogMessage], ) -> "RemoteExecutionResult": return cls( generated_at=base.generated_at, results=base.results, elapsed_time=base.elapsed_time, args=base.args, - logs=logs, ) diff --git a/core/dbt/flags.py b/core/dbt/flags.py index 367e1007aa5..bcacf5d3e8f 100644 --- a/core/dbt/flags.py +++ b/core/dbt/flags.py @@ -1,24 +1,6 @@ # Do not import the os package because we expose this package in jinja from argparse import Namespace -from os import getenv as os_getenv from pathlib import Path -from typing import Optional - - -# for setting up logger for legacy logger -def env_set_truthy(key: str) -> Optional[str]: - """Return the value if it was set to a "truthy" string value or None - otherwise. - """ - value = os_getenv(key) - if not value or value.lower() in ("0", "false", "f"): - return None - return value - - -# for setting up logger for legacy logger -ENABLE_LEGACY_LOGGER = env_set_truthy("DBT_ENABLE_LEGACY_LOGGER") - # this roughly follows the patten of EVENT_MANAGER in dbt/common/events/functions.py # During de-globlization, we'll need to handle both similarly diff --git a/core/dbt/logger.py b/core/dbt/logger.py deleted file mode 100644 index a3aef80f002..00000000000 --- a/core/dbt/logger.py +++ /dev/null @@ -1,523 +0,0 @@ -import json -import logging -import sys -import time -import warnings -from dataclasses import dataclass -from datetime import datetime -from typing import Any, Callable, ContextManager, Dict, List, Optional, Set - -import logbook - -import dbt.flags -import dbt_common.ui -from dbt_common.context import get_invocation_context -from dbt_common.dataclass_schema import dbtClassMixin - -STDOUT_LOG_FORMAT = "{record.message}" -DEBUG_LOG_FORMAT = "{record.time:%Y-%m-%d %H:%M:%S.%f%z} ({record.thread_name}): {record.message}" - - -def get_secret_env() -> List[str]: - return get_invocation_context().env_secrets - - -ExceptionInformation = str - - -@dataclass -class LogMessage(dbtClassMixin): - timestamp: datetime - message: str - channel: str - level: int - levelname: str - thread_name: str - process: int - extra: Optional[Dict[str, Any]] = None - exc_info: Optional[ExceptionInformation] = None - - @classmethod - def from_record_formatted(cls, record: logbook.LogRecord, message: str): - extra = dict(record.extra) - log_message = LogMessage( - timestamp=record.time, - message=message, - channel=record.channel, - level=record.level, - levelname=logbook.get_level_name(record.level), - extra=extra, - thread_name=record.thread_name, - process=record.process, - exc_info=record.formatted_exception, - ) - return log_message - - -class LogMessageFormatter(logbook.StringFormatter): - def __call__(self, record, handler): - data = self.format_record(record, handler) - exc = self.format_exception(record) - if exc: - data.exc_info = exc - return data - - def format_record(self, record, handler): - message = super().format_record(record, handler) - return LogMessage.from_record_formatted(record, message) - - -class JsonFormatter(LogMessageFormatter): - def __call__(self, record, handler): - """Return a the record converted to LogMessage's JSON form""" - # utils imports exceptions which imports logger... - import dbt.utils - - log_message = super().__call__(record, handler) - dct = log_message.to_dict(omit_none=True) - return json.dumps(dct, cls=dbt.utils.JSONEncoder) - - -class FormatterMixin: - def __init__(self, format_string) -> None: - self._text_format_string = format_string - self.formatter_class = logbook.StringFormatter - # triggers a formatter update via logbook.StreamHandler - self.format_string = self._text_format_string - - def format_json(self): - # set our formatter to the json formatter - self.formatter_class = JsonFormatter - self.format_string = STDOUT_LOG_FORMAT - - def format_text(self): - # set our formatter to the regular stdout/stderr handler - self.formatter_class = logbook.StringFormatter - self.format_string = self._text_format_string - - def reset(self): - raise NotImplementedError("reset() not implemented in FormatterMixin subclass") - - -class OutputHandler(logbook.StreamHandler, FormatterMixin): - """Output handler. - - The `format_string` parameter only changes the default text output, not - debug mode or json. - """ - - def __init__( - self, - stream, - level=logbook.INFO, - format_string=STDOUT_LOG_FORMAT, - bubble=True, - ) -> None: - self._default_format = format_string - logbook.StreamHandler.__init__( - self, - stream=stream, - level=level, - format_string=format_string, - bubble=bubble, - ) - FormatterMixin.__init__(self, format_string) - - def set_text_format(self, format_string: str): - """Set the text format to format_string. In JSON output mode, this is - a noop. - """ - if self.formatter_class is logbook.StringFormatter: - # reset text format - self._text_format_string = format_string - self.format_text() - - def reset(self): - self.level = logbook.INFO - self._text_format_string = self._default_format - self.format_text() - - def should_handle(self, record): - if record.level < self.level: - return False - text_mode = self.formatter_class is logbook.StringFormatter - if text_mode and record.extra.get("json_only", False): - return False - elif not text_mode and record.extra.get("text_only", False): - return False - else: - return True - - -def _root_channel(record: logbook.LogRecord) -> str: - return record.channel.split(".")[0] - - -class Relevel(logbook.Processor): - def __init__( - self, - allowed: List[str], - min_level=logbook.WARNING, - target_level=logbook.DEBUG, - ) -> None: - self.allowed: Set[str] = set(allowed) - self.min_level = min_level - self.target_level = target_level - super().__init__() - - def process(self, record): - if _root_channel(record) in self.allowed: - return - record.extra["old_level"] = record.level - # suppress logs at/below our min level by lowering them to NOTSET - if record.level < self.min_level: - record.level = logbook.NOTSET - # if we didn't mess with it, then lower all logs above our level to - # our target level. - else: - record.level = self.target_level - - -class TextOnly(logbook.Processor): - def process(self, record): - record.extra["text_only"] = True - - -class TimingProcessor(logbook.Processor): - def __init__(self, timing_info: Optional[dbtClassMixin] = None) -> None: - self.timing_info = timing_info - super().__init__() - - def process(self, record): - if self.timing_info is not None: - record.extra["timing_info"] = self.timing_info.to_dict(omit_none=True) - - -class DbtProcessState(logbook.Processor): - def __init__(self, value: str) -> None: - self.value = value - super().__init__() - - def process(self, record): - overwrite = "run_state" not in record.extra or record.extra["run_state"] == "internal" - if overwrite: - record.extra["run_state"] = self.value - - -class DbtModelState(logbook.Processor): - def __init__(self, state: Dict[str, str]) -> None: - self.state = state - super().__init__() - - def process(self, record): - record.extra.update(self.state) - - -class DbtStatusMessage(logbook.Processor): - def process(self, record): - record.extra["is_status_message"] = True - - -class UniqueID(logbook.Processor): - def __init__(self, unique_id: str) -> None: - self.unique_id = unique_id - super().__init__() - - def process(self, record): - record.extra["unique_id"] = self.unique_id - - -class NodeCount(logbook.Processor): - def __init__(self, node_count: int) -> None: - self.node_count = node_count - super().__init__() - - def process(self, record): - record.extra["node_count"] = self.node_count - - -class NodeMetadata(logbook.Processor): - def __init__(self, node, index) -> None: - self.node = node - self.index = index - super().__init__() - - def mapping_keys(self): - return [] - - def process_keys(self, record): - for attr, key in self.mapping_keys(): - value = getattr(self.node, attr, None) - if value is not None: - record.extra[key] = value - - def process(self, record): - self.process_keys(record) - record.extra["node_index"] = self.index - - -class ModelMetadata(NodeMetadata): - def mapping_keys(self): - return [ - ("alias", "node_alias"), - ("schema", "node_schema"), - ("database", "node_database"), - ("original_file_path", "node_path"), - ("name", "node_name"), - ("resource_type", "resource_type"), - ("depends_on_nodes", "depends_on"), - ] - - def process_config(self, record): - if hasattr(self.node, "config"): - materialized = getattr(self.node.config, "materialized", None) - if materialized is not None: - record.extra["node_materialized"] = materialized - - def process(self, record): - super().process(record) - self.process_config(record) - - -class HookMetadata(NodeMetadata): - def mapping_keys(self): - return [ - ("name", "node_name"), - ("resource_type", "resource_type"), - ] - - -class TimestampNamed(logbook.Processor): - def __init__(self, name: str) -> None: - self.name = name - super().__init__() - - def process(self, record): - super().process(record) - record.extra[self.name] = datetime.utcnow().isoformat() - - -class ScrubSecrets(logbook.Processor): - def process(self, record): - for secret in get_secret_env(): - record.message = str(record.message).replace(secret, "*****") - - -logger = logbook.Logger("dbt") -# provide this for the cache, disabled by default -CACHE_LOGGER = logbook.Logger("dbt.cache") -CACHE_LOGGER.disable() - -warnings.filterwarnings("ignore", category=ResourceWarning, message="unclosed.*") - -initialized = False - - -def make_log_dir_if_missing(log_dir): - import dbt_common.clients.system - - dbt_common.clients.system.make_directory(log_dir) - - -class DebugWarnings(logbook.compat.redirected_warnings): - """Log warnings, except send them to 'debug' instead of 'warning' level.""" - - def make_record(self, message, exception, filename, lineno): - rv = super().make_record(message, exception, filename, lineno) - rv.level = logbook.DEBUG - rv.extra["from_warnings"] = True - return rv - - -# push Python warnings to debug level logs. This will suppress all import-time -# warnings. -DebugWarnings().__enter__() - - -class LogManager(logbook.NestedSetup): - def __init__(self, stdout=sys.stdout, stderr=sys.stderr) -> None: - self.stdout = stdout - self.stderr = stderr - self._null_handler = logbook.NullHandler() - self._output_handler = OutputHandler(self.stdout) - self._relevel_processor = Relevel(allowed=["dbt", "werkzeug"]) - self._state_processor = DbtProcessState("internal") - self._scrub_processor = ScrubSecrets() - # keep track of whether we've already entered to decide if we should - # be actually pushing. This allows us to log in main() and also - # support entering dbt execution via handle_and_check. - self._stack_depth = 0 - super().__init__( - [ - self._null_handler, - self._output_handler, - self._relevel_processor, - self._state_processor, - self._scrub_processor, - ] - ) - - def push_application(self): - self._stack_depth += 1 - if self._stack_depth == 1: - super().push_application() - - def pop_application(self): - self._stack_depth -= 1 - if self._stack_depth == 0: - super().pop_application() - - def disable(self): - self.add_handler(logbook.NullHandler()) - - def add_handler(self, handler): - """add an handler to the log manager that runs before the file handler.""" - self.objects.append(handler) - - def set_path(self, _): - """No-op that allows dbt-rpc to not break. See GH #7661""" - pass - - @property - def initialized(self): - """Dummy return value for dbt-rpc. See GH#7661""" - return True - - # this is used by `dbt ls` to allow piping stdout to jq, etc - def stderr_console(self): - """Output to stderr at WARNING level instead of stdout""" - self._output_handler.stream = self.stderr - self._output_handler.level = logbook.WARNING - - def stdout_console(self): - """enable stdout and disable stderr""" - self._output_handler.stream = self.stdout - self._output_handler.level = logbook.INFO - - def set_debug(self): - self._output_handler.set_text_format(DEBUG_LOG_FORMAT) - self._output_handler.level = logbook.DEBUG - - def format_json(self): - for handler in self.objects: - if isinstance(handler, FormatterMixin): - handler.format_json() - - def format_text(self): - for handler in self.objects: - if isinstance(handler, FormatterMixin): - handler.format_text() - - def reset_handlers(self): - """Reset the handlers to their defaults. This is nice in testing!""" - self.stdout_console() - for handler in self.objects: - if isinstance(handler, FormatterMixin): - handler.reset() - - def set_output_stream(self, stream, error=None): - if error is None: - error = stream - - if self._output_handler.stream is self.stdout: - self._output_handler.stream = stream - elif self._output_handler.stream is self.stderr: - self._output_handler.stream = error - - self.stdout = stream - self.stderr = error - - -log_manager = LogManager() - - -def log_cache_events(flag): - """Set the cache logger to propagate its messages based on the given flag.""" - # the flag is True if we should log, and False if we shouldn't, so disabled - # is the inverse. - CACHE_LOGGER.disabled = not flag - - -if not dbt.flags.ENABLE_LEGACY_LOGGER: - logger.disable() -GLOBAL_LOGGER = logger - - -class LogMessageHandler(logbook.Handler): - formatter_class = LogMessageFormatter - - def format_logmessage(self, record): - """Format a LogRecord into a LogMessage""" - message = self.format(record) - return LogMessage.from_record_formatted(record, message) - - -class ListLogHandler(LogMessageHandler): - def __init__( - self, - level: int = logbook.NOTSET, - filter: Optional[Callable] = None, - bubble: bool = False, - lst: Optional[List[LogMessage]] = None, - ) -> None: - super().__init__(level, filter, bubble) - if lst is None: - lst = [] - self.records: List[LogMessage] = lst - - def should_handle(self, record): - """Only ever emit dbt-sourced log messages to the ListHandler.""" - if _root_channel(record) != "dbt": - return False - return super().should_handle(record) - - def emit(self, record: logbook.LogRecord): - as_dict = self.format_logmessage(record) - self.records.append(as_dict) - - -def _env_log_level(var_name: str) -> int: - # convert debugging environment variable name to a log level - if dbt.flags.env_set_truthy(var_name): - return logging.DEBUG - else: - return logging.ERROR - - -LOG_LEVEL_GOOGLE = _env_log_level("DBT_GOOGLE_DEBUG_LOGGING") -LOG_LEVEL_SNOWFLAKE = _env_log_level("DBT_SNOWFLAKE_CONNECTOR_DEBUG_LOGGING") -LOG_LEVEL_BOTOCORE = _env_log_level("DBT_BOTOCORE_DEBUG_LOGGING") -LOG_LEVEL_HTTP = _env_log_level("DBT_HTTP_DEBUG_LOGGING") -LOG_LEVEL_WERKZEUG = _env_log_level("DBT_WERKZEUG_DEBUG_LOGGING") - -logging.getLogger("botocore").setLevel(LOG_LEVEL_BOTOCORE) -logging.getLogger("requests").setLevel(LOG_LEVEL_HTTP) -logging.getLogger("urllib3").setLevel(LOG_LEVEL_HTTP) -logging.getLogger("google").setLevel(LOG_LEVEL_GOOGLE) -logging.getLogger("snowflake.connector").setLevel(LOG_LEVEL_SNOWFLAKE) - -logging.getLogger("parsedatetime").setLevel(logging.ERROR) -logging.getLogger("werkzeug").setLevel(LOG_LEVEL_WERKZEUG) - - -def list_handler( - lst: Optional[List[LogMessage]], - level=logbook.NOTSET, -) -> ContextManager: - """Return a context manager that temporarily attaches a list to the logger.""" - return ListLogHandler(lst=lst, level=level, bubble=True) - - -def get_timestamp(): - return time.strftime("%H:%M:%S") - - -def timestamped_line(msg: str) -> str: - return "{} | {}".format(get_timestamp(), msg) - - -def print_timestamped_line(msg: str, use_color: Optional[str] = None): - if use_color is not None: - msg = dbt_common.ui.color(msg, use_color) - - GLOBAL_LOGGER.info(timestamped_line(msg)) diff --git a/core/dbt/parser/manifest.py b/core/dbt/parser/manifest.py index 0ab35110a66..fb9006df14b 100644 --- a/core/dbt/parser/manifest.py +++ b/core/dbt/parser/manifest.py @@ -84,7 +84,6 @@ scrub_secrets, ) from dbt.flags import get_flags -from dbt.logger import DbtProcessState from dbt.mp_context import get_mp_context from dbt.node_types import AccessType, NodeType from dbt.parser.analysis import AnalysisParser @@ -120,7 +119,6 @@ from dbt_common.exceptions.base import DbtValidationError from dbt_common.helper_types import PathSet -PARSING_STATE = DbtProcessState("parsing") PERF_INFO_FILE_NAME = "perf_info.json" @@ -293,33 +291,32 @@ def get_full_manifest( file_diff_dct = read_json(file_diff_path) file_diff = FileDiff.from_dict(file_diff_dct) - with PARSING_STATE: # set up logbook.Processor for parsing - # Start performance counting - start_load_all = time.perf_counter() + # Start performance counting + start_load_all = time.perf_counter() - projects = config.load_dependencies() - loader = cls( - config, - projects, - macro_hook=macro_hook, - file_diff=file_diff, - ) + projects = config.load_dependencies() + loader = cls( + config, + projects, + macro_hook=macro_hook, + file_diff=file_diff, + ) - manifest = loader.load() + manifest = loader.load() - _check_manifest(manifest, config) - manifest.build_flat_graph() + _check_manifest(manifest, config) + manifest.build_flat_graph() - # This needs to happen after loading from a partial parse, - # so that the adapter has the query headers from the macro_hook. - loader.save_macros_to_adapter(adapter) + # This needs to happen after loading from a partial parse, + # so that the adapter has the query headers from the macro_hook. + loader.save_macros_to_adapter(adapter) - # Save performance info - loader._perf_info.load_all_elapsed = time.perf_counter() - start_load_all - loader.track_project_load() + # Save performance info + loader._perf_info.load_all_elapsed = time.perf_counter() - start_load_all + loader.track_project_load() - if write_perf_info: - loader.write_perf_info(config.project_target_path) + if write_perf_info: + loader.write_perf_info(config.project_target_path) return manifest @@ -1066,18 +1063,16 @@ def load_macros( macro_hook: Callable[[Manifest], Any], base_macros_only=False, ) -> Manifest: - with PARSING_STATE: - # base_only/base_macros_only: for testing only, - # allows loading macros without running 'dbt deps' first - projects = root_config.load_dependencies(base_only=base_macros_only) + # base_only/base_macros_only: for testing only, + # allows loading macros without running 'dbt deps' first + projects = root_config.load_dependencies(base_only=base_macros_only) - # This creates a loader object, including result, - # and then throws it away, returning only the - # manifest - loader = cls(root_config, projects, macro_hook) - macro_manifest = loader.create_macro_manifest() + # This creates a loader object, including result, + # and then throws it away, returning only the + # manifest + loader = cls(root_config, projects, macro_hook) - return macro_manifest + return loader.create_macro_manifest() # Create tracking event for saving performance info def track_project_load(self): diff --git a/core/dbt/task/base.py b/core/dbt/task/base.py index 2a1944a63b9..dfade18f1ab 100644 --- a/core/dbt/task/base.py +++ b/core/dbt/task/base.py @@ -41,7 +41,6 @@ ) from dbt.flags import get_flags from dbt.graph import Graph -from dbt.logger import log_manager from dbt.task.printer import print_run_result_error from dbt_common.events.contextvars import get_node_info from dbt_common.events.functions import fire_event @@ -72,21 +71,6 @@ class BaseTask(metaclass=ABCMeta): def __init__(self, args: Flags) -> None: self.args = args - @classmethod - def pre_init_hook(cls, args: Flags): - """A hook called before the task is initialized.""" - if args.log_format == "json": - log_manager.format_json() - else: - log_manager.format_text() - - @classmethod - def set_log_format(cls): - if get_flags().LOG_FORMAT == "json": - log_manager.format_json() - else: - log_manager.format_text() - @abstractmethod def run(self): raise dbt_common.exceptions.base.NotImplementedError("Not Implemented") diff --git a/core/dbt/task/printer.py b/core/dbt/task/printer.py index 54c40b7fd03..953a967b4a2 100644 --- a/core/dbt/task/printer.py +++ b/core/dbt/task/printer.py @@ -12,9 +12,7 @@ SQLCompiledPath, StatsLine, ) -from dbt.logger import DbtStatusMessage, TextOnly from dbt.node_types import NodeType -from dbt.tracking import InvocationProcessor from dbt_common.events.format import pluralize from dbt_common.events.functions import fire_event from dbt_common.events.types import Formatting @@ -65,15 +63,13 @@ def print_run_status_line(results) -> None: stats[result_type] += 1 stats["total"] += 1 - with TextOnly(): - fire_event(Formatting("")) + fire_event(Formatting("")) fire_event(StatsLine(stats=stats)) def print_run_result_error(result, newline: bool = True, is_warning: bool = False) -> None: if newline: - with TextOnly(): - fire_event(Formatting("")) + fire_event(Formatting("")) # set node_info for logging events node_info = None @@ -108,13 +104,11 @@ def print_run_result_error(result, newline: bool = True, is_warning: bool = Fals fire_event(RunResultErrorNoMessage(status=result.status, node_info=node_info)) if result.node.compiled_path is not None: - with TextOnly(): - fire_event(Formatting("")) + fire_event(Formatting("")) fire_event(SQLCompiledPath(path=result.node.compiled_path, node_info=node_info)) if result.node.should_store_failures: - with TextOnly(): - fire_event(Formatting("")) + fire_event(Formatting("")) fire_event( CheckNodeTestFailure(relation_name=result.node.relation_name, node_info=node_info) ) @@ -135,21 +129,19 @@ def print_run_end_messages(results, keyboard_interrupt: bool = False) -> None: elif r.status == NodeStatus.Warn: warnings.append(r) - with DbtStatusMessage(), InvocationProcessor(): - with TextOnly(): - fire_event(Formatting("")) - fire_event( - EndOfRunSummary( - num_errors=len(errors), - num_warnings=len(warnings), - keyboard_interrupt=keyboard_interrupt, - ) + fire_event(Formatting("")) + fire_event( + EndOfRunSummary( + num_errors=len(errors), + num_warnings=len(warnings), + keyboard_interrupt=keyboard_interrupt, ) + ) - for error in errors: - print_run_result_error(error, is_warning=False) + for error in errors: + print_run_result_error(error, is_warning=False) - for warning in warnings: - print_run_result_error(warning, is_warning=True) + for warning in warnings: + print_run_result_error(warning, is_warning=True) - print_run_status_line(results) + print_run_status_line(results) diff --git a/core/dbt/task/run.py b/core/dbt/task/run.py index 808f9596c67..6263ee66b46 100644 --- a/core/dbt/task/run.py +++ b/core/dbt/task/run.py @@ -35,7 +35,6 @@ from dbt.exceptions import CompilationError, DbtInternalError, DbtRuntimeError from dbt.graph import ResourceTypeSelector from dbt.hooks import get_hook_dict -from dbt.logger import DbtModelState, HookMetadata, TextOnly, TimestampNamed, UniqueID from dbt.node_types import NodeType, RunHookType from dbt_common.dataclass_schema import dbtClassMixin from dbt_common.events.base_types import EventLevel @@ -347,13 +346,9 @@ def run_hooks(self, adapter, hook_type: RunHookType, extra_context) -> None: return num_hooks = len(ordered_hooks) - with TextOnly(): - fire_event(Formatting("")) + fire_event(Formatting("")) fire_event(HooksRunning(num_hooks=num_hooks, hook_type=hook_type)) - startctx = TimestampNamed("node_started_at") - finishctx = TimestampNamed("node_finished_at") - for idx, hook in enumerate(ordered_hooks, start=1): # We want to include node_info in the appropriate log files, so use # log_contextvars @@ -364,47 +359,42 @@ def run_hooks(self, adapter, hook_type: RunHookType, extra_context) -> None: sql = self.get_hook_sql(adapter, hook, idx, num_hooks, extra_context) hook_text = "{}.{}.{}".format(hook.package_name, hook_type, hook.index) - hook_meta_ctx = HookMetadata(hook, self.index_offset(idx)) - with UniqueID(hook.unique_id): - with hook_meta_ctx, startctx: - fire_event( - LogHookStartLine( - statement=hook_text, - index=idx, - total=num_hooks, - node_info=hook.node_info, - ) - ) - - with Timer() as timer: - if len(sql.strip()) > 0: - response, _ = adapter.execute(sql, auto_begin=False, fetch=False) - status = response._message - else: - status = "OK" - - self.ran_hooks.append(hook) - hook.update_event_status(finished_at=datetime.utcnow().isoformat()) - with finishctx, DbtModelState({"node_status": "passed"}): - hook.update_event_status(node_status=RunStatus.Success) - fire_event( - LogHookEndLine( - statement=hook_text, - status=status, - index=idx, - total=num_hooks, - execution_time=timer.elapsed, - node_info=hook.node_info, - ) - ) + fire_event( + LogHookStartLine( + statement=hook_text, + index=idx, + total=num_hooks, + node_info=hook.node_info, + ) + ) + + with Timer() as timer: + if len(sql.strip()) > 0: + response, _ = adapter.execute(sql, auto_begin=False, fetch=False) + status = response._message + else: + status = "OK" + + self.ran_hooks.append(hook) + hook.update_event_status(finished_at=datetime.utcnow().isoformat()) + hook.update_event_status(node_status=RunStatus.Success) + fire_event( + LogHookEndLine( + statement=hook_text, + status=status, + index=idx, + total=num_hooks, + execution_time=timer.elapsed, + node_info=hook.node_info, + ) + ) # `_event_status` dict is only used for logging. Make sure # it gets deleted when we're done with it hook.clear_event_status() self._total_executed += len(ordered_hooks) - with TextOnly(): - fire_event(Formatting("")) + fire_event(Formatting("")) def safe_run_hooks( self, adapter, hook_type: RunHookType, extra_context: Dict[str, Any] @@ -434,8 +424,7 @@ def print_results_line(self, results, execution_time) -> None: if execution_time is not None: execution = utils.humanize_execution_time(execution_time=execution_time) - with TextOnly(): - fire_event(Formatting("")) + fire_event(Formatting("")) fire_event( FinishedRunningStats( stat_line=stat_line, execution=execution, execution_time=execution_time diff --git a/core/dbt/task/runnable.py b/core/dbt/task/runnable.py index 99c2285d5c1..639e02ec404 100644 --- a/core/dbt/task/runnable.py +++ b/core/dbt/task/runnable.py @@ -45,15 +45,6 @@ UniqueId, parse_difference, ) -from dbt.logger import ( - DbtModelState, - DbtProcessState, - ModelMetadata, - NodeCount, - TextOnly, - TimestampNamed, - UniqueID, -) from dbt.parser.manifest import write_manifest from dbt.task.base import BaseRunner, ConfiguredTask from dbt_common.context import _INVOCATION_CONTEXT_VAR, get_invocation_context @@ -65,7 +56,6 @@ from .printer import print_run_end_messages, print_run_result_error RESULT_FILE_NAME = "run_results.json" -RUNNING_STATE = DbtProcessState("running") class GraphRunnableTask(ConfiguredTask): @@ -198,59 +188,48 @@ def get_runner(self, node) -> BaseRunner: return cls(self.config, adapter, node, run_count, num_nodes) def call_runner(self, runner: BaseRunner) -> RunResult: - uid_context = UniqueID(runner.node.unique_id) - with RUNNING_STATE, uid_context, log_contextvars(node_info=runner.node.node_info): - startctx = TimestampNamed("node_started_at") - index = self.index_offset(runner.node_index) + with log_contextvars(node_info=runner.node.node_info): runner.node.update_event_status( started_at=datetime.utcnow().isoformat(), node_status=RunningStatus.Started ) - extended_metadata = ModelMetadata(runner.node, index) - - with startctx, extended_metadata: - fire_event( - NodeStart( - node_info=runner.node.node_info, - ) + fire_event( + NodeStart( + node_info=runner.node.node_info, ) - status: Dict[str, str] = {} - result = None - thread_exception = None + ) try: result = runner.run_with_hooks(self.manifest) except Exception as e: thread_exception = e finally: - finishctx = TimestampNamed("finished_at") - with finishctx, DbtModelState(status): - if result is not None: - fire_event( - NodeFinished( - node_info=runner.node.node_info, - run_result=result.to_msg_dict(), - ) - ) - else: - msg = f"Exception on worker thread. {thread_exception}" - - fire_event( - GenericExceptionOnRun( - unique_id=runner.node.unique_id, - exc=str(thread_exception), - node_info=runner.node.node_info, - ) + if result is not None: + fire_event( + NodeFinished( + node_info=runner.node.node_info, + run_result=result.to_msg_dict(), ) + ) + else: + msg = f"Exception on worker thread. {thread_exception}" - result = RunResult( - status=RunStatus.Error, # type: ignore - timing=[], - thread_id="", - execution_time=0.0, - adapter_response={}, - message=msg, - failures=None, - node=runner.node, + fire_event( + GenericExceptionOnRun( + unique_id=runner.node.unique_id, + exc=str(thread_exception), + node_info=runner.node.node_info, ) + ) + + result = RunResult( + status=RunStatus.Error, # type: ignore + timing=[], + thread_id="", + execution_time=0.0, + adapter_response={}, + message=msg, + failures=None, + node=runner.node, + ) # `_event_status` dict is only used for logging. Make sure # it gets deleted when we're done with it @@ -386,15 +365,12 @@ def execute_nodes(self): num_threads = self.config.threads target_name = self.config.target_name - # following line can be removed when legacy logger is removed - with NodeCount(self.num_nodes): - fire_event( - ConcurrencyLine( - num_threads=num_threads, target_name=target_name, node_count=self.num_nodes - ) + fire_event( + ConcurrencyLine( + num_threads=num_threads, target_name=target_name, node_count=self.num_nodes ) - with TextOnly(): - fire_event(Formatting("")) + ) + fire_event(Formatting("")) pool = ThreadPool(num_threads, self._pool_thread_initializer, [get_invocation_context()]) try: @@ -515,8 +491,7 @@ def run(self): ) if len(self._flattened_nodes) == 0: - with TextOnly(): - fire_event(Formatting("")) + fire_event(Formatting("")) warn_or_error(NothingToDo()) result = self.get_result( results=[], @@ -524,8 +499,7 @@ def run(self): elapsed_time=0.0, ) else: - with TextOnly(): - fire_event(Formatting("")) + fire_event(Formatting("")) selected_uids = frozenset(n.unique_id for n in self._flattened_nodes) result = self.execute_with_hooks(selected_uids) diff --git a/core/dbt/task/seed.py b/core/dbt/task/seed.py index a5960cb931c..031bcdf7feb 100644 --- a/core/dbt/task/seed.py +++ b/core/dbt/task/seed.py @@ -3,7 +3,6 @@ from dbt.artifacts.schemas.results import NodeStatus, RunStatus from dbt.events.types import LogSeedResult, LogStartLine, SeedHeader from dbt.graph import ResourceTypeSelector -from dbt.logger import TextOnly from dbt.node_types import NodeType from dbt_common.events.base_types import EventLevel from dbt_common.events.functions import fire_event @@ -86,14 +85,12 @@ def show_table(self, result): alias = result.node.alias header = "Random sample of table: {}.{}".format(schema, alias) - with TextOnly(): - fire_event(Formatting("")) + fire_event(Formatting("")) fire_event(SeedHeader(header=header)) fire_event(Formatting("-" * len(header))) rand_table.print_table(max_rows=10, max_columns=None) - with TextOnly(): - fire_event(Formatting("")) + fire_event(Formatting("")) def show_tables(self, results): for result in results: diff --git a/core/dbt/task/sql.py b/core/dbt/task/sql.py index a88d790bb96..2fa6f8ccb8c 100644 --- a/core/dbt/task/sql.py +++ b/core/dbt/task/sql.py @@ -66,7 +66,6 @@ def execute(self, compiled_node, manifest) -> RemoteCompileResult: compiled_code=compiled_node.compiled_code, node=compiled_node, timing=[], # this will get added later - logs=[], generated_at=datetime.utcnow(), ) @@ -76,7 +75,6 @@ def from_run_result(self, result, start_time, timing_info) -> RemoteCompileResul compiled_code=result.compiled_code, node=result.node, timing=timing_info, - logs=[], generated_at=datetime.utcnow(), ) @@ -96,7 +94,6 @@ def execute(self, compiled_node, manifest) -> RemoteRunResult: node=compiled_node, table=table, timing=[], - logs=[], generated_at=datetime.utcnow(), ) @@ -107,6 +104,5 @@ def from_run_result(self, result, start_time, timing_info) -> RemoteRunResult: node=result.node, table=result.table, timing=timing_info, - logs=[], generated_at=datetime.utcnow(), ) diff --git a/core/dbt/tests/fixtures/project.py b/core/dbt/tests/fixtures/project.py index 501305ff0b0..5395247a74c 100644 --- a/core/dbt/tests/fixtures/project.py +++ b/core/dbt/tests/fixtures/project.py @@ -1,6 +1,5 @@ import os import random -import warnings from argparse import Namespace from datetime import datetime from pathlib import Path @@ -540,9 +539,6 @@ def project( logs_dir, test_config, ): - # Logbook warnings are ignored so we don't have to fork logbook to support python 3.10. - # This _only_ works for tests in `tests/` that use the project fixture. - warnings.filterwarnings("ignore", category=DeprecationWarning, module="logbook") log_flags = Namespace( LOG_PATH=logs_dir, LOG_FORMAT="json", diff --git a/core/dbt/tests/util.py b/core/dbt/tests/util.py index 9376c0e9a2a..d5c5e49d2aa 100644 --- a/core/dbt/tests/util.py +++ b/core/dbt/tests/util.py @@ -1,7 +1,6 @@ import json import os import shutil -import warnings from contextlib import contextmanager from contextvars import ContextVar, copy_context from datetime import datetime @@ -14,7 +13,6 @@ from dbt.adapters.factory import Adapter from dbt.cli.main import dbtRunner from dbt.contracts.graph.manifest import Manifest -from dbt.logger import log_manager from dbt_common.context import _INVOCATION_CONTEXT_VAR, InvocationContext from dbt_common.events.base_types import EventLevel from dbt_common.events.functions import ( @@ -76,15 +74,9 @@ def run_dbt( args: Optional[List[str]] = None, expect_pass: bool = True, ): - # Ignore logbook warnings - warnings.filterwarnings("ignore", category=DeprecationWarning, module="logbook") - # reset global vars reset_metadata_vars() - # The logger will complain about already being initialized if - # we don't do this. - log_manager.reset_handlers() if args is None: args = ["run"] diff --git a/core/dbt/tracking.py b/core/dbt/tracking.py index 689b12f1d61..880243e4d6e 100644 --- a/core/dbt/tracking.py +++ b/core/dbt/tracking.py @@ -6,7 +6,6 @@ from datetime import datetime from typing import Optional -import logbook import pytz import requests from packaging.version import Version @@ -467,20 +466,6 @@ def do_not_track(): active_user = User(None) -class InvocationProcessor(logbook.Processor): - def __init__(self) -> None: - super().__init__() - - def process(self, record): - if active_user is not None: - record.extra.update( - { - "run_started_at": active_user.run_started_at.isoformat(), - "invocation_id": get_invocation_id(), - } - ) - - def initialize_from_flags(send_anonymous_usage_stats, profiles_dir): global active_user if send_anonymous_usage_stats: diff --git a/core/setup.py b/core/setup.py index 0e782e954d5..3c7c59e97b6 100644 --- a/core/setup.py +++ b/core/setup.py @@ -53,10 +53,6 @@ "Jinja2>=3.1.3,<4", "mashumaro[msgpack]>=3.9,<4.0", # ---- - # Legacy: This package has not been updated since 2019, and it is unused in dbt's logging system (since v1.0) - # The dependency here will be removed along with the removal of 'legacy logging', in a future release of dbt-core - "logbook>=1.5,<1.6", - # ---- # dbt-core uses these packages in standard ways. Pin to the major version, and check compatibility # with major versions in each new minor version of dbt-core. "click>=8.0.2,<9.0", diff --git a/dev-requirements.txt b/dev-requirements.txt index be10d2c2384..6f87c62d6db 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -19,7 +19,6 @@ pytest>=7.4,<8.0 pytest-cov pytest-csv>=3.0,<4.0 pytest-dotenv -pytest-logbook pytest-mock pytest-split pytest-xdist diff --git a/tests/functional/list/test_list.py b/tests/functional/list/test_list.py index 388fea029b2..9b51b6798c9 100644 --- a/tests/functional/list/test_list.py +++ b/tests/functional/list/test_list.py @@ -3,7 +3,6 @@ import pytest -from dbt.logger import log_manager from dbt.tests.util import run_dbt from tests.functional.list.fixtures import ( # noqa: F401 analyses, @@ -45,14 +44,12 @@ def test_packages_install_path_does_not_exist(self, project): assert not os.path.exists(packages_install_path) def run_dbt_ls(self, args=None, expect_pass=True): - log_manager.stdout_console() full_args = ["ls"] if args is not None: full_args += args result = run_dbt(args=full_args, expect_pass=expect_pass) - log_manager.stdout_console() return result def assert_json_equal(self, json_str, expected): diff --git a/third-party-stubs/logbook/__init__.pyi b/third-party-stubs/logbook/__init__.pyi deleted file mode 100644 index a0952ff7c5f..00000000000 --- a/third-party-stubs/logbook/__init__.pyi +++ /dev/null @@ -1,65 +0,0 @@ -# Stubs for logbook (Python 3) -# -# NOTE: This dynamically typed stub was automatically generated by stubgen. - -from .__version__ import __version__ -from .base import ( - CRITICAL as CRITICAL, - DEBUG as DEBUG, - ERROR as ERROR, - Flags as Flags, - INFO as INFO, - LogRecord as LogRecord, - Logger as Logger, - LoggerGroup as LoggerGroup, - NOTICE as NOTICE, - NOTSET as NOTSET, - NestedSetup as NestedSetup, - Processor as Processor, - TRACE as TRACE, - WARNING as WARNING, - dispatch_record as dispatch_record, - get_level_name as get_level_name, - lookup_level as lookup_level, - set_datetime_format as set_datetime_format, -) -from .handlers import ( - BrotliCompressionHandler as BrotliCompressionHandler, - FileHandler as FileHandler, - FingersCrossedHandler as FingersCrossedHandler, - GMailHandler as GMailHandler, - GZIPCompressionHandler as GZIPCompressionHandler, - GroupHandler as GroupHandler, - Handler as Handler, - HashingHandlerMixin as HashingHandlerMixin, - LimitingHandlerMixin as LimitingHandlerMixin, - MailHandler as MailHandler, - MonitoringFileHandler as MonitoringFileHandler, - NTEventLogHandler as NTEventLogHandler, - NullHandler as NullHandler, - RotatingFileHandler as RotatingFileHandler, - StderrHandler as StderrHandler, - StreamHandler as StreamHandler, - StringFormatter as StringFormatter, - StringFormatterHandlerMixin as StringFormatterHandlerMixin, - SyslogHandler as SyslogHandler, - TestHandler as TestHandler, - TimedRotatingFileHandler as TimedRotatingFileHandler, - WrapperHandler as WrapperHandler, - create_syshandler as create_syshandler, -) -from . import compat as compat -from typing import Any - -trace: Any -debug: Any -info: Any -warn: Any -warning: Any -notice: Any -error: Any -exception: Any -catch_exceptions: Any -critical: Any -log: Any -default_handler: Any diff --git a/third-party-stubs/logbook/__version__.pyi b/third-party-stubs/logbook/__version__.pyi deleted file mode 100644 index e5b7a06e5ee..00000000000 --- a/third-party-stubs/logbook/__version__.pyi +++ /dev/null @@ -1,5 +0,0 @@ -# Stubs for logbook.__version__ (Python 3) -# -# NOTE: This dynamically typed stub was automatically generated by stubgen. - -__version__: str diff --git a/third-party-stubs/logbook/_fallback.pyi b/third-party-stubs/logbook/_fallback.pyi deleted file mode 100644 index 0e2b32f6edf..00000000000 --- a/third-party-stubs/logbook/_fallback.pyi +++ /dev/null @@ -1,40 +0,0 @@ -# Stubs for logbook._fallback (Python 3) -# -# NOTE: This dynamically typed stub was automatically generated by stubgen. - -from typing import Any - -def group_reflected_property(name: Any, default: Any, fallback: Any = ...): ... - -class _StackBound: - def __init__(self, obj: Any, push: Any, pop: Any) -> None: ... - def __enter__(self): ... - def __exit__(self, exc_type: Any, exc_value: Any, tb: Any) -> None: ... - -class StackedObject: - def push_greenlet(self) -> None: ... - def pop_greenlet(self) -> None: ... - def push_context(self) -> None: ... - def pop_context(self) -> None: ... - def push_thread(self) -> None: ... - def pop_thread(self) -> None: ... - def push_application(self) -> None: ... - def pop_application(self) -> None: ... - def __enter__(self): ... - def __exit__(self, exc_type: Any, exc_value: Any, tb: Any) -> None: ... - def greenletbound(self, _cls: Any = ...): ... - def contextbound(self, _cls: Any = ...): ... - def threadbound(self, _cls: Any = ...): ... - def applicationbound(self, _cls: Any = ...): ... - -class ContextStackManager: - def __init__(self) -> None: ... - def iter_context_objects(self): ... - def push_greenlet(self, obj: Any) -> None: ... - def pop_greenlet(self): ... - def push_context(self, obj: Any) -> None: ... - def pop_context(self): ... - def push_thread(self, obj: Any) -> None: ... - def pop_thread(self): ... - def push_application(self, obj: Any) -> None: ... - def pop_application(self): ... diff --git a/third-party-stubs/logbook/_termcolors.pyi b/third-party-stubs/logbook/_termcolors.pyi deleted file mode 100644 index 7284b777785..00000000000 --- a/third-party-stubs/logbook/_termcolors.pyi +++ /dev/null @@ -1,13 +0,0 @@ -# Stubs for logbook._termcolors (Python 3) -# -# NOTE: This dynamically typed stub was automatically generated by stubgen. - -from typing import Any - -esc: str -codes: Any -dark_colors: Any -light_colors: Any -x: int - -def colorize(color_key: Any, text: Any): ... diff --git a/third-party-stubs/logbook/base.pyi b/third-party-stubs/logbook/base.pyi deleted file mode 100644 index ed769dd1698..00000000000 --- a/third-party-stubs/logbook/base.pyi +++ /dev/null @@ -1,184 +0,0 @@ -# Stubs for logbook.base (Python 3) -# -# NOTE: This dynamically typed stub was automatically generated by stubgen. - -from logbook._fallback import StackedObject -from typing import Any, Optional - -def set_datetime_format(datetime_format: Any) -> None: ... - -CRITICAL: int -ERROR: int -WARNING: int -NOTICE: int -INFO: int -DEBUG: int -TRACE: int -NOTSET: int - -def level_name_property(): ... -def lookup_level(level: Any): ... -def get_level_name(level: Any): ... - -class _ExceptionCatcher: - logger: Any = ... - args: Any = ... - kwargs: Any = ... - def __init__(self, logger: Any, args: Any, kwargs: Any) -> None: ... - def __enter__(self): ... - def __exit__(self, exc_type: Any, exc_value: Any, tb: Any): ... - -class ContextObject(StackedObject): - stack_manager: Any = ... - def push_greenlet(self) -> None: ... - def pop_greenlet(self) -> None: ... - def push_context(self) -> None: ... - def pop_context(self) -> None: ... - def push_thread(self) -> None: ... - def pop_thread(self) -> None: ... - def push_application(self) -> None: ... - def pop_application(self) -> None: ... - -class NestedSetup(StackedObject): - objects: Any = ... - def __init__(self, objects: Optional[Any] = ...) -> None: ... - def push_application(self) -> None: ... - def pop_application(self) -> None: ... - def push_thread(self) -> None: ... - def pop_thread(self) -> None: ... - def push_greenlet(self) -> None: ... - def pop_greenlet(self) -> None: ... - def push_context(self) -> None: ... - def pop_context(self) -> None: ... - -class Processor(ContextObject): - stack_manager: Any = ... - callback: Any = ... - def __init__(self, callback: Optional[Any] = ...) -> None: ... - def process(self, record: Any) -> None: ... - -class _InheritedType: - def __reduce__(self): ... - -Inherit: Any - -class Flags(ContextObject): - stack_manager: Any = ... - def __init__(self, **flags: Any) -> None: ... - @staticmethod - def get_flag(flag: Any, default: Optional[Any] = ...): ... - -class LogRecord: - keep_open: bool = ... - time: Any = ... - heavy_initialized: bool = ... - late: bool = ... - information_pulled: bool = ... - channel: Any = ... - msg: Any = ... - args: Any = ... - kwargs: Any = ... - level: Any = ... - exc_info: Any = ... - extra: Any = ... - frame: Any = ... - frame_correction: Any = ... - process: int = ... - def __init__( - self, - channel: Any, - level: Any, - msg: Any, - args: Optional[Any] = ..., - kwargs: Optional[Any] = ..., - exc_info: Optional[Any] = ..., - extra: Optional[Any] = ..., - frame: Optional[Any] = ..., - dispatcher: Optional[Any] = ..., - frame_correction: int = ..., - ) -> None: ... - def heavy_init(self) -> None: ... - def pull_information(self) -> None: ... - def close(self) -> None: ... - def __reduce_ex__(self, protocol: Any): ... - def to_dict(self, json_safe: bool = ...): ... - @classmethod - def from_dict(cls, d: Any): ... - def update_from_dict(self, d: Any): ... - def message(self): ... - level_name: Any = ... - def calling_frame(self): ... - def func_name(self): ... - def module(self): ... - def filename(self): ... - def lineno(self): ... - def greenlet(self): ... - def thread(self): ... - @property - def thread_name(self) -> str: ... - def process_name(self): ... - @property - def formatted_exception(self) -> Optional[str]: ... - def exception_name(self): ... - @property - def exception_shortname(self): ... - def exception_message(self): ... - @property - def dispatcher(self): ... - -class LoggerMixin: - level_name: Any = ... - def trace(self, *args: Any, **kwargs: Any) -> None: ... - def debug(self, *args: Any, **kwargs: Any) -> None: ... - def info(self, *args: Any, **kwargs: Any) -> None: ... - def warn(self, *args: Any, **kwargs: Any) -> None: ... - def warning(self, *args: Any, **kwargs: Any): ... - def notice(self, *args: Any, **kwargs: Any) -> None: ... - def error(self, *args: Any, **kwargs: Any) -> None: ... - def exception(self, *args: Any, **kwargs: Any): ... - def critical(self, *args: Any, **kwargs: Any) -> None: ... - def log(self, level: Any, *args: Any, **kwargs: Any) -> None: ... - def catch_exceptions(self, *args: Any, **kwargs: Any): ... - disabled: bool = ... - def enable(self) -> None: ... - def disable(self) -> None: ... - -class RecordDispatcher: - suppress_dispatcher: bool = ... - name: Any = ... - handlers: Any = ... - group: Any = ... - level: Any = ... - def __init__(self, name: Optional[Any] = ..., level: Any = ...) -> None: ... - disabled: Any = ... - def handle(self, record: Any) -> None: ... - def make_record_and_handle( - self, - level: Any, - msg: Any, - args: Any, - kwargs: Any, - exc_info: Any, - extra: Any, - frame_correction: Any, - ) -> None: ... - def call_handlers(self, record: Any) -> None: ... - def process_record(self, record: Any) -> None: ... - -class Logger(RecordDispatcher, LoggerMixin): ... - -class LoggerGroup: - loggers: Any = ... - level: Any = ... - disabled: bool = ... - processor: Any = ... - def __init__( - self, loggers: Optional[Any] = ..., level: Any = ..., processor: Optional[Any] = ... - ) -> None: ... - def add_logger(self, logger: Any) -> None: ... - def remove_logger(self, logger: Any) -> None: ... - def process_record(self, record: Any) -> None: ... - def enable(self, force: bool = ...) -> None: ... - def disable(self, force: bool = ...) -> None: ... - -def dispatch_record(record: Any) -> None: ... diff --git a/third-party-stubs/logbook/compat.pyi b/third-party-stubs/logbook/compat.pyi deleted file mode 100644 index 75592bf31ed..00000000000 --- a/third-party-stubs/logbook/compat.pyi +++ /dev/null @@ -1,60 +0,0 @@ -# Stubs for logbook.compat (Python 3) -# -# NOTE: This dynamically typed stub was automatically generated by stubgen. - -import logbook -import logging -from typing import Any, Optional - -def redirect_logging(set_root_logger_level: bool = ...) -> None: ... - -class redirected_logging: - old_handlers: Any = ... - old_level: Any = ... - set_root_logger_level: Any = ... - def __init__(self, set_root_logger_level: bool = ...) -> None: ... - def start(self) -> None: ... - def end( - self, etype: Optional[Any] = ..., evalue: Optional[Any] = ..., tb: Optional[Any] = ... - ) -> None: ... - __enter__: Any = ... - __exit__: Any = ... - -class LoggingCompatRecord(logbook.LogRecord): ... - -class RedirectLoggingHandler(logging.Handler): - def __init__(self) -> None: ... - def convert_level(self, level: Any): ... - def find_extra(self, old_record: Any): ... - def find_caller(self, old_record: Any): ... - def convert_time(self, timestamp: Any): ... - def convert_record(self, old_record: Any): ... - def emit(self, record: Any) -> None: ... - -class LoggingHandler(logbook.Handler): - logger: Any = ... - def __init__( - self, - logger: Optional[Any] = ..., - level: Any = ..., - filter: Optional[Any] = ..., - bubble: bool = ..., - ) -> None: ... - def get_logger(self, record: Any): ... - def convert_level(self, level: Any): ... - def convert_time(self, dt: Any): ... - def convert_record(self, old_record: Any): ... - def emit(self, record: Any) -> None: ... - -def redirect_warnings() -> None: ... - -class redirected_warnings: - def __init__(self) -> None: ... - def message_to_unicode(self, message: Any): ... - def make_record(self, message: Any, exception: Any, filename: Any, lineno: Any): ... - def start(self) -> None: ... - def end( - self, etype: Optional[Any] = ..., evalue: Optional[Any] = ..., tb: Optional[Any] = ... - ) -> None: ... - __enter__: Any = ... - __exit__: Any = ... diff --git a/third-party-stubs/logbook/concurrency.pyi b/third-party-stubs/logbook/concurrency.pyi deleted file mode 100644 index 070fd741ad0..00000000000 --- a/third-party-stubs/logbook/concurrency.pyi +++ /dev/null @@ -1,51 +0,0 @@ -# Stubs for logbook.concurrency (Python 3) -# -# NOTE: This dynamically typed stub was automatically generated by stubgen. - -from _thread import _local as thread_local, get_ident as thread_get_ident -from typing import Any, Optional - -has_gevent: bool -use_gevent: bool - -def enable_gevent() -> None: ... -def is_gevent_enabled(): ... - -ThreadLock: Any -ThreadRLock: Any -thread_get_ident: Any -thread_local: Any - -def thread_get_name(): ... - -class GreenletRLock: - def __init__(self) -> None: ... - def acquire(self, blocking: int = ...): ... - def release(self) -> None: ... - __enter__: Any = ... - def __exit__(self, t: Any, v: Any, tb: Any) -> None: ... - -greenlet_get_ident = thread_get_ident -greenlet_local = thread_local - -class GreenletRLock: - def acquire(self) -> None: ... - def release(self) -> None: ... - def __enter__(self) -> None: ... - def __exit__(self, t: Any, v: Any, tb: Any) -> None: ... - -def new_fine_grained_lock(): ... - -has_contextvars: bool -context_ident_counter: Any -context_ident: Any - -def context_get_ident(): ... -def is_context_enabled(): ... - -class ContextVar: - name: Any = ... - local: Any = ... - def __init__(self, name: Any) -> None: ... - def set(self, value: Any) -> None: ... - def get(self, default: Optional[Any] = ...): ... diff --git a/third-party-stubs/logbook/handlers.pyi b/third-party-stubs/logbook/handlers.pyi deleted file mode 100644 index 54131084690..00000000000 --- a/third-party-stubs/logbook/handlers.pyi +++ /dev/null @@ -1,412 +0,0 @@ -# Stubs for logbook.handlers (Python 3) -# -# NOTE: This dynamically typed stub was automatically generated by stubgen. - -from logbook.base import ContextObject -from typing import Any, Optional - -DEFAULT_FORMAT_STRING: Any -SYSLOG_FORMAT_STRING: Any -NTLOG_FORMAT_STRING: Any -TEST_FORMAT_STRING: Any -MAIL_FORMAT_STRING: Any -MAIL_RELATED_FORMAT_STRING: Any -SYSLOG_PORT: int -REGTYPE: Any - -def create_syshandler(application_name: Any, level: Any = ...): ... - -class _HandlerType(type): - def __new__(cls, name: Any, bases: Any, d: Any): ... - -class Handler(ContextObject): - stack_manager: Any = ... - blackhole: bool = ... - level: Any = ... - formatter: Any = ... - filter: Any = ... - bubble: Any = ... - def __init__( - self, level: Any = ..., filter: Optional[Any] = ..., bubble: bool = ... - ) -> None: ... - level_name: Any = ... - def format(self, record: Any): ... - def should_handle(self, record: Any): ... - def handle(self, record: Any): ... - def emit(self, record: Any) -> None: ... - def emit_batch(self, records: Any, reason: Any) -> None: ... - def close(self) -> None: ... - def handle_error(self, record: Any, exc_info: Any) -> None: ... - -class NullHandler(Handler): - blackhole: bool = ... - def __init__(self, level: Any = ..., filter: Optional[Any] = ...) -> None: ... - -class WrapperHandler(Handler): - handler: Any = ... - def __init__(self, handler: Any) -> None: ... - def __getattr__(self, name: Any): ... - def __setattr__(self, name: Any, value: Any): ... - -class StringFormatter: - format_string: Any = ... - def __init__(self, format_string: Any) -> None: ... - def format_record(self, record: Any, handler: Any): ... - def format_exception(self, record: Any): ... - def __call__(self, record: Any, handler: Any): ... - -class StringFormatterHandlerMixin: - default_format_string: Any = ... - formatter_class: Any = ... - format_string: Any = ... - def __init__(self, format_string: Any) -> None: ... - -class HashingHandlerMixin: - def hash_record_raw(self, record: Any): ... - def hash_record(self, record: Any): ... - -class LimitingHandlerMixin(HashingHandlerMixin): - record_limit: Any = ... - record_delta: Any = ... - def __init__(self, record_limit: Any, record_delta: Any) -> None: ... - def check_delivery(self, record: Any): ... - -class StreamHandler(Handler, StringFormatterHandlerMixin): - encoding: Any = ... - lock: Any = ... - stream: Any = ... - def __init__( - self, - stream: Any, - level: Any = ..., - format_string: Optional[Any] = ..., - encoding: Optional[Any] = ..., - filter: Optional[Any] = ..., - bubble: bool = ..., - ) -> None: ... - def __enter__(self): ... - def __exit__(self, exc_type: Any, exc_value: Any, tb: Any): ... - def ensure_stream_is_open(self) -> None: ... - def close(self) -> None: ... - def flush(self) -> None: ... - def encode(self, msg: Any): ... - def write(self, item: Any) -> None: ... - def emit(self, record: Any) -> None: ... - def should_flush(self): ... - -class FileHandler(StreamHandler): - stream: Any = ... - def __init__( - self, - filename: Any, - mode: str = ..., - encoding: Optional[Any] = ..., - level: Any = ..., - format_string: Optional[Any] = ..., - delay: bool = ..., - filter: Optional[Any] = ..., - bubble: bool = ..., - ) -> None: ... - def write(self, item: Any) -> None: ... - def close(self) -> None: ... - def encode(self, record: Any): ... - def ensure_stream_is_open(self) -> None: ... - -class GZIPCompressionHandler(FileHandler): - def __init__( - self, - filename: Any, - encoding: Optional[Any] = ..., - level: Any = ..., - format_string: Optional[Any] = ..., - delay: bool = ..., - filter: Optional[Any] = ..., - bubble: bool = ..., - compression_quality: int = ..., - ) -> None: ... - def write(self, item: Any) -> None: ... - def should_flush(self): ... - -class BrotliCompressionHandler(FileHandler): - def __init__( - self, - filename: Any, - encoding: Optional[Any] = ..., - level: Any = ..., - format_string: Optional[Any] = ..., - delay: bool = ..., - filter: Optional[Any] = ..., - bubble: bool = ..., - compression_window_size: Any = ..., - compression_quality: int = ..., - ) -> None: ... - def write(self, item: Any) -> None: ... - def should_flush(self): ... - def flush(self) -> None: ... - def close(self) -> None: ... - -class MonitoringFileHandler(FileHandler): - def __init__( - self, - filename: Any, - mode: str = ..., - encoding: str = ..., - level: Any = ..., - format_string: Optional[Any] = ..., - delay: bool = ..., - filter: Optional[Any] = ..., - bubble: bool = ..., - ) -> None: ... - stream: Any = ... - def emit(self, record: Any) -> None: ... - -class StderrHandler(StreamHandler): - def __init__( - self, - level: Any = ..., - format_string: Optional[Any] = ..., - filter: Optional[Any] = ..., - bubble: bool = ..., - ) -> None: ... - @property - def stream(self): ... - -class RotatingFileHandler(FileHandler): - max_size: Any = ... - backup_count: Any = ... - def __init__( - self, - filename: Any, - mode: str = ..., - encoding: str = ..., - level: Any = ..., - format_string: Optional[Any] = ..., - delay: bool = ..., - max_size: Any = ..., - backup_count: int = ..., - filter: Optional[Any] = ..., - bubble: bool = ..., - ) -> None: ... - def should_rollover(self, record: Any, bytes: Any): ... - def perform_rollover(self) -> None: ... - def emit(self, record: Any) -> None: ... - -class TimedRotatingFileHandler(FileHandler): - date_format: Any = ... - backup_count: Any = ... - rollover_format: Any = ... - original_filename: Any = ... - timed_filename_for_current: Any = ... - def __init__( - self, - filename: Any, - mode: str = ..., - encoding: str = ..., - level: Any = ..., - format_string: Optional[Any] = ..., - date_format: str = ..., - backup_count: int = ..., - filter: Optional[Any] = ..., - bubble: bool = ..., - timed_filename_for_current: bool = ..., - rollover_format: str = ..., - ) -> None: ... - def generate_timed_filename(self, timestamp: Any): ... - def files_to_delete(self): ... - def perform_rollover(self, new_timestamp: Any) -> None: ... - def emit(self, record: Any) -> None: ... - -class TestHandler(Handler, StringFormatterHandlerMixin): - default_format_string: Any = ... - records: Any = ... - def __init__( - self, - level: Any = ..., - format_string: Optional[Any] = ..., - filter: Optional[Any] = ..., - bubble: bool = ..., - force_heavy_init: bool = ..., - ) -> None: ... - def close(self) -> None: ... - def emit(self, record: Any) -> None: ... - @property - def formatted_records(self): ... - @property - def has_criticals(self): ... - @property - def has_errors(self): ... - @property - def has_warnings(self): ... - @property - def has_notices(self): ... - @property - def has_infos(self): ... - @property - def has_debugs(self): ... - @property - def has_traces(self): ... - def has_critical(self, *args: Any, **kwargs: Any): ... - def has_error(self, *args: Any, **kwargs: Any): ... - def has_warning(self, *args: Any, **kwargs: Any): ... - def has_notice(self, *args: Any, **kwargs: Any): ... - def has_info(self, *args: Any, **kwargs: Any): ... - def has_debug(self, *args: Any, **kwargs: Any): ... - def has_trace(self, *args: Any, **kwargs: Any): ... - -class MailHandler(Handler, StringFormatterHandlerMixin, LimitingHandlerMixin): - default_format_string: Any = ... - default_related_format_string: Any = ... - default_subject: Any = ... - max_record_cache: int = ... - record_cache_prune: float = ... - from_addr: Any = ... - recipients: Any = ... - subject: Any = ... - server_addr: Any = ... - credentials: Any = ... - secure: Any = ... - related_format_string: Any = ... - starttls: Any = ... - def __init__( - self, - from_addr: Any, - recipients: Any, - subject: Optional[Any] = ..., - server_addr: Optional[Any] = ..., - credentials: Optional[Any] = ..., - secure: Optional[Any] = ..., - record_limit: Optional[Any] = ..., - record_delta: Optional[Any] = ..., - level: Any = ..., - format_string: Optional[Any] = ..., - related_format_string: Optional[Any] = ..., - filter: Optional[Any] = ..., - bubble: bool = ..., - starttls: bool = ..., - ) -> None: ... - def get_recipients(self, record: Any): ... - def message_from_record(self, record: Any, suppressed: Any): ... - def format_related_record(self, record: Any): ... - def generate_mail(self, record: Any, suppressed: int = ...): ... - def collapse_mails(self, mail: Any, related: Any, reason: Any): ... - def get_connection(self): ... - def close_connection(self, con: Any) -> None: ... - def deliver(self, msg: Any, recipients: Any) -> None: ... - def emit(self, record: Any) -> None: ... - def emit_batch(self, records: Any, reason: Any) -> None: ... - -class GMailHandler(MailHandler): - def __init__(self, account_id: Any, password: Any, recipients: Any, **kw: Any) -> None: ... - -class SyslogHandler(Handler, StringFormatterHandlerMixin): - default_format_string: Any = ... - LOG_EMERG: int = ... - LOG_ALERT: int = ... - LOG_CRIT: int = ... - LOG_ERR: int = ... - LOG_WARNING: int = ... - LOG_NOTICE: int = ... - LOG_INFO: int = ... - LOG_DEBUG: int = ... - LOG_KERN: int = ... - LOG_USER: int = ... - LOG_MAIL: int = ... - LOG_DAEMON: int = ... - LOG_AUTH: int = ... - LOG_SYSLOG: int = ... - LOG_LPR: int = ... - LOG_NEWS: int = ... - LOG_UUCP: int = ... - LOG_CRON: int = ... - LOG_AUTHPRIV: int = ... - LOG_FTP: int = ... - LOG_LOCAL0: int = ... - LOG_LOCAL1: int = ... - LOG_LOCAL2: int = ... - LOG_LOCAL3: int = ... - LOG_LOCAL4: int = ... - LOG_LOCAL5: int = ... - LOG_LOCAL6: int = ... - LOG_LOCAL7: int = ... - facility_names: Any = ... - level_priority_map: Any = ... - application_name: Any = ... - remote_address: Any = ... - facility: Any = ... - socktype: Any = ... - enveloper: Any = ... - record_delimiter: Any = ... - connection_exception: Any = ... - def __init__( - self, - application_name: Optional[Any] = ..., - address: Optional[Any] = ..., - facility: str = ..., - socktype: Any = ..., - level: Any = ..., - format_string: Optional[Any] = ..., - filter: Optional[Any] = ..., - bubble: bool = ..., - record_delimiter: Optional[Any] = ..., - ) -> None: ... - def encode_priority(self, record: Any): ... - def wrap_segments(self, record: Any, before: Any): ... - def unix_envelope(self, record: Any): ... - format_string: Any = ... - def net_envelope(self, record: Any): ... - def emit(self, record: Any) -> None: ... - def send_to_socket(self, data: Any) -> None: ... - def close(self) -> None: ... - -class NTEventLogHandler(Handler, StringFormatterHandlerMixin): - dllname: Any = ... - default_format_string: Any = ... - application_name: Any = ... - log_type: Any = ... - def __init__( - self, - application_name: Any, - log_type: str = ..., - level: Any = ..., - format_string: Optional[Any] = ..., - filter: Optional[Any] = ..., - bubble: bool = ..., - ) -> None: ... - def unregister_logger(self) -> None: ... - def get_event_type(self, record: Any): ... - def get_event_category(self, record: Any): ... - def get_message_id(self, record: Any): ... - def emit(self, record: Any) -> None: ... - -class FingersCrossedHandler(Handler): - batch_emit_reason: str = ... - lock: Any = ... - buffered_records: Any = ... - buffer_size: Any = ... - def __init__( - self, - handler: Any, - action_level: Any = ..., - buffer_size: int = ..., - pull_information: bool = ..., - reset: bool = ..., - filter: Optional[Any] = ..., - bubble: bool = ..., - ) -> None: ... - def close(self) -> None: ... - def enqueue(self, record: Any): ... - def rollover(self, record: Any) -> None: ... - @property - def triggered(self): ... - def emit(self, record: Any) -> None: ... - -class GroupHandler(WrapperHandler): - pull_information: Any = ... - buffered_records: Any = ... - def __init__(self, handler: Any, pull_information: bool = ...) -> None: ... - def rollover(self) -> None: ... - def pop_application(self) -> None: ... - def pop_thread(self) -> None: ... - def pop_context(self) -> None: ... - def pop_greenlet(self) -> None: ... - def emit(self, record: Any) -> None: ... diff --git a/third-party-stubs/logbook/helpers.pyi b/third-party-stubs/logbook/helpers.pyi deleted file mode 100644 index 02f13f15ea0..00000000000 --- a/third-party-stubs/logbook/helpers.pyi +++ /dev/null @@ -1,42 +0,0 @@ -# Stubs for logbook.helpers (Python 3) -# -# NOTE: This dynamically typed stub was automatically generated by stubgen. - -import os -from typing import Any, Optional - -PY2: Any -iteritems: Any -xrange: Any -xrange = range - -def u(s: Any): ... - -u: Any -integer_types: Any -string_types: Any - -def reraise(tp: Any, value: Any, tb: Optional[Any] = ...) -> None: ... -def b(x: Any): ... - -can_rename_open_file: bool - -def rename(src: Any, dst: Any) -> None: ... - -rename = os.rename - -def to_safe_json(data: Any): ... -def format_iso8601(d: Optional[Any] = ...): ... -def parse_iso8601(value: Any): ... -def get_application_name(): ... - -class cached_property: - __name__: Any = ... - __module__: Any = ... - __doc__: Any = ... - func: Any = ... - def __init__(self, func: Any, name: Optional[Any] = ..., doc: Optional[Any] = ...) -> None: ... - def __get__(self, obj: Any, type: Optional[Any] = ...): ... - -def get_iterator_next_method(it: Any): ... -def is_unicode(x: Any): ... diff --git a/third-party-stubs/logbook/more.pyi b/third-party-stubs/logbook/more.pyi deleted file mode 100644 index f0ff7af11db..00000000000 --- a/third-party-stubs/logbook/more.pyi +++ /dev/null @@ -1,148 +0,0 @@ -# Stubs for logbook.more (Python 3) -# -# NOTE: This dynamically typed stub was automatically generated by stubgen. - -from logbook.base import RecordDispatcher -from logbook.handlers import ( - FingersCrossedHandler as FingersCrossedHandlerBase, - Handler, - StderrHandler, - StringFormatter, - StringFormatterHandlerMixin, -) -from logbook.ticketing import BackendBase -from typing import Any, Optional - -TWITTER_FORMAT_STRING: Any -TWITTER_ACCESS_TOKEN_URL: str -NEW_TWEET_URL: str - -class CouchDBBackend(BackendBase): - database: Any = ... - def setup_backend(self) -> None: ... - def record_ticket(self, record: Any, data: Any, hash: Any, app_id: Any) -> None: ... - -class TwitterFormatter(StringFormatter): - max_length: int = ... - def format_exception(self, record: Any): ... - def __call__(self, record: Any, handler: Any): ... - -class TaggingLogger(RecordDispatcher): - def __init__(self, name: Optional[Any] = ..., tags: Optional[Any] = ...) -> None: ... - def log(self, tags: Any, msg: Any, *args: Any, **kwargs: Any): ... - -class TaggingHandler(Handler): - def __init__(self, handlers: Any, filter: Optional[Any] = ..., bubble: bool = ...) -> None: ... - def emit(self, record: Any) -> None: ... - -class TwitterHandler(Handler, StringFormatterHandlerMixin): - default_format_string: Any = ... - formatter_class: Any = ... - consumer_key: Any = ... - consumer_secret: Any = ... - username: Any = ... - password: Any = ... - def __init__( - self, - consumer_key: Any, - consumer_secret: Any, - username: Any, - password: Any, - level: Any = ..., - format_string: Optional[Any] = ..., - filter: Optional[Any] = ..., - bubble: bool = ..., - ) -> None: ... - def get_oauth_token(self): ... - def make_client(self): ... - def tweet(self, status: Any): ... - def emit(self, record: Any) -> None: ... - -class SlackHandler(Handler, StringFormatterHandlerMixin): - api_token: Any = ... - channel: Any = ... - slack: Any = ... - def __init__( - self, - api_token: Any, - channel: Any, - level: Any = ..., - format_string: Optional[Any] = ..., - filter: Optional[Any] = ..., - bubble: bool = ..., - ) -> None: ... - def emit(self, record: Any) -> None: ... - -class JinjaFormatter: - template: Any = ... - def __init__(self, template: Any) -> None: ... - def __call__(self, record: Any, handler: Any): ... - -class ExternalApplicationHandler(Handler): - encoding: Any = ... - def __init__( - self, - arguments: Any, - stdin_format: Optional[Any] = ..., - encoding: str = ..., - level: Any = ..., - filter: Optional[Any] = ..., - bubble: bool = ..., - ) -> None: ... - def emit(self, record: Any) -> None: ... - -class ColorizingStreamHandlerMixin: - def force_color(self) -> None: ... - def forbid_color(self) -> None: ... - def should_colorize(self, record: Any): ... - def get_color(self, record: Any): ... - def format(self, record: Any): ... - -class ColorizedStderrHandler(ColorizingStreamHandlerMixin, StderrHandler): - def __init__(self, *args: Any, **kwargs: Any) -> None: ... - -class FingersCrossedHandler(FingersCrossedHandlerBase): - def __init__(self, *args: Any, **kwargs: Any) -> None: ... - -class ExceptionHandler(Handler, StringFormatterHandlerMixin): - exc_type: Any = ... - def __init__( - self, - exc_type: Any, - level: Any = ..., - format_string: Optional[Any] = ..., - filter: Optional[Any] = ..., - bubble: bool = ..., - ) -> None: ... - def handle(self, record: Any): ... - -class DedupHandler(Handler): - def __init__(self, format_string: str = ..., *args: Any, **kwargs: Any) -> None: ... - def clear(self) -> None: ... - def pop_application(self) -> None: ... - def pop_thread(self) -> None: ... - def pop_context(self) -> None: ... - def pop_greenlet(self) -> None: ... - def handle(self, record: Any): ... - def flush(self) -> None: ... - -class RiemannHandler(Handler): - host: Any = ... - port: Any = ... - ttl: Any = ... - queue: Any = ... - flush_threshold: Any = ... - transport: Any = ... - def __init__( - self, - host: Any, - port: Any, - message_type: str = ..., - ttl: int = ..., - flush_threshold: int = ..., - bubble: bool = ..., - filter: Optional[Any] = ..., - level: Any = ..., - ) -> None: ... - def record_to_event(self, record: Any): ... - def emit(self, record: Any) -> None: ... diff --git a/third-party-stubs/logbook/notifiers.pyi b/third-party-stubs/logbook/notifiers.pyi deleted file mode 100644 index 9bd1fe73bb8..00000000000 --- a/third-party-stubs/logbook/notifiers.pyi +++ /dev/null @@ -1,123 +0,0 @@ -# Stubs for logbook.notifiers (Python 3) -# -# NOTE: This dynamically typed stub was automatically generated by stubgen. - -from logbook.handlers import Handler, LimitingHandlerMixin -from typing import Any, Optional - -def create_notification_handler( - application_name: Optional[Any] = ..., level: Any = ..., icon: Optional[Any] = ... -): ... - -class NotificationBaseHandler(Handler, LimitingHandlerMixin): - application_name: Any = ... - def __init__( - self, - application_name: Optional[Any] = ..., - record_limit: Optional[Any] = ..., - record_delta: Optional[Any] = ..., - level: Any = ..., - filter: Optional[Any] = ..., - bubble: bool = ..., - ) -> None: ... - def make_title(self, record: Any): ... - def make_text(self, record: Any): ... - -class GrowlHandler(NotificationBaseHandler): - def __init__( - self, - application_name: Optional[Any] = ..., - icon: Optional[Any] = ..., - host: Optional[Any] = ..., - password: Optional[Any] = ..., - record_limit: Optional[Any] = ..., - record_delta: Optional[Any] = ..., - level: Any = ..., - filter: Optional[Any] = ..., - bubble: bool = ..., - ) -> None: ... - def is_sticky(self, record: Any): ... - def get_priority(self, record: Any): ... - def emit(self, record: Any) -> None: ... - -class LibNotifyHandler(NotificationBaseHandler): - icon: Any = ... - def __init__( - self, - application_name: Optional[Any] = ..., - icon: Optional[Any] = ..., - no_init: bool = ..., - record_limit: Optional[Any] = ..., - record_delta: Optional[Any] = ..., - level: Any = ..., - filter: Optional[Any] = ..., - bubble: bool = ..., - ) -> None: ... - def set_notifier_icon(self, notifier: Any, icon: Any) -> None: ... - def get_expires(self, record: Any): ... - def get_urgency(self, record: Any): ... - def emit(self, record: Any) -> None: ... - -class BoxcarHandler(NotificationBaseHandler): - api_url: str = ... - email: Any = ... - password: Any = ... - def __init__( - self, - email: Any, - password: Any, - record_limit: Optional[Any] = ..., - record_delta: Optional[Any] = ..., - level: Any = ..., - filter: Optional[Any] = ..., - bubble: bool = ..., - ) -> None: ... - def get_screen_name(self, record: Any): ... - def emit(self, record: Any) -> None: ... - -class NotifoHandler(NotificationBaseHandler): - application_name: Any = ... - username: Any = ... - secret: Any = ... - hide_level: Any = ... - def __init__( - self, - application_name: Optional[Any] = ..., - username: Optional[Any] = ..., - secret: Optional[Any] = ..., - record_limit: Optional[Any] = ..., - record_delta: Optional[Any] = ..., - level: Any = ..., - filter: Optional[Any] = ..., - bubble: bool = ..., - hide_level: bool = ..., - ) -> None: ... - def emit(self, record: Any) -> None: ... - -class PushoverHandler(NotificationBaseHandler): - application_name: Any = ... - apikey: Any = ... - userkey: Any = ... - device: Any = ... - priority: Any = ... - sound: Any = ... - max_title_len: Any = ... - max_message_len: Any = ... - title: Any = ... - def __init__( - self, - application_name: Optional[Any] = ..., - apikey: Optional[Any] = ..., - userkey: Optional[Any] = ..., - device: Optional[Any] = ..., - priority: int = ..., - sound: Optional[Any] = ..., - record_limit: Optional[Any] = ..., - record_delta: Optional[Any] = ..., - level: Any = ..., - filter: Optional[Any] = ..., - bubble: bool = ..., - max_title_len: int = ..., - max_message_len: int = ..., - ) -> None: ... - def emit(self, record: Any) -> None: ... diff --git a/third-party-stubs/logbook/queues.pyi b/third-party-stubs/logbook/queues.pyi deleted file mode 100644 index 96e757b2ee6..00000000000 --- a/third-party-stubs/logbook/queues.pyi +++ /dev/null @@ -1,154 +0,0 @@ -# Stubs for logbook.queues (Python 3) -# -# NOTE: This dynamically typed stub was automatically generated by stubgen. - -from logbook.handlers import Handler, WrapperHandler -from typing import Any, Optional - -class RedisHandler(Handler): - redis: Any = ... - key: Any = ... - extra_fields: Any = ... - flush_threshold: Any = ... - queue: Any = ... - lock: Any = ... - push_method: Any = ... - def __init__( - self, - host: str = ..., - port: int = ..., - key: str = ..., - extra_fields: Optional[Any] = ..., - flush_threshold: int = ..., - flush_time: int = ..., - level: Any = ..., - filter: Optional[Any] = ..., - password: bool = ..., - bubble: bool = ..., - context: Optional[Any] = ..., - push_method: str = ..., - ) -> None: ... - def disable_buffering(self) -> None: ... - def emit(self, record: Any) -> None: ... - def close(self) -> None: ... - -class MessageQueueHandler(Handler): - queue: Any = ... - def __init__( - self, - uri: Optional[Any] = ..., - queue: str = ..., - level: Any = ..., - filter: Optional[Any] = ..., - bubble: bool = ..., - ) -> None: ... - def export_record(self, record: Any): ... - def emit(self, record: Any) -> None: ... - def close(self) -> None: ... - -RabbitMQHandler = MessageQueueHandler - -class ZeroMQHandler(Handler): - context: Any = ... - socket: Any = ... - def __init__( - self, - uri: Optional[Any] = ..., - level: Any = ..., - filter: Optional[Any] = ..., - bubble: bool = ..., - context: Optional[Any] = ..., - multi: bool = ..., - ) -> None: ... - def export_record(self, record: Any): ... - def emit(self, record: Any) -> None: ... - def close(self, linger: int = ...) -> None: ... - def __del__(self) -> None: ... - -class ThreadController: - setup: Any = ... - subscriber: Any = ... - running: bool = ... - def __init__(self, subscriber: Any, setup: Optional[Any] = ...) -> None: ... - def start(self) -> None: ... - def stop(self) -> None: ... - -class SubscriberBase: - def recv(self, timeout: Optional[Any] = ...) -> Any: ... - def dispatch_once(self, timeout: Optional[Any] = ...): ... - def dispatch_forever(self) -> None: ... - def dispatch_in_background(self, setup: Optional[Any] = ...): ... - -class MessageQueueSubscriber(SubscriberBase): - queue: Any = ... - def __init__(self, uri: Optional[Any] = ..., queue: str = ...) -> None: ... - def __del__(self) -> None: ... - def close(self) -> None: ... - def recv(self, timeout: Optional[Any] = ...): ... - -RabbitMQSubscriber = MessageQueueSubscriber - -class ZeroMQSubscriber(SubscriberBase): - context: Any = ... - socket: Any = ... - def __init__( - self, uri: Optional[Any] = ..., context: Optional[Any] = ..., multi: bool = ... - ) -> None: ... - def __del__(self) -> None: ... - def close(self) -> None: ... - def recv(self, timeout: Optional[Any] = ...): ... - -class MultiProcessingHandler(Handler): - queue: Any = ... - def __init__( - self, queue: Any, level: Any = ..., filter: Optional[Any] = ..., bubble: bool = ... - ) -> None: ... - def emit(self, record: Any) -> None: ... - -class MultiProcessingSubscriber(SubscriberBase): - queue: Any = ... - def __init__(self, queue: Optional[Any] = ...) -> None: ... - def recv(self, timeout: Optional[Any] = ...): ... - -class ExecnetChannelHandler(Handler): - channel: Any = ... - def __init__( - self, channel: Any, level: Any = ..., filter: Optional[Any] = ..., bubble: bool = ... - ) -> None: ... - def emit(self, record: Any) -> None: ... - -class ExecnetChannelSubscriber(SubscriberBase): - channel: Any = ... - def __init__(self, channel: Any) -> None: ... - def recv(self, timeout: Optional[Any] = ...): ... - -class TWHThreadController: - class Command: - stop: Any = ... - emit: Any = ... - emit_batch: Any = ... - wrapper_handler: Any = ... - running: bool = ... - def __init__(self, wrapper_handler: Any) -> None: ... - def start(self) -> None: ... - def stop(self) -> None: ... - -class ThreadedWrapperHandler(WrapperHandler): - queue: Any = ... - controller: Any = ... - def __init__(self, handler: Any, maxsize: int = ...) -> None: ... - def close(self) -> None: ... - def emit(self, record: Any) -> None: ... - def emit_batch(self, records: Any, reason: Any) -> None: ... - -class GroupMember(ThreadController): - queue: Any = ... - def __init__(self, subscriber: Any, queue: Any) -> None: ... - -class SubscriberGroup(SubscriberBase): - members: Any = ... - queue: Any = ... - def __init__(self, subscribers: Optional[Any] = ..., queue_limit: int = ...) -> None: ... - def add(self, subscriber: Any) -> None: ... - def recv(self, timeout: Optional[Any] = ...): ... - def stop(self) -> None: ... diff --git a/third-party-stubs/logbook/ticketing.pyi b/third-party-stubs/logbook/ticketing.pyi deleted file mode 100644 index 4435a206d26..00000000000 --- a/third-party-stubs/logbook/ticketing.pyi +++ /dev/null @@ -1,110 +0,0 @@ -# Stubs for logbook.ticketing (Python 3) -# -# NOTE: This dynamically typed stub was automatically generated by stubgen. - -from logbook.base import LogRecord -from logbook.handlers import Handler, HashingHandlerMixin -from typing import Any, Optional - -class Ticket: - level_name: Any = ... - db: Any = ... - def __init__(self, db: Any, row: Any) -> None: ... - def last_occurrence(self): ... - def get_occurrences(self, order_by: str = ..., limit: int = ..., offset: int = ...): ... - solved: bool = ... - def solve(self) -> None: ... - def delete(self) -> None: ... - __hash__: Any = ... - def __eq__(self, other: Any): ... - def __ne__(self, other: Any): ... - -class Occurrence(LogRecord): - db: Any = ... - time: Any = ... - ticket_id: Any = ... - occurrence_id: Any = ... - def __init__(self, db: Any, row: Any) -> None: ... - -class BackendBase: - options: Any = ... - def __init__(self, **options: Any) -> None: ... - def setup_backend(self) -> None: ... - def record_ticket(self, record: Any, data: Any, hash: Any, app_id: Any) -> None: ... - def count_tickets(self) -> None: ... - def get_tickets(self, order_by: str = ..., limit: int = ..., offset: int = ...) -> None: ... - def solve_ticket(self, ticket_id: Any) -> None: ... - def delete_ticket(self, ticket_id: Any) -> None: ... - def get_ticket(self, ticket_id: Any) -> None: ... - def get_occurrences( - self, ticket: Any, order_by: str = ..., limit: int = ..., offset: int = ... - ) -> None: ... - -class SQLAlchemyBackend(BackendBase): - engine: Any = ... - session: Any = ... - table_prefix: Any = ... - metadata: Any = ... - def setup_backend(self) -> None: ... - tickets: Any = ... - occurrences: Any = ... - def create_tables(self): ... - def record_ticket(self, record: Any, data: Any, hash: Any, app_id: Any) -> None: ... - def count_tickets(self): ... - def get_tickets(self, order_by: str = ..., limit: int = ..., offset: int = ...): ... - def solve_ticket(self, ticket_id: Any) -> None: ... - def delete_ticket(self, ticket_id: Any) -> None: ... - def get_ticket(self, ticket_id: Any): ... - def get_occurrences( - self, ticket: Any, order_by: str = ..., limit: int = ..., offset: int = ... - ): ... - -class MongoDBBackend(BackendBase): - class _FixedTicketClass(Ticket): - @property - def ticket_id(self): ... - - class _FixedOccurrenceClass(Occurrence): - db: Any = ... - time: Any = ... - ticket_id: Any = ... - occurrence_id: Any = ... - def __init__(self, db: Any, row: Any) -> None: ... - database: Any = ... - def setup_backend(self) -> None: ... - def record_ticket(self, record: Any, data: Any, hash: Any, app_id: Any) -> None: ... - def count_tickets(self): ... - def get_tickets(self, order_by: str = ..., limit: int = ..., offset: int = ...): ... - def solve_ticket(self, ticket_id: Any) -> None: ... - def delete_ticket(self, ticket_id: Any) -> None: ... - def get_ticket(self, ticket_id: Any): ... - def get_occurrences( - self, ticket: Any, order_by: str = ..., limit: int = ..., offset: int = ... - ): ... - -class TicketingBaseHandler(Handler, HashingHandlerMixin): - hash_salt: Any = ... - def __init__( - self, hash_salt: Any, level: Any = ..., filter: Optional[Any] = ..., bubble: bool = ... - ) -> None: ... - def hash_record_raw(self, record: Any): ... - -class TicketingHandler(TicketingBaseHandler): - default_backend: Any = ... - app_id: Any = ... - def __init__( - self, - uri: Any, - app_id: str = ..., - level: Any = ..., - filter: Optional[Any] = ..., - bubble: bool = ..., - hash_salt: Optional[Any] = ..., - backend: Optional[Any] = ..., - **db_options: Any, - ) -> None: ... - db: Any = ... - def set_backend(self, cls: Any, **options: Any) -> None: ... - def process_record(self, record: Any, hash: Any): ... - def record_ticket(self, record: Any, data: Any, hash: Any) -> None: ... - def emit(self, record: Any) -> None: ... diff --git a/third-party-stubs/logbook/utils.pyi b/third-party-stubs/logbook/utils.pyi deleted file mode 100644 index 27f9bb5d818..00000000000 --- a/third-party-stubs/logbook/utils.pyi +++ /dev/null @@ -1,39 +0,0 @@ -# Stubs for logbook.utils (Python 3) -# -# NOTE: This dynamically typed stub was automatically generated by stubgen. - -import threading -from .base import DEBUG, Logger -from .helpers import string_types -from typing import Any, Optional - -class _SlowContextNotifier: - timer: Any = ... - def __init__(self, threshold: Any, func: Any) -> None: ... - def __enter__(self): ... - def __exit__(self, *_: Any) -> None: ... - -def logged_if_slow(*args: Any, **kwargs: Any): ... - -class _Local(threading.local): - enabled: bool = ... - -def suppressed_deprecations() -> None: ... -def forget_deprecation_locations() -> None: ... -def log_deprecation_message(message: Any, frame_correction: int = ...) -> None: ... - -class _DeprecatedFunction: - def __init__( - self, func: Any, message: Any, obj: Optional[Any] = ..., objtype: Optional[Any] = ... - ) -> None: ... - def __call__(self, *args: Any, **kwargs: Any): ... - def __get__(self, obj: Any, objtype: Any): ... - def bound_to(self, obj: Any, objtype: Any): ... - @property - def __name__(self): ... - @property - def __doc__(self): ... - @__doc__.setter - def __doc__(self, doc: Any) -> None: ... - -def deprecated(func: Optional[Any] = ..., message: Optional[Any] = ...): ...