mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Snapshot of python-skeletons @ a3175f6
This commit is contained in:
@@ -64,17 +64,17 @@ Skeletons should respect [PEP-8](http://www.python.org/dev/peps/pep-0008/) and
|
||||
If you need to reference the members of the original module of a skeleton, you
|
||||
should import it explicitly. For example, in a skeleton for the `foo` module:
|
||||
|
||||
import foo
|
||||
```python
|
||||
import foo
|
||||
|
||||
class C(foo.B):
|
||||
def bar():
|
||||
"""Do bar and return Bar.
|
||||
|
||||
class C(foo.B):
|
||||
def bar():
|
||||
"""Do bar and return Bar.
|
||||
|
||||
:rtype: foo.Bar
|
||||
"""
|
||||
return foo.Bar()
|
||||
|
||||
:rtype: foo.Bar
|
||||
"""
|
||||
return foo.Bar()
|
||||
```
|
||||
Modules can be referenced in docstring without explicit imports.
|
||||
|
||||
The body of a function in a skeleton file should consist of a single `return`
|
||||
@@ -124,36 +124,37 @@ Python 3 function annotations.
|
||||
If you want to create a parameterized class, you should define its parameters
|
||||
in the mock return type of a constructor:
|
||||
|
||||
class C(object):
|
||||
"""Some collection C that can contain values of T."""
|
||||
```python
|
||||
class C(object):
|
||||
"""Some collection C that can contain values of T."""
|
||||
|
||||
def __init__(self, value):
|
||||
"""Initialize C.
|
||||
def __init__(self, value):
|
||||
"""Initialize C.
|
||||
|
||||
:type value: T
|
||||
:rtype: C[T]
|
||||
"""
|
||||
pass
|
||||
:type value: T
|
||||
:rtype: C[T]
|
||||
"""
|
||||
pass
|
||||
|
||||
def get(self):
|
||||
"""Return the contained value.
|
||||
|
||||
:rtype: T
|
||||
"""
|
||||
pass
|
||||
def get(self):
|
||||
"""Return the contained value.
|
||||
|
||||
:rtype: T
|
||||
"""
|
||||
pass
|
||||
```
|
||||
|
||||
### Versioning
|
||||
|
||||
The recommended way of checking the version of Python is:
|
||||
|
||||
import sys
|
||||
|
||||
|
||||
if sys.version_info >= (2, 7) and sys.version_info < (3,):
|
||||
def from_27_until_30():
|
||||
pass
|
||||
```python
|
||||
import sys
|
||||
|
||||
if sys.version_info >= (2, 7) and sys.version_info < (3,):
|
||||
def from_27_until_30():
|
||||
pass
|
||||
```
|
||||
A skeleton should document the most recently released version of a library. Use
|
||||
deprecation warnings for functions that have been removed from the API.
|
||||
|
||||
@@ -209,9 +210,10 @@ plugin 3.0.1 for IntelliJ still doesn't include this repository). You
|
||||
plugin for IntelliJ installation. If you want to change the skeletons, clone
|
||||
the skeletons GitHub repository into your PyCharm/IntelliJ config directory:
|
||||
|
||||
cd <config directory>
|
||||
git clone https://github.com/JetBrains/python-skeletons.git
|
||||
|
||||
```bash
|
||||
cd <config directory>
|
||||
git clone https://github.com/JetBrains/python-skeletons.git
|
||||
```
|
||||
where `<config directory>` is:
|
||||
|
||||
* PyCharm
|
||||
|
||||
@@ -2168,6 +2168,12 @@ class dict(object):
|
||||
"""
|
||||
pass
|
||||
|
||||
def __iter__(self):
|
||||
"""
|
||||
:rtype: collections.Iterator[T]
|
||||
"""
|
||||
pass
|
||||
|
||||
def __len__(self):
|
||||
"""Return the number of items in the dictionary d.
|
||||
|
||||
|
||||
@@ -1857,6 +1857,12 @@ class dict(object):
|
||||
"""
|
||||
pass
|
||||
|
||||
def __iter__(self):
|
||||
"""
|
||||
:rtype: collections.Iterator[T]
|
||||
"""
|
||||
pass
|
||||
|
||||
def __len__(self):
|
||||
"""Return the number of items in the dictionary d.
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ class Iterator(collections.Iterable):
|
||||
"""
|
||||
pass
|
||||
|
||||
if sys.version_info < (3, 0):
|
||||
def next(self):
|
||||
"""
|
||||
:rtype: T
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
"""Skeleton for 'itertools' stdlib module."""
|
||||
|
||||
class islice(object):
|
||||
def __init__(self, iterable, start, stop=None, step=None):
|
||||
"""
|
||||
:type iterable: collections.Iterable[T]
|
||||
:type start: numbers.Integral
|
||||
:type stop: numbers.Integral | None
|
||||
:type step: numbers.Integral | None
|
||||
:rtype: itertools.islice[T]
|
||||
"""
|
||||
pass
|
||||
@@ -241,10 +241,9 @@ def setreuid(ruid, euid):
|
||||
pass
|
||||
|
||||
|
||||
def setsid(pid):
|
||||
def setsid():
|
||||
"""Call the system call getsid().
|
||||
|
||||
:type pid: int
|
||||
:rtype: None
|
||||
"""
|
||||
pass
|
||||
@@ -898,11 +897,13 @@ def statvfs(path):
|
||||
pass
|
||||
|
||||
|
||||
def symlink(source, link_name):
|
||||
def symlink(source, link_name, target_is_directory=False, dir_fd=None):
|
||||
"""Create a symbolic link pointing to source named link_name.
|
||||
|
||||
:type source: bytes | unicode
|
||||
:type link_name: bytes| unicode
|
||||
:type target_is_directory: bool
|
||||
:type dir_fd: int | None
|
||||
:rtype: None
|
||||
"""
|
||||
pass
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
"""Skeleton for 'sys' stdlib module."""
|
||||
|
||||
|
||||
def getsizeof(object, default=None):
|
||||
"""
|
||||
:type default: T | None
|
||||
:rtype: int | T
|
||||
"""
|
||||
return 0
|
||||
Reference in New Issue
Block a user