<commit_before>.PHONY: clean clean-test clean-pyc clean-build docs help
.DEFAULT_GOAL := help
define BROWSER_PYSCRIPT
import os, webbrowser, sys
try:
	from urllib import pathname2url
except:
	from urllib.request import pathname2url

webbrowser.open("file://" + pathname2url(os.path.abspath(sys.argv[1])))
endef
export BROWSER_PYSCRIPT

define PRINT_HELP_PYSCRIPT
import re, sys

for line in sys.stdin:
	match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line)
	if match:
		target, help = match.groups()
		print("%-20s %s" % (target, help))
endef
export PRINT_HELP_PYSCRIPT
BROWSER := python -c "$$BROWSER_PYSCRIPT"

help:
	@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)

test: ## run tests in current Python environment with pytest
	py.test
	
test-all: ## run tests in several Python environments with tox
	tox

lint: ## check code style/quality with flake8
	flake8 --exit-zero --benchmark project_template tests

coverage: ## check code coverage and show report in terminal
	coverage run --module pytest
	coverage report

coverage-html: coverage ## check code coverage and show report in browser
	@coverage html
	@$(BROWSER) htmlcov/index.html

docs: clean-docs docs-pdf docs-html ## generate HTML & PDF documentation

docs-html: clean-docs ## generate HTML documentation
	$(MAKE) -C docs html
	@$(BROWSER) docs/_build/html/index.html
    
docs-pdf: clean-docs ## generate PDF documentation
	$(MAKE) -C docs latexpdf

clean: clean-build clean-pyc clean-test ## remove all build, test, coverage and Python artifacts

clean-build: ## remove build artifacts
	rm -fr build/
	rm -fr dist/
	rm -fr .eggs/
	find . -name '*.egg-info' -exec rm -fr {} +
	find . -name '*.egg' -exec rm -f {} +

clean-pyc: ## remove Python file artifacts
	find . -name '*.pyc' -exec rm -f {} +
	find . -name '*.pyo' -exec rm -f {} +
	find . -name '*~' -exec rm -f {} +
	find . -name '__pycache__' -exec rm -fr {} +

clean-test: ## remove test and coverage artifacts
	rm -fr .tox/
	rm -f .coverage
	rm -fr htmlcov/

clean-docs: ## clean docs
	rm -f docs/project_template.rst
	rm -f docs/modules.rst
	sphinx-apidoc -o docs/ project_template
	$(MAKE) -C docs clean<commit_msg>reworked cleaning prior to tests<commit_after>.PHONY: clean clean-test clean-pyc clean-build docs help
.DEFAULT_GOAL := help
define BROWSER_PYSCRIPT
import os, webbrowser, sys
try:
	from urllib import pathname2url
except:
	from urllib.request import pathname2url

webbrowser.open("file://" + pathname2url(os.path.abspath(sys.argv[1])))
endef
export BROWSER_PYSCRIPT

define PRINT_HELP_PYSCRIPT
import re, sys

for line in sys.stdin:
	match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line)
	if match:
		target, help = match.groups()
		print("%-20s %s" % (target, help))
endef
export PRINT_HELP_PYSCRIPT
BROWSER := python -c "$$BROWSER_PYSCRIPT"

help:
	@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)

test: ## run tests in current Python environment with pytest
	py.test
	
test-all: ## run tests in several Python environments with tox
	rm -fr .tox/
	tox

lint: ## check code style/quality with flake8
	rm -f flake8*
	flake8 --exit-zero --benchmark project_template tests

coverage: ## check code coverage and show report in terminal
	rm -f .coverage
	coverage run --module pytest
	coverage report

coverage-html: coverage ## check code coverage and show report in browser
	@rm -fr htmlcov/
	@coverage html
	@$(BROWSER) htmlcov/index.html

docs: clean-docs docs-pdf docs-html ## generate HTML & PDF documentation

docs-html: clean-docs ## generate HTML documentation
	$(MAKE) -C docs html
	@$(BROWSER) docs/_build/html/index.html
    
docs-pdf: clean-docs ## generate PDF documentation
	$(MAKE) -C docs latexpdf

clean: clean-build clean-pyc clean-docs ## remove all build, docs, and Python artifacts

clean-build: ## remove build artifacts
	rm -fr build/
	rm -fr dist/
	rm -fr .eggs/
	find . -name '*.egg-info' -exec rm -fr {} +
	find . -name '*.egg' -exec rm -f {} +

clean-pyc: ## remove Python file artifacts
	find . -name '*.pyc' -exec rm -f {} +
	find . -name '*.pyo' -exec rm -f {} +
	find . -name '*~' -exec rm -f {} +
	find . -name '__pycache__' -exec rm -fr {} +

clean-docs: ## clean docs
	rm -f docs/project_template.rst
	rm -f docs/modules.rst
	sphinx-apidoc -o docs/ project_template
	$(MAKE) -C docs clean
{'fraction_non_alphanumeric': 0.13163432312368484, 'fraction_numerical': 0.00397474865559972, 'mean_word_length': 3.711453744493392, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1801875', 'n_tokens_mistral': 1606, 'n_tokens_neox': 1510, 'n_words': 495}