Skip to content

Commit

Permalink
numpy back to 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Kludex committed Jul 5, 2024
1 parent 492f779 commit 1a7d6b2
Show file tree
Hide file tree
Showing 27 changed files with 45 additions and 71 deletions.
2 changes: 0 additions & 2 deletions logfire-api/logfire_api/_internal/ast_utils.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ class LogfireArgs:
msg_template: str | None = ...
span_name: str | None = ...
extract_args: bool = ...
def __init__(self, tags, sample_rate, msg_template=..., span_name=..., extract_args=...) -> None: ...

@dataclass
class BaseTransformer(ast.NodeTransformer):
Expand All @@ -33,4 +32,3 @@ class BaseTransformer(ast.NodeTransformer):
def rewrite_function(self, node: ast.FunctionDef | ast.AsyncFunctionDef, qualname: str) -> ast.AST: ...
def logfire_method_call_node(self, node: ast.FunctionDef | ast.AsyncFunctionDef, qualname: str) -> ast.Call: ...
def logfire_method_arg_values(self, qualname: str, lineno: int) -> tuple[str, dict[str, otel_types.AttributeValue]]: ...
def __init__(self, logfire_args, logfire_method_name, filename, module_name) -> None: ...
2 changes: 0 additions & 2 deletions logfire-api/logfire_api/_internal/auto_trace/import_hook.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ class LogfireFinder(MetaPathFinder):
particularly finding the module's source code and filename.
If it finds a module spec that matches the filter, it returns a new spec that uses the LogfireLoader.
"""
def __init__(self, logfire, modules_filter, min_duration) -> None: ...

@dataclass
class LogfireLoader(Loader):
Expand All @@ -37,4 +36,3 @@ class LogfireLoader(Loader):
def create_module(self, spec: ModuleSpec): ...
def __getattr__(self, item: str):
"""Forward some methods to the plain spec's loader (likely a `SourceFileLoader`) if they exist."""
def __init__(self, plain_spec, source, logfire, min_duration) -> None: ...
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ class AutoTraceTransformer(BaseTransformer):
def visit_ClassDef(self, node: ast.ClassDef): ...
def visit_FunctionDef(self, node: ast.FunctionDef | ast.AsyncFunctionDef): ...
def logfire_method_call_node(self, node: ast.FunctionDef | ast.AsyncFunctionDef, qualname: str) -> ast.Call: ...
def __init__(self, logfire_args, logfire_method_name, filename, module_name, logfire_instance, context_factories, min_duration) -> None: ...
T = TypeVar('T')

