Skip to content

Commit 6eb6ffe

Browse files
committed
Enforce pep257
Additional update: .gitignore -> templates for vim, jetbrains, windows, python
1 parent c3c1c5c commit 6eb6ffe

File tree

6 files changed

+121
-50
lines changed

6 files changed

+121
-50
lines changed

.gitignore

Lines changed: 73 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,80 @@
11
# Created by .ignore support plugin (hsz.mobi)
2+
### JetBrains template
3+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
4+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
5+
6+
# User-specific stuff:
7+
.idea/**/workspace.xml
8+
.idea/**/tasks.xml
9+
10+
# Sensitive or high-churn files:
11+
.idea/**/dataSources/
12+
.idea/**/dataSources.ids
13+
.idea/**/dataSources.xml
14+
.idea/**/dataSources.local.xml
15+
.idea/**/sqlDataSources.xml
16+
.idea/**/dynamic.xml
17+
.idea/**/uiDesigner.xml
18+
19+
# Gradle:
20+
.idea/**/gradle.xml
21+
.idea/**/libraries
22+
23+
# Mongo Explorer plugin:
24+
.idea/**/mongoSettings.xml
25+
26+
## File-based project format:
27+
*.iws
28+
29+
## Plugin-specific files:
30+
31+
# IntelliJ
32+
/out/
33+
34+
# mpeltonen/sbt-idea plugin
35+
.idea_modules/
36+
37+
# JIRA plugin
38+
atlassian-ide-plugin.xml
39+
40+
# Crashlytics plugin (for Android Studio and IntelliJ)
41+
com_crashlytics_export_strings.xml
42+
crashlytics.properties
43+
crashlytics-build.properties
44+
fabric.properties
245
### Vim template
346
# swap
4-
[._]*.s[a-w][a-z]
5-
[._]s[a-w][a-z]
47+
[._]*.s[a-v][a-z]
48+
[._]*.sw[a-p]
49+
[._]s[a-v][a-z]
50+
[._]sw[a-p]
651
# session
752
Session.vim
853
# temporary
954
.netrwhist
1055
*~
1156
# auto-generated tag files
1257
tags
58+
### Windows template
59+
# Windows thumbnail cache files
60+
Thumbs.db
61+
ehthumbs.db
62+
ehthumbs_vista.db
63+
64+
# Folder config file
65+
Desktop.ini
66+
67+
# Recycle Bin used on file shares
68+
$RECYCLE.BIN/
69+
70+
# Windows Installer files
71+
*.cab
72+
*.msi
73+
*.msm
74+
*.msp
75+
76+
# Windows shortcuts
77+
*.lnk
1378
### Python template
1479
# Byte-compiled / optimized / DLL files
1580
__pycache__/
@@ -33,6 +98,7 @@ lib64/
3398
parts/
3499
sdist/
35100
var/
101+
wheels/
36102
*.egg-info/
37103
.installed.cfg
38104
*.egg
@@ -74,13 +140,14 @@ instance/
74140
.scrapy
75141

76142
# Sphinx documentation
143+
docs/_build/
77144
doc/build/
78145
doc/source/modules/
79146

80147
# PyBuilder
81148
target/
82149

83-
# IPython Notebook
150+
# Jupyter Notebook
84151
.ipynb_checkpoints
85152

86153
# pyenv
@@ -93,6 +160,7 @@ celerybeat-schedule
93160
.env
94161

95162
# virtualenv
163+
.venv
96164
venv/
97165
ENV/
98166

@@ -102,6 +170,5 @@ ENV/
102170
# Rope project settings
103171
.ropeproject
104172

