Skip to content

Commit b66f119

Browse files
Merge pull request #32 from reactive-firewall/master
Prep for Security Feature branch
2 parents 3158d43 + 61b9815 commit b66f119

File tree

16 files changed

+252
-149
lines changed

16 files changed

+252
-149
lines changed

.appveyor.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
version: 1.0.{build}
1+
version: 1.1.{build}
22
branches:
33
only:
44
- master
55
- stable
66
skip_tags: true
77
max_jobs: 1
88
image:
9-
- Visual Studio 2017
10-
- Visual Studio 2015
9+
- Visual Studio 2022
10+
- Visual Studio 2019
1111
clone_depth: 50
1212
init:
1313
- cmd: >-

.circleci/config.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ version: 2
22
jobs:
33
build:
44
docker:
5-
- image: circleci/python:3.6.1
65
- image: circleci/python:3.7
76
- image: circleci/python:3.8
7+
- image: circleci/python:3.9
88
environment:
99
CI: cicleci
1010
DEBIAN_FRONTEND: noninteractive
@@ -41,9 +41,9 @@ jobs:
4141

4242
test:
4343
docker:
44-
- image: circleci/python:3.6.1
4544
- image: circleci/python:3.7
4645
- image: circleci/python:3.8
46+
- image: circleci/python:3.9
4747
parallelism: 2
4848
environment:
4949
CI: cicleci
@@ -88,9 +88,9 @@ jobs:
8888

8989
pytest:
9090
docker:
91-
- image: circleci/python:3.6.1
9291
- image: circleci/python:3.7
9392
- image: circleci/python:3.8
93+
- image: circleci/python:3.9
9494
parallelism: 2
9595
environment:
9696
CI: cicleci
@@ -147,7 +147,7 @@ jobs:
147147