def no_auto_trace(x: T) -> T:
Expand Down
1 change: 0 additions & 1 deletion logfire-api/logfire_api/_internal/auto_trace/types.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,5 @@ class AutoTraceModule:
If a prefix contains any characters other than letters, numbers, and dots,
then it will be treated as a regular expression.
"""
def __init__(self, name, filename) -> None: ...

def get_module_pattern(module: str): ...
12 changes: 4 additions & 8 deletions logfire-api/logfire_api/_internal/config.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ from .tracer import PendingSpanProcessor as PendingSpanProcessor, ProxyTracerPro
from .utils import UnexpectedResponse as UnexpectedResponse, ensure_data_dir_exists as ensure_data_dir_exists, get_version as get_version, read_toml_file as read_toml_file, suppress_instrumentation as suppress_instrumentation
from _typeshed import Incomplete
from dataclasses import dataclass
from functools import cached_property as cached_property
from functools import cached_property
from logfire.exceptions import LogfireConfigError as LogfireConfigError
from logfire.version import VERSION as VERSION
from opentelemetry import metrics
from opentelemetry.sdk.metrics.export import MetricReader as MetricReader
from opentelemetry.sdk.trace import SpanProcessor as SpanProcessor
from opentelemetry.sdk.trace.export import SpanExporter as SpanExporter
from opentelemetry.sdk.trace.id_generator import IdGenerator as IdGenerator
from opentelemetry.sdk.trace import SpanProcessor
from opentelemetry.sdk.trace.export import SpanExporter
from opentelemetry.sdk.trace.id_generator import IdGenerator
from pathlib import Path
from typing import Any, Callable, Literal, Sequence
from typing_extensions import Self
Expand All @@ -45,15 +45,13 @@ class ConsoleOptions:
include_timestamps: bool = ...
verbose: bool = ...
min_log_level: LevelName = ...
def __init__(self, colors=..., span_style=..., include_timestamps=..., verbose=..., min_log_level=...) -> None: ...

@dataclass
class PydanticPlugin:
"""Options for the Pydantic plugin."""
record: PydanticPluginRecordValues = ...
include: set[str] = ...
exclude: set[str] = ...
def __init__(self, record=..., include=..., exclude=...) -> None: ...

def configure(*, send_to_logfire: bool | Literal['if-token-present'] | None = None, token: str | None = None, project_name: str | None = None, service_name: str | None = None, service_version: str | None = None, trace_sample_rate: float | None = None, console: ConsoleOptions | Literal[False] | None = None, show_summary: bool | None = None, config_dir: Path | str | None = None, data_dir: Path | str | None = None, base_url: str | None = None, collect_system_metrics: bool | None = None, id_generator: IdGenerator | None = None, ns_timestamp_generator: Callable[[], int] | None = None, processors: None = None, additional_span_processors: Sequence[SpanProcessor] | None = None, default_span_processor: Callable[[SpanExporter], SpanProcessor] | None = None, metric_readers: None = None, additional_metric_readers: Sequence[MetricReader] | None = None, pydantic_plugin: PydanticPlugin | None = None, fast_shutdown: bool = False, scrubbing_patterns: Sequence[str] | None = None, scrubbing_callback: ScrubCallback | None = None, scrubbing: ScrubbingOptions | Literal[False] | None = None, inspect_arguments: bool | None = None, tail_sampling: TailSamplingOptions | None = None) -> None:
"""Configure the logfire SDK.
Expand Down Expand Up @@ -140,7 +138,6 @@ class _LogfireConfigData:
scrubbing: ScrubbingOptions | Literal[False]
inspect_arguments: bool
tail_sampling: TailSamplingOptions | None
def __init__(self, base_url, send_to_logfire, token, project_name, service_name, trace_sample_rate, console, show_summary, data_dir, collect_system_metrics, id_generator, ns_timestamp_generator, additional_span_processors, pydantic_plugin, default_span_processor, fast_shutdown, scrubbing, inspect_arguments, tail_sampling) -> None: ...

class LogfireConfig(_LogfireConfigData):
def __init__(self, base_url: str | None = None, send_to_logfire: bool | None = None, token: str | None = None, project_name: str | None = None, service_name: str | None = None, service_version: str | None = None, trace_sample_rate: float | None = None, console: ConsoleOptions | Literal[False] | None = None, show_summary: bool | None = None, config_dir: Path | None = None, data_dir: Path | None = None, collect_system_metrics: bool | None = None, id_generator: IdGenerator | None = None, ns_timestamp_generator: Callable[[], int] | None = None, additional_span_processors: Sequence[SpanProcessor] | None = None, default_span_processor: Callable[[SpanExporter], SpanProcessor] | None = None, additional_metric_readers: Sequence[MetricReader] | None = None, pydantic_plugin: PydanticPlugin | None = None, fast_shutdown: bool = False, scrubbing: ScrubbingOptions | Literal[False] | None = None, inspect_arguments: bool | None = None, tail_sampling: TailSamplingOptions | None = None) -> None:
Expand Down Expand Up @@ -291,7 +288,6 @@ class LogfireCredentials:
"""Write a credentials file to the given path."""
def print_token_summary(self) -> None:
"""Print a summary of the existing project."""
def __init__(self, token, project_name, project_url, logfire_api_url) -> None: ...

def get_git_revision_hash() -> str:
"""Get the current git commit hash."""
Expand Down
5 changes: 1 addition & 4 deletions logfire-api/logfire_api/_internal/config_params.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ from .exporters.console import ConsoleColorsValues as ConsoleColorsValues
from .utils import read_toml_file as read_toml_file
from _typeshed import Incomplete
from dataclasses import dataclass
from functools import cached_property as cached_property
from functools import cached_property
from logfire.exceptions import LogfireConfigError as LogfireConfigError
from pathlib import Path
from typing import Any, Callable, TypeVar
Expand All @@ -21,7 +21,6 @@ class ConfigParam:
allow_file_config: bool = ...
default: Any = ...
tp: Any = ...
def __init__(self, env_vars, allow_file_config=..., default=..., tp=...) -> None: ...

