Skip to content

Prep for Security Feature branch #32

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 13 commits into from
Sep 25, 2022
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
6 changes: 3 additions & 3 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
version: 1.0.{build}
version: 1.1.{build}
branches:
only:
- master
- stable
skip_tags: true
max_jobs: 1
image:
- Visual Studio 2017
- Visual Studio 2015
- Visual Studio 2022
- Visual Studio 2019
clone_depth: 50
init:
- cmd: >-
Expand Down
8 changes: 4 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ version: 2
jobs:
build:
docker:
- image: circleci/python:3.6.1
- image: circleci/python:3.7
- image: circleci/python:3.8
- image: circleci/python:3.9
environment:
CI: cicleci
DEBIAN_FRONTEND: noninteractive
Expand Down Expand Up @@ -41,9 +41,9 @@ jobs:

test:
docker:
- image: circleci/python:3.6.1
- image: circleci/python:3.7
- image: circleci/python:3.8
- image: circleci/python:3.9
parallelism: 2
environment:
CI: cicleci
Expand Down Expand Up @@ -88,9 +88,9 @@ jobs:

pytest:
docker:
- image: circleci/python:3.6.1
- image: circleci/python:3.7
- image: circleci/python:3.8
- image: circleci/python:3.9
parallelism: 2
environment:
CI: cicleci
Expand Down Expand Up @@ -147,7 +147,7 @@ jobs:

