Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc6a872a

Browse files
committed
Merge branch 'release/0.8.1'
2 parentsaf70229 +66b70dd commitc6a872a

File tree

16 files changed

+279
-91
lines changed

16 files changed

+279
-91
lines changed

‎Changelog.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Changelog
22
=========
33

4-
##2013-12-04 0.8.0
4+
##2014-06-11 0.8.1
55
-------------------
66
* Pylama updated to version 3.3.2
77
* Get fold's expression symbol from &fillchars;

‎autoload/pymode/troubleshooting.vim

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,26 @@ fun! pymode#troubleshooting#test() "{{{
1818

1919
callappend('0', ['Pymode diagnostic',
2020
\'===================',
21-
\'VIM:' .v:version .', OS:' . os .', multi_byte:' .has('multi_byte') .', pymode:' .g:pymode_version .', python:' .g:pymode_python,
21+
\'VIM:' .v:version .', OS:' . os .', multi_byte:' .has('multi_byte') .', pymode:' .g:pymode_version .',pymode-python:' .g:pymode_python,
2222
\''])
2323

2424
if!exists('#filetypeplugin')
2525
callappend('$', ['WARNING:','Python-mode required :filetype plugin indent on',''])
2626
endif
2727

28+
callappend('$', ['+python:' .has('python')])
29+
callappend('$', ['+python3:' .has('python3'),''])
30+
2831
ifg:pymode_python=='disable'
32+
2933
if!has('python')&&!has('python3')
3034

