Skip to content

Commit c1d65c1

Browse files
committed
Linting.
1 parent 2d12b51 commit c1d65c1

File tree

8 files changed

+72
-66
lines changed

8 files changed

+72
-66
lines changed

__pkginfo__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
]
2424

2525
__copyright__ = """
26-
2020 Dominic Davis-Foster <dominic@davis-foster.co.uk>
26+
2020-2021 Dominic Davis-Foster <dominic@davis-foster.co.uk>
2727
"""
2828

2929
__version__ = "0.2.0"

doc-source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
project = "notebook2script"
2727
slug = re.sub(r'\W+', '-', project.lower())
2828
release = version = __version__
29-
copyright = "2020 Dominic Davis-Foster" # pylint: disable=redefined-builtin
29+
copyright = "2020-2021 Dominic Davis-Foster" # pylint: disable=redefined-builtin
3030
language = "en"
3131
package_root = "notebook2script"
3232

notebook2script/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Convert Jupyter Notebooks to Python Scripts.
66
"""
77
#
8-
# Copyright © 2020 Dominic Davis-Foster <dominic@davis-foster.co.uk>
8+
# Copyright © 2020-2021 Dominic Davis-Foster <dominic@davis-foster.co.uk>
99
#
1010
# This program is free software; you can redistribute it and/or modify
1111
# it under the terms of the GNU General Public License version 2
@@ -40,7 +40,7 @@
4040
from notebook2script.pointless import Pointless
4141

4242
__author__: str = "Dominic Davis-Foster"
43-
__copyright__: str = "2020 Dominic Davis-Foster"
43+
__copyright__: str = "2020-2021 Dominic Davis-Foster"
4444
__license__: str = "GPLv2"
4545
__version__: str = "0.2.0"
4646
__email__: str = "dominic@davis-foster.co.uk"

notebook2script/__main__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
#!/usr/bin/env python3
22
#
33
# __main__.py
4+
"""
5+
CLI entry point.
6+
"""
47
#
58
# Copyright © 2020 Dominic Davis-Foster <dominic@davis-foster.co.uk>
69
#

notebook2script/pointless.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1+
#!/usr/bin/env python3
2+
#
3+
# pointless.py
14
"""
25
Ensure pointless statements in scripts are converted
36
into print function calls
4-
"""
5-
7+
""" # noqa: D400
8+
#
69
# Copyright (C) 2020 Dominic Davis-Foster
7-
10+
#
811
# Based on pylint
912
# Copyright (c) 2006-2016 LOGILAB S.A. (Paris, FRANCE) <contact@logilab.fr>
1013
# Copyright (c) 2008 Fabrice Douchant <Fabrice.Douchant@logilab.fr>
@@ -19,7 +22,6 @@
1922
# Copyright (c) 2012 Kevin Jing Qiu <kevin.jing.qiu@gmail.com>
2023
# Copyright (c) 2012-2014 Google, Inc.
2124
# Copyright (c) 2013 buck@yelp.com <buck@yelp.com>
22-
# Copyright (c) 2013-2014 Google, Inc.
2325
# Copyright (c) 2013-2020 Claudiu Popa <pcmanticore@gmail.com>
2426
# Copyright (c) 2014 Alexandru Coman <fcoman@bitdefender.com>
2527
# Copyright (c) 2014 Arun Persaud <arun@nubati.net>
@@ -154,6 +156,9 @@
154156

155157

156158
class Pointless(PyLinter):
159+
"""
160+
Checker for pointless statements.
161+
"""
157162

158163
def __init__(self):
159164
super().__init__()
@@ -162,15 +167,15 @@ def __init__(self):
162167
self.initialize()
163168
self.statements = []
164169

165-
def load_default_plugins(self):
170+
def load_default_plugins(self): # noqa: D102
166171
pointless_checker.initialize(self)
167172
reporters.initialize(self)
168173
# Make sure to load the default reporter, because
169174
# the option has been set before the plugins had been loaded.
170175
if not self.reporter:
171176
self._load_reporter()
172177

173-
def process_file(self, filename):
178+
def process_file(self, filename): # noqa: D102
174179
self.statements = []
175180

176181
with fix_import_path([filename]):

notebook2script/pointless_checker/__init__.py

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,28 @@
1-
################################################################################
2-
# #
3-
# Copyright (C) 2020 Dominic Davis-Foster #
4-
# Based on pylint #
5-
# See notebook2script/pointless.py for full copyright information #
6-
# #
7-
# This program is free software; you can redistribute it and/or modify #
8-
# it under the terms of the GNU General Public License version 2 as #
9-
# published by the Free Software Foundation. #
10-
# #
11-
# This program is distributed in the hope that it will be useful, #
12-
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
13-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
14-
# GNU General Public License for more details. #
15-
# #
16-
# You should have received a copy of the GNU General Public License #
17-
# along with this program; if not, write to the Free Software #
18-
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #
19-
# #
20-
################################################################################
1+
#!/usr/bin/env python3
2+
#
3+
# __init__.py
4+
"""
5+
Checker for pointless statements.
6+
"""
7+
#
8+
# Copyright © 2020-2021 Dominic Davis-Foster <dominic@davis-foster.co.uk>
9+
# Based on pylint
10+
# See notebook2script/pointless.py for full copyright information
11+
#
12+
# This program is free software; you can redistribute it and/or modify
13+
# it under the terms of the GNU General Public License version 2
14+
# as published by the Free Software Foundation.
15+
#
16+
# This program is distributed in the hope that it will be useful,
17+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
18+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19+
# GNU General Public License for more details.
20+
#
21+
# You should have received a copy of the GNU General Public License
22+
# along with this program; if not, write to the Free Software
23+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
24+
# MA 02110-1301, USA.
25+
#
2126

2227
# 3rd party
2328
from pylint.checkers.base_checker import BaseChecker, BaseTokenChecker # type: ignore
@@ -26,7 +31,7 @@
2631

2732
def initialize(linter):
2833
"""
29-
Initialize linter with checkers in this package
34+
Initialize linter with checkers in this package.
3035
"""
3136

3237
register_plugins(linter, __path__[0]) # type: ignore

notebook2script/pointless_checker/base.py

Lines changed: 27 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,28 @@
1-
################################################################################
2-
# #
3-
# Copyright (C) 2020 Dominic Davis-Foster #
4-
# Based on pylint #
5-
# See notebook2script/pointless.py for full copyright information #
6-
# #
7-
# This program is free software; you can redistribute it and/or modify #
8-
# it under the terms of the GNU General Public License version 2 as #
9-
# published by the Free Software Foundation. #
10-
# #
11-
# This program is distributed in the hope that it will be useful, #
12-
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
13-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
14-
# GNU General Public License for more details. #
15-
# #
16-
# You should have received a copy of the GNU General Public License #
17-
# along with this program; if not, write to the Free Software #
18-
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #
19-
# #
20-
################################################################################
1+
#!/usr/bin/env python3
2+
#
3+
# base.py
4+
"""
5+
Checker for pointless statements.
6+
"""
7+
#
8+
# Copyright © 2020-2021 Dominic Davis-Foster <dominic@davis-foster.co.uk>
9+
# Based on pylint
10+
# See notebook2script/pointless.py for full copyright information
11+
#
12+
# This program is free software; you can redistribute it and/or modify
13+
# it under the terms of the GNU General Public License version 2
14+
# as published by the Free Software Foundation.
15+
#
16+
# This program is distributed in the hope that it will be useful,
17+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
18+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19+
# GNU General Public License for more details.
20+
#
21+
# You should have received a copy of the GNU General Public License
22+
# along with this program; if not, write to the Free Software
23+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
24+
# MA 02110-1301, USA.
25+
#
2126

2227
# stdlib
2328
from typing import Dict, Tuple
@@ -33,16 +38,7 @@
3338
__all__ = ["BasicChecker", "register"]
3439

3540

36-
class BasicChecker(BaseChecker):
37-
"""checks for :
38-
* doc strings
39-
* number of arguments, local variables, branches, returns and statements in
40-
functions, methods
41-
* required module attributes
42-
* dangerous default values as arguments
43-
* redefinition of function / method / class
44-
* uses of the global statement
45-
"""
41+
class BasicChecker(BaseChecker): # noqa: D101
4642

4743
__implements__ = interfaces.IAstroidChecker
4844

@@ -118,7 +114,7 @@ def visit_expr(self, node) -> None:
118114

119115
def register(linter) -> None:
120116
"""
121-
required method to auto register this checker
117+
Required function to auto register this checker.
122118
"""
123119

124120
linter.register_checker(BasicChecker(linter))

repo_helper.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
modname: notebook2script
2-
copyright_years: "2020"
2+
copyright_years: "2020-2021"
33
author: "Dominic Davis-Foster"
44
email: "dominic@davis-foster.co.uk"
55
version: "0.2.0"
@@ -12,11 +12,9 @@ enable_conda: False
1212

1313
conda_channels:
1414
- conda-forge
15-
- domdfcoding
1615

1716
python_deploy_version: 3.6
1817

19-
2018
# Versions to run tests for
2119
python_versions:
2220
- '3.6'
@@ -27,7 +25,6 @@ python_versions:
2725
additional_ignore:
2826
- "tests/output/"
2927

30-
3128
console_scripts:
3229
- "notebook2script = notebook2script.__main__:main"
3330

0 commit comments

Comments
 (0)