@dataclass
class _DefaultCallback:
Expand All @@ -30,7 +29,6 @@ class _DefaultCallback:
A good example is when we want to check if we are running under pytest and set a default value based on that.
"""
callback: Callable[[], Any]
def __init__(self, callback) -> None: ...

BASE_URL: Incomplete
SEND_TO_LOGFIRE: Incomplete
Expand Down Expand Up @@ -80,6 +78,5 @@ class ParamManager:
"""
@cached_property
def pydantic_plugin(self): ...
def __init__(self, config_from_file) -> None: ...

def default_param_manager(): ...
2 changes: 1 addition & 1 deletion logfire-api/logfire_api/_internal/exporters/console.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ from ..constants import ATTRIBUTES_JSON_SCHEMA_KEY as ATTRIBUTES_JSON_SCHEMA_KEY
from ..json_formatter import json_args_value_formatter as json_args_value_formatter
from _typeshed import Incomplete
from collections.abc import Sequence
from opentelemetry.sdk.trace import Event as Event, ReadableSpan as ReadableSpan
from opentelemetry.sdk.trace import ReadableSpan
from opentelemetry.sdk.trace.export import SpanExportResult, SpanExporter
from typing import TextIO

Expand Down
4 changes: 2 additions & 2 deletions logfire-api/logfire_api/_internal/exporters/otlp.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ from ..stack_info import STACK_INFO_KEYS as STACK_INFO_KEYS
from ..utils import logger as logger, truncate_string as truncate_string
from .wrapper import WrapperSpanExporter as WrapperSpanExporter
from _typeshed import Incomplete
from functools import cached_property as cached_property
from opentelemetry.sdk.trace import ReadableSpan as ReadableSpan
from functools import cached_property
from opentelemetry.sdk.trace import ReadableSpan
from opentelemetry.sdk.trace.export import SpanExportResult
from requests import Session
from typing import Any, Mapping, Sequence
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ from ..scrubbing import BaseScrubber as BaseScrubber
from ..utils import ReadableSpanDict as ReadableSpanDict, is_instrumentation_suppressed as is_instrumentation_suppressed, span_to_dict as span_to_dict, truncate_string as truncate_string
from .wrapper import WrapperSpanProcessor as WrapperSpanProcessor
from _typeshed import Incomplete
from opentelemetry import context as context
from opentelemetry.sdk.trace import ReadableSpan, Span as Span, SpanProcessor as SpanProcessor
from opentelemetry.sdk.util.instrumentation import InstrumentationScope as InstrumentationScope
from opentelemetry import context
from opentelemetry.sdk.trace import ReadableSpan, Span, SpanProcessor

