Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alanjds/pystubber
Creates a stub python file from a python module
https://github.com/alanjds/pystubber
generator hacktoberfest python stub
Last synced: about 1 month ago
JSON representation
Creates a stub python file from a python module
- Host: GitHub
- URL: https://github.com/alanjds/pystubber
- Owner: alanjds
- License: apache-2.0
- Created: 2019-03-09T19:08:39.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-03-13T03:49:14.000Z (almost 6 years ago)
- Last Synced: 2024-11-16T00:41:35.396Z (2 months ago)
- Topics: generator, hacktoberfest, python, stub
- Language: Python
- Homepage:
- Size: 12.7 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
pystubber
=========What differs from `mypy stubgen`?
As mypy's `stubgen -m random` generates the following for the `random` module:
```python
class Random(_random.Random):
VERSION: int = ...
gauss_next: Any = ...
def __init__(self, x: Optional[Any] = ...) -> None: ...
def seed(self, a: Optional[Any] = ..., version: int = ...) -> None: ...
def getstate(self): ...
def setstate(self, state: Any) -> None: ...
def __reduce__(self): ...
def randrange(self, start: Any, stop: Optional[Any] = ..., step: int = ..., _int: Any = ...): ...
def randint(self, a: Any, b: Any): ...
def choice(self, seq: Any): ...
...
````pystubber random` instead generates:
```py
#!/usr/bin/env python # [module random]
"""
Random variable generators.
...
"""
__all__ = ['Random', 'seed', 'random', 'uniform', 'randint', 'choice', 'sample', 'randrange', 'shuffle', 'normalvariate', 'lognormvariate', 'expovariate', 'vonmisesvariate', 'gammavariate', 'triangular', 'gauss', 'betavariate', 'paretovariate', 'weibullvariate', 'getstate', ...]class Random(_random.Random):
def __getstate__(self):
"""
# Issue 17489: Since __reduce__ was defined to fix #759889 this is no
# longer called; we leave it here because it has been here since random was
# rewritten back in 2001 and why risk breaking something.
"""
raise NotImplementedError()def __init__(self, x=None):
"""
Initialize an instance.Optional argument x controls seeding, as for Random.seed().
"""
raise NotImplementedError()def __reduce__(self):
"""
helper for pickle
"""
raise NotImplementedError()
...
```