lint:
docker:
- image: circleci/python:3.6.1
- image: circleci/python:3.8
environment:
CI: cicleci
DEBIAN_FRONTEND: noninteractive
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ coverage.xml
codecov_env
*,cover
.hypothesis/
test-reports/*

# Translations
*.mo
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
License - MIT

Copyright (c) 2017-2020 Mr. Walls
Copyright (c) 2017-2022 Mr. Walls

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ PHONY: must_be_root cleanup

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

init:
$(QUIET)$(ECHO) "$@: Done."
Expand All @@ -84,7 +85,7 @@ purge: clean uninstall
test: cleanup
$(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 ;
$(QUIET)coverage combine 2>/dev/null || true
$(QUIET)coverage report --include=pythonrepo* 2>/dev/null || true
$(QUIET)coverage report -m --include=pythonrepo* 2>/dev/null || true
$(QUIET)$(DO_FAIL);
$(QUIET)$(ECHO) "$@: Done."

Expand Down
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
templates_path = ['_templates']

# The suffix of source filenames.
source_suffix = '.rst'
source_suffix = '.md'

# The encoding of source files.
# source_encoding = 'utf-8-sig'
Expand All @@ -51,7 +51,7 @@
# The short X.Y version.
version = 'v1.1'
# The full version, including alpha/beta/rc tags.
release = 'v1.1.1'
release = 'v1.1.4'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
File renamed without changes.
6 changes: 2 additions & 4 deletions python-repo.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 15 additions & 25 deletions pythonrepo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

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

"""Python Repo."""

__version__ = """1.1.1"""
"""This is version 1.1.1 of pythonrepo Template"""
__module__ = """pythonrepo"""
"""This is pythonrepo module Template."""


__version__ = """1.1.4"""
"""This is version 1.1.4 of pythonrepo Template"""


try:
import sys
import os
if 'pythonrepo' in __file__:
if str(__module__) in __file__:
__parentPath = os.path.join(
os.path.dirname(__file__), '..'
)
sys.path.insert(0, os.path.abspath(__parentPath))
except Exception as ImportErr:
print(str(type(ImportErr)))
print(str(ImportErr))
print(str((ImportErr.args)))
ImportErr = None
del ImportErr
raise ImportError(str("pythonrepo Failed to Import"))


try:
from . import pythonrepo as pythonrepo
except Exception as importErr:
del importErr
import pythonrepo.pythonrepo as pythonrepo


if __name__ in '__main__':
if pythonrepo.__name__ is None:
raise ImportError(str("Failed to open pythonrepo"))
pythonrepo.main(sys.argv[1:])
exit(0)
except Exception as err:
baton = ImportError(err, str("[CWE-758] Module failed completely."))
baton.module = __module__
baton.path = __file__
baton.__cause__ = err
raise baton
50 changes: 22 additions & 28 deletions pythonrepo/pythonrepo.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# Python Repo Template
# ..................................
# Copyright (c) 2017-2019, Kendrick Walls
# Copyright (c) 2017-2022, Kendrick Walls
# ..................................
# Licensed under MIT (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -18,23 +18,28 @@
# limitations under the License.


__module__ = """pythonrepo.pythonrepo"""
"""This is pythonrepo component Template."""


try:
import sys
from . import sys
import argparse
except Exception as err:
# Show Error Info
print(str(type(err)))
print(str(err))
print(str(err.args))
print(str(""))
# Clean up Error
err = None
del(err)
# Collect Error Info
baton = ImportError(err, str("[CWE-758] Module failed completely."))
baton.module = __module__
baton.path = __file__
baton.__cause__ = err
# Throw more relevant Error
raise ImportError(str("Error Importing Python"))
raise baton


from . import __version__
"""The version of this program."""


__prog__ = str("""pythonrepo""")
__prog__ = str(__module__)
"""The name of this program is PythonRepo"""


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


__version__ = """1.1.1"""
"""The version of this program."""


# Add your functions here


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


def __checkToolArgs(args=None):
"""Handles None case for arguments as a helper function."""
if args is None:
args = [None]
return args


def useTool(tool, arguments=None):
def useTool(tool, *arguments):
"""Handler for launching the functions."""
arguments = __checkToolArgs(arguments)
if (tool is not None) and (tool in TASK_OPTIONS.keys()):
try:
# print(str("launching: " + tool))
Expand All @@ -118,11 +111,11 @@ def useTool(tool, arguments=None):
return None


def main(argv=None):
def main(*argv):
"""The Main Event."""
try:
try:
args, extra = parseArgs(argv)
args, extra = parseArgs(*argv)
service_cmd = args.some_task
useTool(service_cmd, extra)
except Exception:
Expand All @@ -139,6 +132,7 @@ def main(argv=None):
exit(0)


if __name__ == '__main__':
if __name__ in '__main__':
# deepsource overlooks the readability of "if main" type code here. (See PTC-W0048)
if (sys.argv is not None) and (len(sys.argv) >= 1):
main(sys.argv[1:])
4 changes: 3 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = pythonrepo
version = 1.1.3
version = 1.1.4
author = Mr. Walls
author-email = [email protected]
summary = python-repo template
Expand All @@ -13,6 +13,8 @@ classifiers =
Operating System :: POSIX :: Linux
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.5
Expand Down
24 changes: 15 additions & 9 deletions tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Python Repo Template
# ..................................
# Copyright (c) 2017-2019, Kendrick Walls
# Copyright (c) 2017-2022, Kendrick Walls
# ..................................
# Licensed under MIT (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -16,6 +16,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.

"""Python Repo Testing Module."""

__module__ = """tests"""
"""This is pythonrepo testing module Template."""


try:
try:
import sys
Expand All @@ -30,18 +36,18 @@
ImportErr = None
del ImportErr
raise ImportError(str("Test module failed completely."))
from tests import context as context
if context.__name__ is None:
raise ImportError(str("Test module failed to import even the context framework."))
from tests import profiling as profiling
if profiling.__name__ is None:
raise ImportError(str("Test module failed to import even the profiling framework."))
from tests import test_basic
if test_basic.__name__ is None:
raise ImportError(str("Test module failed to import even the basic tests."))
except Exception as badErr:
print(str(''))
print(str(type(badErr)))
print(str(badErr))
print(str((badErr.args)))
print(str(''))
badErr = None
del badErr
exit(0)
baton = ImportError(badErr, str("[CWE-758] Test module failed completely."))
baton.module = __module__
baton.path = __file__
baton.__cause__ = badErr
raise baton
30 changes: 17 additions & 13 deletions tests/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Python Repo Template
# ..................................
# Copyright (c) 2017-2019, Kendrick Walls
# Copyright (c) 2017-2022, Kendrick Walls
# ..................................
# Licensed under MIT (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -17,26 +17,30 @@
# limitations under the License.


__module__ = """tests.context"""
"""This is pythonrepo testing module Template."""


try:
import sys
import os
if 'pythonrepo' in __file__:
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
except Exception as ImportErr:
print(str(type(ImportErr)))
print(str(ImportErr))
print(str((ImportErr.args)))
ImportErr = None
del ImportErr
raise ImportError("Python Repo Failed to Import")
except Exception as badErr:
baton = ImportError(badErr, str("[CWE-758] Test module failed completely."))
baton.module = __module__
baton.path = __file__
baton.__cause__ = badErr
raise baton


try:
import pythonrepo as pythonrepo
if pythonrepo.__name__ is None:
raise ImportError("Failed to import pythonrepo.")
except Exception as importErr:
importErr = None
del importErr
raise ImportError("Test module failed to load pythonrepo for test.")
exit(0)
except Exception as badErr:
baton = ImportError(badErr, str("[CWE-758] Test module failed to load pythonrepo for test."))
baton.module = __module__
baton.path = __file__
baton.__cause__ = badErr
raise baton
Loading