Skip to content

Unpin Pylint #94

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ disable =
too-few-public-methods,
too-many-arguments,
too-many-instance-attributes,
import-error
import-error,
consider-using-f-string,

[REPORTS]

Expand Down
2 changes: 1 addition & 1 deletion pylsp/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def _configure_logger(verbose=0, log_config=None, log_file=None):
root_logger = logging.root

if log_config:
with open(log_config, 'r') as f:
with open(log_config, 'r', encoding='utf-8') as f:
logging.config.dictConfig(json.load(f))
else:
formatter = logging.Formatter(LOG_FORMAT)
Expand Down
4 changes: 2 additions & 2 deletions pylsp/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ def format_docstring(contents):
Until we can find a fast enough way of discovering and parsing each format,
we can do a little better by at least preserving indentation.
"""
contents = contents.replace('\t', u'\u00A0' * 4)
contents = contents.replace(' ', u'\u00A0' * 2)
contents = contents.replace('\t', '\u00A0' * 4)
contents = contents.replace(' ', '\u00A0' * 2)
return contents


Expand Down
2 changes: 1 addition & 1 deletion pylsp/plugins/flake8_lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def run_flake8(flake8_executable, args, document):
try:
cmd = [flake8_executable]
cmd.extend(args)
p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE) # pylint: disable=consider-using-with
p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE)
except IOError:
log.debug("Can't execute %s. Trying with 'python -m flake8'", flake8_executable)
cmd = ['python', '-m', 'flake8']
Expand Down
2 changes: 1 addition & 1 deletion pylsp/plugins/pylint_lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def _run_pylint_stdio(pylint_executable, document, flags):
cmd = [pylint_executable]
cmd.extend(flags)
cmd.extend(['--from-stdin', document.path])
p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE) # pylint: disable=consider-using-with
p = Popen(cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE)
except IOError:
log.debug("Can't execute %s. Trying with 'python -m pylint'", pylint_executable)
cmd = ['python', '-m', 'pylint']
Expand Down
2 changes: 1 addition & 1 deletion pylsp/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def root_uri(self):
return self._root_uri

def is_local(self):
return (self._root_uri_scheme == '' or self._root_uri_scheme == 'file') and os.path.exists(self._root_path)
return (self._root_uri_scheme in ['', 'file']) and os.path.exists(self._root_path)

def get_document(self, doc_uri):
"""Return a managed document if-present, else create one pointing at disk.
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def get_version(module='pylsp'):
'pycodestyle>=2.7.0',
'pydocstyle>=2.0.0',
'pyflakes>=2.3.0,<2.4.0',
'pylint>=2.5.0,<2.10.0',
'pylint>=2.5.0',
'rope>=0.10.5',
'yapf',
],
Expand All @@ -62,10 +62,10 @@ def get_version(module='pylsp'):
'pycodestyle': ['pycodestyle>=2.7.0'],
'pydocstyle': ['pydocstyle>=2.0.0'],
'pyflakes': ['pyflakes>=2.3.0,<2.4.0'],
'pylint': ['pylint>=2.5.0,<2.10.0'],
'pylint': ['pylint>=2.5.0'],
'rope': ['rope>0.10.5'],
'yapf': ['yapf'],
'test': ['pylint>=2.5.0,<2.10.0', 'pytest', 'pytest-cov', 'coverage',
'test': ['pylint>=2.5.0', 'pytest', 'pytest-cov', 'coverage',
'numpy', 'pandas', 'matplotlib', 'pyqt5', 'flaky'],
},
entry_points={
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def temp_workspace_factory(workspace): # pylint: disable=redefined-outer-name
def fn(files):
def create_file(name, content):
fn = os.path.join(workspace.root_path, name)
with open(fn, 'w') as f:
with open(fn, 'w', encoding='utf-8') as f:
f.write(content)
workspace.put_document(uris.from_fs_path(fn), content)

Expand Down
2 changes: 1 addition & 1 deletion test/plugins/test_flake8_lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def get_flake8_cfg_settings(workspace, config_str):
This function creates a ``setup.cfg``; you'll have to delete it yourself.
"""

with open(os.path.join(workspace.root_path, "setup.cfg"), "w+") as f:
with open(os.path.join(workspace.root_path, "setup.cfg"), "w+", encoding='utf-8') as f:
f.write(config_str)

workspace.update_config({"pylsp": {"configurationSources": ["flake8"]}})
Expand Down
2 changes: 1 addition & 1 deletion test/plugins/test_pycodestyle_lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def test_pycodestyle_config(workspace):

for conf_file, (content, working) in list(content.items()):
# Now we'll add config file to ignore it
with open(os.path.join(workspace.root_path, conf_file), 'w+') as f:
with open(os.path.join(workspace.root_path, conf_file), 'w+', encoding='utf-8') as f:
f.write(content)
workspace._config.settings.cache_clear()

Expand Down
2 changes: 1 addition & 1 deletion test/plugins/test_pyflakes_lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def hello():
DOC_UNDEFINED_NAME_ERR = "a = b"


DOC_ENCODING = u"""# encoding=utf-8
DOC_ENCODING = """# encoding=utf-8
import sys
"""

Expand Down
2 changes: 1 addition & 1 deletion test/plugins/test_pylint_lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def temp_document(doc_text, workspace):


def write_temp_doc(document, contents):
with open(document.path, 'w') as temp_file:
with open(document.path, 'w', encoding='utf-8') as temp_file:
temp_file.write(contents)


Expand Down
22 changes: 11 additions & 11 deletions test/test_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def test_document_lines(doc):


def test_document_source_unicode(workspace):
document_mem = Document(DOC_URI, workspace, u'my source')
document_mem = Document(DOC_URI, workspace, 'my source')
document_disk = Document(DOC_URI, workspace)
assert isinstance(document_mem.source, type(document_disk.source))

Expand Down Expand Up @@ -44,27 +44,27 @@ def test_word_at_position(doc):


def test_document_empty_edit(workspace):
doc = Document('file:///uri', workspace, u'')
doc = Document('file:///uri', workspace, '')
doc.apply_change({
'range': {
'start': {'line': 0, 'character': 0},
'end': {'line': 0, 'character': 0}
},
'text': u'f'
'text': 'f'
})
assert doc.source == u'f'
assert doc.source == 'f'


def test_document_line_edit(workspace):
doc = Document('file:///uri', workspace, u'itshelloworld')
doc = Document('file:///uri', workspace, 'itshelloworld')
doc.apply_change({
'text': u'goodbye',
'text': 'goodbye',
'range': {
'start': {'line': 0, 'character': 3},
'end': {'line': 0, 'character': 8}
}
})
assert doc.source == u'itsgoodbyeworld'
assert doc.source == 'itsgoodbyeworld'


def test_document_multiline_edit(workspace):
Expand All @@ -73,8 +73,8 @@ def test_document_multiline_edit(workspace):
" print a\n",
" print b\n"
]
doc = Document('file:///uri', workspace, u''.join(old))
doc.apply_change({'text': u'print a, b', 'range': {
doc = Document('file:///uri', workspace, ''.join(old))
doc.apply_change({'text': 'print a, b', 'range': {
'start': {'line': 1, 'character': 4},
'end': {'line': 2, 'character': 11}
}})
Expand All @@ -89,8 +89,8 @@ def test_document_end_of_file_edit(workspace):
"print 'a'\n",
"print 'b'\n"
]
doc = Document('file:///uri', workspace, u''.join(old))
doc.apply_change({'text': u'o', 'range': {
doc = Document('file:///uri', workspace, ''.join(old))
doc.apply_change({'text': 'o', 'range': {
'start': {'line': 2, 'character': 0},
'end': {'line': 2, 'character': 0}
}})
Expand Down
2 changes: 1 addition & 1 deletion test/test_workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def test_non_root_project(pylsp, metafiles):
os.mkdir(project_root)

for metafile in metafiles:
with open(os.path.join(project_root, metafile), 'w+') as f:
with open(os.path.join(project_root, metafile), 'w+', encoding='utf-8') as f:
f.write('# ' + metafile)

test_uri = uris.from_fs_path(os.path.join(project_root, 'hello/test.py'))
Expand Down