class MainSpanProcessorWrapper(WrapperSpanProcessor):
"""Wrapper around other processors to intercept starting and ending spans with our own global logic.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from .wrapper import WrapperMetricExporter as WrapperMetricExporter
from opentelemetry.sdk.metrics._internal.export import MetricExportResult
from opentelemetry.sdk.metrics._internal.point import MetricsData as MetricsData
from opentelemetry.sdk.metrics._internal.point import MetricsData
from typing import Any

class QuietMetricExporter(WrapperMetricExporter):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from ..constants import ATTRIBUTES_SPAN_TYPE_KEY as ATTRIBUTES_SPAN_TYPE_KEY
from .wrapper import WrapperSpanExporter as WrapperSpanExporter
from opentelemetry.sdk.trace import ReadableSpan as ReadableSpan
from opentelemetry.sdk.trace.export import SpanExportResult as SpanExportResult
from opentelemetry.sdk.trace.export import SpanExportResult
from typing import Sequence

class RemovePendingSpansExporter(WrapperSpanExporter):
Expand Down
8 changes: 3 additions & 5 deletions logfire-api/logfire_api/_internal/exporters/tail_sampling.pyi
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
from _typeshed import Incomplete
from dataclasses import dataclass
from functools import cached_property as cached_property
from functools import cached_property
from logfire._internal.constants import ATTRIBUTES_LOG_LEVEL_NUM_KEY as ATTRIBUTES_LOG_LEVEL_NUM_KEY, LEVEL_NUMBERS as LEVEL_NUMBERS, LevelName as LevelName, ONE_SECOND_IN_NANOSECONDS as ONE_SECOND_IN_NANOSECONDS
from logfire._internal.exporters.wrapper import WrapperSpanProcessor as WrapperSpanProcessor
from opentelemetry import context as context
from opentelemetry.sdk.trace import ReadableSpan as ReadableSpan, Span as Span, SpanProcessor as SpanProcessor
from opentelemetry import context
from opentelemetry.sdk.trace import ReadableSpan, Span, SpanProcessor

@dataclass
class TailSamplingOptions:
level: LevelName | None = ...
duration: float | None = ...
def __init__(self, level=..., duration=...) -> None: ...

@dataclass
class TraceBuffer:
Expand All @@ -19,7 +18,6 @@ class TraceBuffer:
ended: list[ReadableSpan]
@cached_property
def first_span(self) -> Span: ...
def __init__(self, started, ended) -> None: ...

class TailSamplingProcessor(WrapperSpanProcessor):
"""Passes spans to the wrapped processor if any span in a trace meets the sampling criteria."""
Expand Down
8 changes: 4 additions & 4 deletions logfire-api/logfire_api/_internal/exporters/wrapper.pyi
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from _typeshed import Incomplete
from opentelemetry import context as context
from opentelemetry.sdk.metrics.export import AggregationTemporality as AggregationTemporality, MetricExportResult as MetricExportResult, MetricExporter, MetricsData as MetricsData
from opentelemetry import context
from opentelemetry.sdk.metrics.export import AggregationTemporality as AggregationTemporality, MetricExportResult, MetricExporter, MetricsData
from opentelemetry.sdk.metrics.view import Aggregation as Aggregation
from opentelemetry.sdk.trace import ReadableSpan as ReadableSpan, Span as Span, SpanProcessor
from opentelemetry.sdk.trace.export import SpanExportResult as SpanExportResult, SpanExporter
from opentelemetry.sdk.trace import ReadableSpan, Span, SpanProcessor
from opentelemetry.sdk.trace.export import SpanExportResult, SpanExporter
from typing import Any, Sequence

class WrapperSpanExporter(SpanExporter):
Expand Down
2 changes: 1 addition & 1 deletion logfire-api/logfire_api/_internal/formatter.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ from .utils import truncate_string as truncate_string
from _typeshed import Incomplete
from logfire._internal.stack_info import get_user_frame_and_stacklevel as get_user_frame_and_stacklevel
from string import Formatter
from types import CodeType
from types import CodeType as CodeType
from typing import Any, Final, Literal, Mapping
from typing_extensions import NotRequired, TypedDict

Expand Down
1 change: 0 additions & 1 deletion logfire-api/logfire_api/_internal/instrument.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,3 @@ class InstrumentTransformer(BaseTransformer):
def rewrite_function(self, node: ast.FunctionDef | ast.AsyncFunctionDef, qualname: str) -> ast.AST: ...
def logfire_method_call_node(self, node: ast.FunctionDef | ast.AsyncFunctionDef, qualname: str) -> ast.Call: ...
def logfire_method_arg_nodes(self, node: ast.FunctionDef | ast.AsyncFunctionDef, qualname: str) -> list[ast.expr]: ...
def __init__(self, logfire_args, logfire_method_name, filename, module_name, code_lineno) -> None: ...
3 changes: 1 addition & 2 deletions logfire-api/logfire_api/_internal/integrations/fastapi.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from ..main import Logfire as Logfire
from ..stack_info import StackInfo as StackInfo, get_code_object_info as get_code_object_info
from _typeshed import Incomplete
from fastapi import FastAPI as FastAPI
from fastapi.routing import APIWebSocketRoute as APIWebSocketRoute
from fastapi import FastAPI
from starlette.requests import Request
from starlette.websockets import WebSocket
from typing import Any, Awaitable, Callable, ContextManager, Iterable
Expand Down
2 changes: 1 addition & 1 deletion logfire-api/logfire_api/_internal/integrations/flask.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from flask.app import Flask as Flask
from flask.app import Flask
from typing import Any

def instrument_flask(app: Flask, **kwargs: Any):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from starlette.applications import Starlette as Starlette
from starlette.applications import Starlette
from typing import Any

def instrument_starlette(app: Starlette, **kwargs: Any):
Expand Down
13 changes: 7 additions & 6 deletions logfire-api/logfire_api/_internal/main.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ from .stack_info import get_user_stack_info as get_user_stack_info
from .tracer import ProxyTracerProvider as ProxyTracerProvider
from .utils import handle_internal_errors as handle_internal_errors, log_internal_error as log_internal_error, uniquify_sequence as uniquify_sequence
from django.http import HttpRequest as HttpRequest, HttpResponse as HttpResponse
from fastapi import FastAPI as FastAPI
from flask.app import Flask as Flask
from functools import cached_property as cached_property
from opentelemetry.metrics import CallbackT as CallbackT, Counter as Counter, Histogram as Histogram, UpDownCounter as UpDownCounter, _Gauge as Gauge
from fastapi import FastAPI
from flask.app import Flask
from opentelemetry.metrics import CallbackT as CallbackT, Counter, Histogram, UpDownCounter, _Gauge as Gauge
from opentelemetry.sdk.trace import ReadableSpan, Span as Span
from opentelemetry.trace import Tracer as Tracer
from opentelemetry.trace import Tracer
from opentelemetry.util import types as otel_types
from starlette.applications import Starlette as Starlette
from starlette.applications import Starlette
from starlette.requests import Request as Request
from starlette.websockets import WebSocket as WebSocket
from types import TracebackType as TracebackType
from typing import Any, Callable, ContextManager, Iterable, Literal, Sequence, TypeVar
from typing_extensions import LiteralString

Expand Down Expand Up @@ -847,6 +847,7 @@ class FastLogfireSpan:
class LogfireSpan(ReadableSpan):
end_on_exit: bool
def __init__(self, span_name: str, otlp_attributes: dict[str, otel_types.AttributeValue], tracer: Tracer, json_schema_properties: JsonSchemaProperties) -> None: ...
def __getattr__(self, name: str) -> Any: ...
def __enter__(self) -> LogfireSpan: ...
def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: Any) -> None: ...
@property
Expand Down
8 changes: 3 additions & 5 deletions logfire-api/logfire_api/_internal/metrics.pyi
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import abc
import dataclasses
from _typeshed import Incomplete
from abc import ABC
from opentelemetry.metrics import CallbackT as CallbackT, Counter, Histogram, Instrument, Meter, MeterProvider, ObservableCounter, ObservableGauge, ObservableUpDownCounter, UpDownCounter, _Gauge
from opentelemetry.util.types import Attributes as Attributes
from opentelemetry.util.types import Attributes
from threading import Lock
from typing import Generic, Sequence, TypeVar
from weakref import WeakSet
Expand All @@ -25,7 +24,6 @@ class ProxyMeterProvider(MeterProvider):
def set_meter_provider(self, meter_provider: MeterProvider) -> None: ...
def shutdown(self, timeout_millis: float = 30000) -> None: ...
def force_flush(self, timeout_millis: float = 30000) -> None: ...
def __init__(self, *generated_args, provider, meters=..., lock=..., **generated_kwargs) -> None: ...

class _ProxyMeter(Meter):
def __init__(self, meter: Meter, name: str, version: str | None, schema_url: str | None) -> None: ...
Expand All @@ -44,12 +42,12 @@ class _ProxyMeter(Meter):
def create_observable_up_down_counter(self, name: str, callbacks: Sequence[CallbackT] | None = None, unit: str = '', description: str = '') -> ObservableUpDownCounter: ...
InstrumentT = TypeVar('InstrumentT', bound=Instrument)

class _ProxyInstrument(ABC, Generic[InstrumentT], metaclass=abc.ABCMeta):
class _ProxyInstrument(ABC, Generic[InstrumentT]):
def __init__(self, instrument: InstrumentT, name: str, unit: str, description: str) -> None: ...
def on_meter_set(self, meter: Meter) -> None:
"""Called when a real meter is set on the creating _ProxyMeter."""

class _ProxyAsynchronousInstrument(_ProxyInstrument[InstrumentT], ABC, metaclass=abc.ABCMeta):
class _ProxyAsynchronousInstrument(_ProxyInstrument[InstrumentT], ABC):
def __init__(self, instrument: InstrumentT, name: str, callbacks: Sequence[CallbackT] | None, unit: str, description: str) -> None: ...

class _ProxyCounter(_ProxyInstrument[Counter], Counter):
Expand Down
Loading

0 comments on commit 1a7d6b2

Please sign in to comment.