31-
callappend('$', ['WARNING:','Python-mode required vim compiled with +python or +python3.',
35+
callappend('$', ['WARNING: Python-mode required vim compiled with +python or +python3.',
3236
\'"lint, rope, run, doc, virtualenv" features disabled.',''])
3337

3438
else
3539

36-
callappend('$', ['WARNING:','Python is disabled by `pymode_python` option.',
40+
callappend('$', ['WARNING: Python is disabled by `pymode_python` option.',
3741
\'"lint, rope, run, doc, virtualenv" features disabled.',''])
3842

3943
endif

‎doc/pymode.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
(__) (__) (__) (_) (_)(_____)(_)\_) (_/\/\_)(_____)(____/(____)~
77

88

9-
Version: 0.8.0
9+
Version: 0.8.1
1010

1111
==============================================================================
1212
CONTENTS*pymode-contents*

‎plugin/pymode.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
" vi:fdl=1
2-
letg:pymode_version="0.8.0"
2+
letg:pymode_version="0.8.1"
33

44
com! PymodeVersionechomsg"Current python-mode version:" .g:pymode_version
55
com! PymodeTroubleshootingcallpymode#troubleshooting#test()

‎pymode/__init__.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,7 @@ class Options(object):
2929

3030
defget_documentation():
3131
""" Search documentation and append to current buffer. """
32-
try:
33-
fromStringIOimportStringIO
34-
exceptImportError:
35-
fromioimportStringIO
32+
from ._compatimportStringIO
3633

3734
sys.stdout,_=StringIO(),sys.stdout
3835
help(vim.eval('a:word'))

‎pymode/_compat.py

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
""" Compatibility.
2+
3+
Some py2/py3 compatibility support based on a stripped down
4+
version of six so we don't have to depend on a specific version
5+
of it.
6+
7+
:copyright: (c) 2014 by Armin Ronacher.
8+
:license: BSD
9+
"""
10+
importsys
11+
12+
PY2=sys.version_info[0]==2
13+
_identity=lambdax:x
14+
15+
16+
ifnotPY2:
17+
text_type=str
18+
string_types= (str,)
19+
integer_types= (int, )
20+
21+
iterkeys=lambdad:iter(d.keys())
22+
itervalues=lambdad:iter(d.values())
23+
iteritems=lambdad:iter(d.items())
24+
25+
fromioimportStringIO
26+
fromqueueimportQueue# noqa
27+
28+
defreraise(tp,value,tb=None):
29+
ifvalue.__traceback__isnottb:
30+
raisevalue.with_traceback(tb)
31+
raisevalue
32+
33+
implements_to_string=_identity
34+
35+
else:
36+
text_type=unicode
37+
string_types= (str,unicode)
38+
integer_types= (int,long)
39+
40+
iterkeys=lambdad:d.iterkeys()
41+
itervalues=lambdad:d.itervalues()
42+
iteritems=lambdad:d.iteritems()
43+
44+
fromcStringIOimportStringIO
45+
fromQueueimportQueue
46+
47+
exec('def reraise(tp, value, tb=None):\n raise tp, value, tb')
48+
49+
defimplements_to_string(cls):
50+
cls.__unicode__=cls.__str__
51+
cls.__str__=lambdax:x.__unicode__().encode('utf-8')
52+
returncls
53+
54+
55+
defwith_metaclass(meta,*bases):
56+
# This requires a bit of explanation: the basic idea is to make a
57+
# dummy metaclass for one level of class instantiation that replaces
58+
# itself with the actual metaclass. Because of internal type checks
59+
# we also need to make sure that we downgrade the custom metaclass
60+
# for one level to something closer to type (that's why __call__ and
61+
# __init__ comes back from type etc.).
62+
#
63+
# This has the advantage over six.with_metaclass in that it does not
64+
# introduce dummy classes into the final MRO.
65+
classmetaclass(meta):
66+
__call__=type.__call__
67+
__init__=type.__init__
68+
def__new__(cls,name,this_bases,d):
69+
ifthis_basesisNone:
70+
returntype.__new__(cls,name, (),d)
71+
returnmeta(name,bases,d)
72+
returnmetaclass('temporary_class',None, {})
73+
74+
75+
# Certain versions of pypy have a bug where clearing the exception stack
76+
# breaks the __exit__ function in a very peculiar way. This is currently
77+
# true for pypy 2.2.1 for instance. The second level of exception blocks
78+
# is necessary because pypy seems to forget to check if an exception
79+
# happend until the next bytecode instruction?
80+
BROKEN_PYPY_CTXMGR_EXIT=False
81+
ifhasattr(sys,'pypy_version_info'):
82+
class_Mgr(object):
83+
def__enter__(self):
84+
returnself
85+
def__exit__(self,*args):
86+
sys.exc_clear()
87+
try:
88+
try:
89+
with_Mgr():
90+
raiseAssertionError()
91+
except:
92+
raise
93+
exceptTypeError:
94+
BROKEN_PYPY_CTXMGR_EXIT=True
95+
exceptAssertionError:
96+
pass
97+
98+
# pylama:skip=1

‎pymode/async.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
""" Python-mode async support. """
22

3-
try:
4-
fromQueueimportQueue
5-
exceptImportError:
6-
fromqueueimportQueue# noqa
3+
from ._compatimportQueue
74

85

96
RESULTS=Queue()

‎pymode/environment.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
importtime
88
importos.path
99

10-
from .utilsimportPY2
10+
from ._compatimportPY2
1111

1212

1313
classVimPymodeEnviroment(object):

‎pymode/libs/pylama/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
"""
77

8-
__version__="3.3.2"
8+
__version__="5.0.1"
99
__project__="pylama"
1010
__author__="Kirill Klenov <horneds@gmail.com>"
1111
__license__="GNU LGPL"

‎pymode/libs/pylama/config.py

Lines changed: 36 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
""" Parse arguments from command line and configuration files. """
22
importfnmatch
33
importsys
4-
fromosimportgetcwd,path
4+
importos
55
fromreimportcompileasre
66

77
importlogging
@@ -21,8 +21,11 @@
2121
#: A default checkers
2222
DEFAULT_LINTERS='pep8','pyflakes','mccabe'
2323

24-
CURDIR=getcwd()
25-
DEFAULT_INI_PATH=path.join(CURDIR,'pylama.ini')
24+
CURDIR=os.getcwd()
25+
CONFIG_FILES= [
26+
os.path.join(CURDIR,basename)forbasenamein
27+
('pylama.ini','setup.cfg','tox.ini','pytest.ini')
28+
]
2629

2730

2831
class_Default(object):
@@ -67,7 +70,7 @@ def parse_linters(linters):
6770
PARSER=ArgumentParser(description="Code audit tool for python.")
6871
PARSER.add_argument(
6972
"path",nargs='?',default=_Default(CURDIR),
70-
help="Path on file or directory.")
73+
help="Path on file or directory for code check.")
7174

7275
PARSER.add_argument(
7376
"--verbose","-v",action='store_true',help="Verbose mode.")
@@ -77,11 +80,11 @@ def parse_linters(linters):
7780

7881
PARSER.add_argument(
7982
"--format","-f",default=_Default('pep8'),choices=['pep8','pylint'],
80-
help="Errorformat.")
83+
help="Choose errorsformat (pep8, pylint).")
8184

8285
PARSER.add_argument(
8386
"--select","-s",default=_Default(''),type=split_csp_str,
84-
help="Select errors and warnings. (comma-separated)")
87+
help="Select errors and warnings. (comma-separated list)")
8588

8689

8790
PARSER.add_argument(
@@ -100,7 +103,7 @@ def parse_linters(linters):
100103
type=lambdas: [re(fnmatch.translate(p))forpins.split(',')ifp],
101104
help="Skip files by masks (comma-separated, Ex. */messages.py)")
102105

103-
PARSER.add_argument("--report","-r",help="Filename forreport.")
106+
PARSER.add_argument("--report","-r",help="Sendreport to file [REPORT]")
104107
PARSER.add_argument(
105108
"--hook",action="store_true",help="Install Git (Mercurial) hook.")
106109

@@ -110,7 +113,7 @@ def parse_linters(linters):
110113
"Dont supported with pylint.")
111114

112115
PARSER.add_argument(
113-
"--options","-o",default=_Default(DEFAULT_INI_PATH),
116+
"--options","-o",default="",
114117
help="Select configuration file. By default is '<CURDIR>/pylama.ini'")
115118

116119
PARSER.add_argument(
@@ -151,17 +154,22 @@ def parse_options(args=None, config=True, **overrides): # noqa
151154
setattr(options,k,_Default(v))
152155

153156
# Parse file related options
154-
fork,sincfg.sections.items():
155-
ifk==cfg.default_section:
157+
forname,optsincfg.sections.items():
158+
159+
ifnotname.startswith('pylama'):
160+
continue
161+
162+
ifname==cfg.default_section:
156163
continue
157-
ifkinLINTERS:
158-
options.linter_params[k]=dict(s)
164+
165+
name=name[7:]
166+
167+
ifnameinLINTERS:
168+
options.linter_params[name]=dict(opts)
159169
continue
160-
mask=re(fnmatch.translate(k))
161-
options.file_params[mask]=dict(s)
162-
options.file_params[mask]['lint']=int(
163-
options.file_params[mask].get('lint',1)
164-
)
170+
171+
mask=re(fnmatch.translate(name))
172+
options.file_params[mask]=dict(opts)
165173

166174
# Postprocess options
167175
opts=dict(options.__dict__.items())
@@ -187,15 +195,21 @@ def process_value(name, value):
187195
returnvalue
188196

189197

190-
defget_config(ini_path=DEFAULT_INI_PATH):
198+
defget_config(ini_path=None):
191199
""" Load configuration from INI.
192200
193201
:return Namespace:
194202
195203
"""
196204
config=Namespace()
197-
config.default_section='main'
198-
config.read(ini_path)
205+
config.default_section='pylama'
206+
207+
ifnotini_path:
208+
forpathinCONFIG_FILES:
209+
ifos.path.isfile(path)andos.access(path,os.R_OK):
210+
config.read(path)
211+
else:
212+
config.read(ini_path)
199213

200214
returnconfig
201215

@@ -207,3 +221,5 @@ def setup_logger(options):
207221
LOGGER.removeHandler(STREAM)
208222
LOGGER.addHandler(logging.FileHandler(options.report,mode='w'))
209223
LOGGER.info('Try to read configuration from: '+options.options)
224+
225+
# pylama:ignore=W0212

‎pymode/libs/pylama/errors.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@
3232
# multiple statements on one line
3333
[('pylint','C0321'), ('pep8','E702')],
3434

35+
# bad indentation
36+
[('pylint','W0311'), ('pep8','E111')],
37+
3538
)
3639

3740
DUPLICATES=dict((key,values)forvaluesinDUPLICATESforkeyinvalues)
@@ -57,6 +60,10 @@ def __getattr__(self, name):
5760
def__getitem__(self,name):
5861
returnself._info[name]
5962

63+
defget(self,name,default=None):
64+
""" Implement dictionary `get` method. """
65+
returnself._info.get(name,default)
66+
6067
def__repr__(self):
6168
return"<Error: %s %s>"% (self.number,self.linter)
6269

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp