Skip to content

Commit

Permalink
Add doctypes
Browse files Browse the repository at this point in the history
  • Loading branch information
Erotemic committed Aug 4, 2023
1 parent 22c416f commit e14cc19
Show file tree
Hide file tree
Showing 8 changed files with 114 additions and 3 deletions.
5 changes: 4 additions & 1 deletion line_profiler/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
"""


from .line_profiler import __version__
# from .line_profiler import __version__

# NOTE: This needs to be in sync with ../kernprof.py and line_profiler.py
__version__ = '4.0.4'

from .line_profiler import (LineProfiler,
load_ipython_extension, load_stats, main,
Expand Down
1 change: 1 addition & 0 deletions line_profiler/__main__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

7 changes: 7 additions & 0 deletions line_profiler/ipython_extension.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from IPython.core.magic import Magics


class LineProfilerMagics(Magics):

def lprun(self, parameter_s: str = ...):
...
4 changes: 2 additions & 2 deletions line_profiler/line_profiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
f'Has it been compiled? Underlying error is ex={ex!r}'
)

# NOTE: This needs to be in sync with ../kernprof.py
# NOTE: This needs to be in sync with ../kernprof.py and __init__.py
__version__ = '4.0.4'


Expand Down Expand Up @@ -231,7 +231,7 @@ def show_func(filename, start_lineno, func_name, timings, unit,
output_unit (float | None):
Output unit (in seconds) in which the timing info is displayed.
stream (io.TextIO | None):
stream (io.TextIOBase | None):
defaults to sys.stdout
stripzeros (bool):
Expand Down
98 changes: 98 additions & 0 deletions line_profiler/line_profiler.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
from typing import List
from typing import Tuple
import io
from ._line_profiler import LineProfiler as CLineProfiler
from _typeshed import Incomplete


def load_ipython_extension(ip) -> None:
...


def is_coroutine(f):
...


CO_GENERATOR: int


def is_generator(f):
...


def is_classmethod(f):
...


class LineProfiler(CLineProfiler):

def __call__(self, func):
...

def wrap_classmethod(self, func):
...

def wrap_coroutine(self, func):
...

def wrap_generator(self, func):
...

def wrap_function(self, func):
...

def dump_stats(self, filename) -> None:
...

def print_stats(self,
stream: Incomplete | None = ...,
output_unit: Incomplete | None = ...,
stripzeros: bool = ...,
summarize: bool = ...,
sort: bool = ...) -> None:
...

def run(self, cmd):
...

def runctx(self, cmd, globals, locals):
...

def runcall(self, func, *args, **kw):
...

def add_module(self, mod):
...


def is_ipython_kernel_cell(filename):
...


def show_func(filename: str,
start_lineno: int,
func_name: str,
timings: List[Tuple[int, int, float]],
unit: float,
output_unit: float | None = None,
stream: io.TextIOBase | None = None,
stripzeros: bool = False) -> None:
...


def show_text(stats,
unit,
output_unit: Incomplete | None = ...,
stream: Incomplete | None = ...,
stripzeros: bool = ...,
summarize: bool = ...,
sort: bool = ...):
...


def load_stats(filename):
...


def main():
...
Empty file added line_profiler/py.typed
Empty file.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ description = "Line-by-line profiler"
url = "https://github.com/pyutils/line_profiler"
license = "BSD"
dev_status = "stable"
typed = true

[tool.pytest.ini_options]
addopts = "--ignore-glob=setup.py --ignore-glob=dev"
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ def run_cythonize(force=False):
setupkw["py_modules"] = ['kernprof', 'line_profiler']
setupkw["python_requires"] = ">=3.6"
setupkw['license_files'] = ['LICENSE.txt', 'LICENSE_Python.txt']
setupkw["package_data"] = {"line_profiler": ["py.typed", "*.pyi"]}
setupkw['keywords'] = ['timing', 'timer', 'profiling', 'profiler', 'line_profiler']
setupkw["classifiers"] = [
'Development Status :: 5 - Production/Stable',
Expand Down

0 comments on commit e14cc19

Please sign in to comment.