New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

python-stopwatch

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

python-stopwatch - pypi Package Compare versions

Comparing version
1.1.7
to
1.1.8
+1
-1
PKG-INFO
Metadata-Version: 2.1
Name: python-stopwatch
Version: 1.1.7
Version: 1.1.8
Summary: A simple stopwatch for measuring code performance

@@ -5,0 +5,0 @@ Home-page: https://github.com/jonghwanhyeon/python-stopwatch

Metadata-Version: 2.1
Name: python-stopwatch
Version: 1.1.7
Version: 1.1.8
Summary: A simple stopwatch for measuring code performance

@@ -5,0 +5,0 @@ Home-page: https://github.com/jonghwanhyeon/python-stopwatch

from stopwatch.contextmanagers import profile, stopwatch
from stopwatch.stopwatch import Stopwatch
__version__ = "1.1.7"
__version__ = "1.1.8"

@@ -6,6 +6,5 @@ import atexit

from contextlib import contextmanager
from dataclasses import asdict, dataclass, field
from dataclasses import dataclass, field
from typing import Any, AsyncIterable, Callable, Coroutine, Generic, Iterable, Optional, Tuple, TypeVar, Union
from decorator import decorate
from typing_extensions import ParamSpec, Self, overload

@@ -29,2 +28,3 @@

format: str
format_at_exit: str
logger: SupportsInfo

@@ -40,5 +40,12 @@

"[bold][[[blue]{module}[/blue]:[green]{name}[/green]]][/bold]"
" "
" ~ "
"[magenta]{elapsed}[/magenta]"
" - "
"{statistics:hits, total, mean, min, median, max, stdev}"
),
"format_at_exit": (
"[bold][[[blue]{module}[/blue]:[green]{name}[/green]]][/bold]"
" - "
"{statistics:hits, total, mean, min, median, max, stdev}"
),
"logger": DefaultLogger(),

@@ -49,2 +56,3 @@ }

arguments["format"] = markup(arguments["format"])
arguments["format_at_exit"] = markup(arguments["format_at_exit"])

@@ -62,3 +70,3 @@ func = None

@dataclass
class ProfileContext(Generic[P, R]):
class ProfileContext(ABC, Generic[P, R]):
caller: Caller

@@ -72,8 +80,7 @@ func: Callable[P, R]

if self.arguments.report_at_exit:
atexit.register(self.print_report)
atexit.register(functools.partial(self.print_report, format=self.arguments.format_at_exit))
@overload
@abstractmethod
def build(self) -> Callable[P, R]: ... # type: ignore
def build(self) -> Callable[P, R]: ...
@overload

@@ -95,4 +102,4 @@ @abstractmethod

def print_report(self):
self.arguments.logger.info(self._make_report())
def print_report(self, format: str):
self.arguments.logger.info(self._make_report(format))

@@ -106,6 +113,6 @@ @contextmanager

if self.should_report:
self.print_report()
self.print_report(self.arguments.format)
def _make_report(self) -> str:
return self.arguments.format.format(
def _make_report(self, format: str) -> str:
return format.format(
module=self.caller.module,

@@ -179,5 +186,12 @@ name=self.arguments.name,

"[bold][[[blue]{module}[/blue]:[green]{name}[/green]]][/bold]"
" "
" ~ "
"[magenta]{elapsed}[/magenta]"
" - "
"{statistics:hits, total, mean, min, median, max, stdev}"
),
format_at_exit: str = (
"[bold][[[blue]{module}[/blue]:[green]{name}[/green]]][/bold]"
" - "
"{statistics:hits, total, mean, min, median, max, stdev}"
),
logger: Optional[SupportsInfo] = None,

@@ -184,0 +198,0 @@ ) -> Callable[[Callable[P, R]], Callable[P, R]]: ...