148148
lint:
149149
docker:
150-
- image: circleci/python:3.6.1
150+
- image: circleci/python:3.8
151151
environment:
152152
CI: cicleci
153153
DEBIAN_FRONTEND: noninteractive

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ coverage.xml
4747
codecov_env
4848
*,cover
4949
.hypothesis/
50+
test-reports/*
5051

5152
# Translations
5253
*.mo

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
License - MIT
22

3-
Copyright (c) 2017-2020 Mr. Walls
3+
Copyright (c) 2017-2022 Mr. Walls
44

55
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
66
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ PHONY: must_be_root cleanup
5959

6060
build:
6161
$(QUIET)$(ECHO) "No need to build. Try make -f Makefile install"
62+
$(QUIET)$(MAKE) -s -C ./docs/ -f Makefile text 2>/dev/null || true
6263

6364
init:
6465
$(QUIET)$(ECHO) "$@: Done."
@@ -84,7 +85,7 @@ purge: clean uninstall
8485
test: cleanup
8586
$(QUIET)coverage run -p --source=pythonrepo -m unittest discover --verbose -s ./tests -t ./ || python3 -m unittest discover --verbose -s ./tests -t ./ || python -m unittest discover --verbose -s ./tests -t ./ || DO_FAIL=exit 2 ;
8687
$(QUIET)coverage combine 2>/dev/null || true
87-
$(QUIET)coverage report --include=pythonrepo* 2>/dev/null || true
88+
$(QUIET)coverage report -m --include=pythonrepo* 2>/dev/null || true
8889
$(QUIET)$(DO_FAIL);
8990
$(QUIET)$(ECHO) "$@: Done."
9091

docs/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
templates_path = ['_templates']
3333

3434
# The suffix of source filenames.
35-
source_suffix = '.rst'
35+
source_suffix = '.md'
3636

3737
# The encoding of source files.
3838
# source_encoding = 'utf-8-sig'
@@ -51,7 +51,7 @@
5151
# The short X.Y version.
5252
version = 'v1.1'
5353
# The full version, including alpha/beta/rc tags.
54-
release = 'v1.1.1'
54+
release = 'v1.1.4'
5555

5656
# The language for content autogenerated by Sphinx. Refer to documentation
5757
# for a list of supported languages.
File renamed without changes.

python-repo.xcworkspace/contents.xcworkspacedata

Lines changed: 2 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pythonrepo/__init__.py

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Python Repo Template
44
# ..................................
5-
# Copyright (c) 2017-2019, Kendrick Walls
5+
# Copyright (c) 2017-2022, Kendrick Walls
66
# ..................................
77
# Licensed under MIT (the "License");
88
# you may not use this file except in compliance with the License.
@@ -16,37 +16,27 @@
1616
# See the License for the specific language governing permissions and
1717
# limitations under the License.
1818

19+
"""Python Repo."""
1920

20-
__version__ = """1.1.1"""
21-
"""This is version 1.1.1 of pythonrepo Template"""
21+
__module__ = """pythonrepo"""
22+
"""This is pythonrepo module Template."""
23+
24+
25+
__version__ = """1.1.4"""
26+
"""This is version 1.1.4 of pythonrepo Template"""
2227

2328

2429
try:
2530
import sys
2631
import os
27-
if 'pythonrepo' in __file__:
32+
if str(__module__) in __file__:
2833
__parentPath = os.path.join(
2934
os.path.dirname(__file__), '..'
3035
)
3136
sys.path.insert(0, os.path.abspath(__parentPath))
32-
except Exception as ImportErr:
33-
print(str(type(ImportErr)))
34-
print(str(ImportErr))
35-
print(str((ImportErr.args)))
36-
ImportErr = None
37-
del ImportErr
38-
raise ImportError(str("pythonrepo Failed to Import"))
39-
40-
41-
try:
42-
from . import pythonrepo as pythonrepo
43-
except Exception as importErr:
44-
del importErr
45-
import pythonrepo.pythonrepo as pythonrepo
46-
47-
48-
if __name__ in '__main__':
49-
if pythonrepo.__name__ is None:
50-
raise ImportError(str("Failed to open pythonrepo"))
51-
pythonrepo.main(sys.argv[1:])
52-
exit(0)
37+
except Exception as err:
38+
baton = ImportError(err, str("[CWE-758] Module failed completely."))
39+
baton.module = __module__
40+
baton.path = __file__
41+
baton.__cause__ = err
42+
raise baton

pythonrepo/pythonrepo.py

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
# Python Repo Template
55
# ..................................
6-
# Copyright (c) 2017-2019, Kendrick Walls
6+
# Copyright (c) 2017-2022, Kendrick Walls
77
# ..................................
88
# Licensed under MIT (the "License");
99
# you may not use this file except in compliance with the License.
@@ -18,23 +18,28 @@
1818
# limitations under the License.
1919

2020

21+
__module__ = """pythonrepo.pythonrepo"""
22+
"""This is pythonrepo component Template."""
23+
24+
2125
try:
22-
import sys
26+
from . import sys
2327
import argparse
2428
except Exception as err:
25-
# Show Error Info
26-
print(str(type(err)))
27-
print(str(err))
28-
print(str(err.args))
29-
print(str(""))
30-
# Clean up Error
31-
err = None
32-
del(err)
29+
# Collect Error Info
30+
baton = ImportError(err, str("[CWE-758] Module failed completely."))
31+
baton.module = __module__
32+
baton.path = __file__
33+
baton.__cause__ = err
3334
# Throw more relevant Error
34-
raise ImportError(str("Error Importing Python"))
35+
raise baton
36+
37+
38+
from . import __version__
39+
"""The version of this program."""
3540

3641

37-
__prog__ = str("""pythonrepo""")
42+
__prog__ = str(__module__)
3843
"""The name of this program is PythonRepo"""
3944

4045

@@ -50,10 +55,6 @@
5055
"""Contains the short epilog of the program CLI help text."""
5156

5257

53-
__version__ = """1.1.1"""
54-
"""The version of this program."""
55-
56-
5758
# Add your functions here
5859

5960

@@ -96,16 +97,8 @@ def parseArgs(arguments=None):
9697
return parser.parse_known_args(arguments)
9798

9899

99-
def __checkToolArgs(args=None):
100-
"""Handles None case for arguments as a helper function."""
101-
if args is None:
102-
args = [None]
103-
return args
104-
105-
106-
def useTool(tool, arguments=None):
100+
def useTool(tool, *arguments):
107101
"""Handler for launching the functions."""
108-
arguments = __checkToolArgs(arguments)
109102
if (tool is not None) and (tool in TASK_OPTIONS.keys()):
110103
try:
111104
# print(str("launching: " + tool))
@@ -118,11 +111,11 @@ def useTool(tool, arguments=None):
118111
return None
119112

120113

121-
def main(argv=None):
114+
def main(*argv):
122115
"""The Main Event."""
123116
try:
124117
try:
125-
args, extra = parseArgs(argv)
118+
args, extra = parseArgs(*argv)
126119
service_cmd = args.some_task
127120
useTool(service_cmd, extra)
128121
except Exception:
@@ -139,6 +132,7 @@ def main(argv=None):
139132
exit(0)
140133

141134

142-
if __name__ == '__main__':
135+
if __name__ in '__main__':
136+
# deepsource overlooks the readability of "if main" type code here. (See PTC-W0048)
143137
if (sys.argv is not None) and (len(sys.argv) >= 1):
144138
main(sys.argv[1:])

0 commit comments

Comments
 (0)