package init

This commit is contained in:
daidai_is_here 2020-02-26 16:57:16 +08:00
parent 8b05f59dd5
commit f0b175ea77
3 changed files with 138 additions and 0 deletions

BIN
pylint-2.1.1.tar.gz Normal file

Binary file not shown.

View File

@ -0,0 +1,53 @@
diff -Naur pylint-2.1.1/pylint/checkers/utils.py pylint-2.1.1.fixed/pylint/checkers/utils.py
--- pylint-2.1.1/pylint/checkers/utils.py 2018-08-06 14:41:29.000000000 +0200
+++ pylint-2.1.1.fixed/pylint/checkers/utils.py 2018-11-09 18:29:38.845605148 +0100
@@ -1005,7 +1005,7 @@
:returns: True if node_a is derived from node_b. False otherwise.
:rtype: bool
"""
- if not any(isinstance(node, astroid.ClassDef) for node in (node_a, node_b)):
+ if not all(isinstance(node, astroid.ClassDef) for node in (node_a, node_b)):
return False
return node_b.name in {base.name for base in node_a.bases}
diff -Naur pylint-2.1.1/pylint/test/unittest_checkers_utils.py pylint-2.1.1.fixed/pylint/test/unittest_checkers_utils.py
--- pylint-2.1.1/pylint/test/unittest_checkers_utils.py 2018-08-06 14:41:29.000000000 +0200
+++ pylint-2.1.1.fixed/pylint/test/unittest_checkers_utils.py 2018-11-09 18:30:55.653912141 +0100
@@ -102,3 +102,37 @@
assert not utils.node_ignores_exception(nodes[1], ZeroDivisionError)
assert not utils.node_ignores_exception(nodes[2], ZeroDivisionError)
assert not utils.node_ignores_exception(nodes[3], ZeroDivisionError)
+
+
+def test_is_sublcass_of_node_b_derived_from_node_a():
+ nodes = astroid.extract_node("""
+ class Superclass: #@
+ pass
+ class Subclass(Superclass): #@
+ pass
+ """)
+ assert utils.is_subclass_of(nodes[1], nodes[0])
+
+
+def test_is_sublcass_of_node_b_not_derived_from_node_a():
+ nodes = astroid.extract_node("""
+ class OneClass: #@
+ pass
+ class AnotherClass: #@
+ pass
+ """)
+ assert not utils.is_subclass_of(nodes[1], nodes[0])
+
+
+def test_is_sublcass_of_one_param_is_not_classdef():
+ node = astroid.extract_node("""
+ class OneClass: #@
+ pass
+ """)
+ assert not utils.is_subclass_of(None, node)
+ assert not utils.is_subclass_of(node, None)
+
+
+def test_is_sublcass_of_both_params_are_not_classdef():
+ assert not utils.is_subclass_of(None, None)
+

85
pylint.spec Normal file
View File

@ -0,0 +1,85 @@
Name: pylint
Version: 2.1.1
Release: 3
Summary: Python static code analysis tool looking for programming errors
License: GPLv2+
URL: http://pylint.pycqa.org
Source0: https://github.com/PyCQA/%{name}/archive/%{name}-%{version}.tar.gz
Patch0001: pylint-Fix_is_subclass_of_when_one_param_is_not_ClassDef.patch
BuildArch: noarch
BuildRequires: python3-devel python3-setuptools python3-astroid >= 2.0.2 python3-isort
BuildRequires: python3-mccabe python3-pytest python3-pytest-runner
Requires: python3-%{name} = %{version}-%{release}
%description
Pylint is a Python static code analysis tool which looks for programming errors,
helps enforcing a coding standard, sniffs for code smells and offers simple refactoring suggestions.
It's highly configurable, having special pragmas to control its errors and warnings from within
your code, as well as from an extensive configuration file. It is also possible to write your own
plugins for adding your own checks or for extending pylint in one way or another.
%package -n python3-%{name}
Summary: Python static code analysis tool looking for programming errors
Requires: python3-astroid >= 2.0.2 python3-setuptools python3-mccabe python3-isort
Obsoletes: python3-pylint-gui < 1.7
%python_provide python3-%{name}
%description -n python3-%{name}
Pylint is a Python static code analysis tool which looks for programming errors,
helps enforcing a coding standard, sniffs for code smells and offers simple refactoring suggestions.
It's highly configurable, having special pragmas to control its errors and warnings from within
your code, as well as from an extensive configuration file. It is also possible to write your own
plugins for adding your own checks or for extending pylint in one way or another.
%package help
Summary: Help documentation of pylint package
%description help
Help documentation of pylint package.
%prep
%autosetup -n pylint-%{version} -p1
sed -i 's/\r//g' README.rst
%build
%py3_build
%install
%py3_install
rm -rf %{buildroot}%{python3_sitelib}/pylint/test
install -dm 755 %{buildroot}%{_mandir}/man1
install -pm 644 man/*.1 %{buildroot}%{_mandir}/man1/
for NAME in epylint pylint pyreverse symilar; do
mv %{buildroot}%{_bindir}/{$NAME,${NAME}-%{python3_version}}
ln -s ${NAME}-%{python3_version} %{buildroot}%{_bindir}/${NAME}-3
mv %{buildroot}%{_mandir}/man1/{${NAME}.1,${NAME}-%{python3_version}.1}
ln -s ${NAME}-%{python3_version}.1 %{buildroot}%{_mandir}/man1/${NAME}-3.1
ln -s ${NAME}-%{python3_version} %{buildroot}%{_bindir}/${NAME}
ln -s ${NAME}-%{python3_version}.1 %{buildroot}%{_mandir}/man1/${NAME}.1
done
%check
export PYTHONPATH=%{buildroot}%{python3_sitelib}
%{__python3} bin/pylint -rn --rcfile=pylintrc --load-plugins=pylint.extensions.docparams, pylint.extensions.mccabe pylint || :
%{__python3} -m pytest -v -k "not (test_functional or test_good_comprehension_checks)"
%files
%doc README.rst ChangeLog examples elisp COPYING
%{_bindir}/{epylint,pylint,pyreverse,symilar}
%files -n python3-%{name}
%doc COPYING
%{python3_sitelib}/pylint*
%{_bindir}/{*-3,*-%{python3_version}}
%files help
%{_mandir}/man1/*
%changelog
* Mon Feb 17 2020 daiqianwen <daiqianwen@huawei.com> - 2.1.1-3
- package init