105-
# Pycharm
106-
### Manually added
107-
.idea
173+
# Test results
174+
/*_result.xml

logwrap/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
# License for the specific language governing permissions and limitations
1515
# under the License.
1616

17-
"""logwrap module
17+
"""logwrap module.
1818
19-
Contents: 'logwrap', 'pretty_repr'
19+
Contents: 'logwrap', 'pretty_repr', 'pretty_str'
2020
2121
Original code was made for Mirantis Inc by Alexey Stepanov,
2222
later it has been reworked and extended for support of special cases.
@@ -31,9 +31,9 @@
3131

3232
__version__ = '1.3.0'
3333

34-
__all__ = [
34+
__all__ = (
3535
'logwrap',
3636
'PrettyFormat',
3737
'pretty_repr',
3838
'pretty_str'
39-
]
39+
)

logwrap/_formatters.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66
# License for the specific language governing permissions and limitations
77
# under the License.
88

9-
"""formatters module
9+
"""formatters module.
1010
11-
This is no reason to import this submodule directly, it's strictly internal"""
11+
This is no reason to import this submodule directly, it's strictly internal
12+
"""
1213

1314
from __future__ import absolute_import
1415
from __future__ import unicode_literals
@@ -29,7 +30,7 @@
2930

3031

3132
def _strings_repr(indent, val):
32-
"""Custom repr for strings and binary strings"""
33+
"""Custom repr for strings and binary strings."""
3334
if isinstance(val, binary_type):
3435
val = val.decode(
3536
encoding='utf-8',
@@ -47,7 +48,7 @@ def _strings_repr(indent, val):
4748

4849

4950
def _set_repr(indent, val):
50-
"""Custom repr formatter for sets"""
51+
"""Custom repr formatter for sets."""
5152
return "{spc:<{indent}}{val}".format(
5253
spc='',
5354
indent=indent,
@@ -83,7 +84,7 @@ def _set_repr(indent, val):
8384

8485

8586
def _strings_str(indent, val):
86-
"""Custom repr for strings and binary strings"""
87+
"""Custom repr for strings and binary strings."""
8788
if isinstance(val, binary_type):
8889
val = val.decode(
8990
encoding='utf-8',
@@ -97,7 +98,7 @@ def _strings_str(indent, val):
9798

9899

99100
def _set_str(indent, val):
100-
"""Custom repr formatter for sets"""
101+
"""Custom repr formatter for sets."""
101102
return "{spc:<{indent}}{val}".format(
102103
spc='',
103104
indent=indent,
@@ -132,7 +133,7 @@ def _set_str(indent, val):
132133
}
133134

134135

135-
__all__ = [
136+
__all__ = (
136137
'c_repr_formatters', 's_repr_formatters',
137138
'c_str_formatters', 's_str_formatters',
138-
]
139+
)

logwrap/_log_wrap.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# License for the specific language governing permissions and limitations
1515
# under the License.
1616

17-
"""log_wrap module
17+
"""log_wrap module.
1818
1919
This is no reason to import this submodule directly, all required methods is
2020
available from the main module.
@@ -50,14 +50,13 @@
5050

5151

5252
def _get_func_args_repr(sig, args, kwargs, max_indent, blacklisted_names):
53-
"""Internal helper for reducing complexity of decorator code
53+
"""Internal helper for reducing complexity of decorator code.
5454
5555
:type sig: inspect.Signature
5656
:type max_indent: int
5757
:type blacklisted_names: list
5858
:rtype: str
5959
"""
60-
6160
bound = sig.bind(*args, **kwargs).arguments
6261

6362
param_str = ""
@@ -92,7 +91,7 @@ def logwrap(
9291
spec=None,
9392
blacklisted_names=None,
9493
):
95-
"""Log function calls and return values
94+
"""Log function calls and return values.
9695
9796
:param log: logger object for decorator, by default used 'logwrap'
9897
:type log: logging.Logger
@@ -119,7 +118,7 @@ def logwrap(
119118
blacklisted_names = []
120119

121120
def real_decorator(func):
122-
"""Log function calls and return values
121+
"""Log function calls and return values.
123122
124123
This decorator could be extracted as configured from outer function.
125124
@@ -133,10 +132,6 @@ def real_decorator(func):
133132

134133
@functools.wraps(func)
135134
def wrapped(*args, **kwargs):
136-
"""Real wrapper.
137-
138-
*args and **kwargs is bound in separate helpers
139-
"""
140135
args_repr = _get_func_args_repr(
141136
sig=sig,
142137
args=args,
@@ -184,4 +179,4 @@ def wrapped(*args, **kwargs):
184179
return real_decorator
185180

186181

187-
__all__ = ['logwrap']
182+
__all__ = ('logwrap', )

0 commit comments

Comments
 (0)