master > master: src - py
This commit is contained in:
		
							parent
							
								
									f91561663b
								
							
						
					
					
						commit
						99b8bbd6a7
					
				
							
								
								
									
										4
									
								
								code/python/.env
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								code/python/.env
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,4 @@ | |||||||
|  | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||||||
|  | # Environment variables | ||||||
|  | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||||||
|  | APPNAME=ads2 | ||||||
							
								
								
									
										50
									
								
								code/python/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								code/python/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,50 @@ | |||||||
|  | * | ||||||
|  | !/.gitignore | ||||||
|  | 
 | ||||||
|  | ################################################################ | ||||||
|  | # MAIN FOLDER | ||||||
|  | ################################################################ | ||||||
|  | 
 | ||||||
|  | !/.env | ||||||
|  | !/Makefile | ||||||
|  | !/README.md | ||||||
|  | !/LICENSE | ||||||
|  | !/requirements | ||||||
|  | 
 | ||||||
|  | ################################################################ | ||||||
|  | # PROJECT FILES | ||||||
|  | ################################################################ | ||||||
|  | 
 | ||||||
|  | !/src | ||||||
|  | !/src/**/ | ||||||
|  | !/src/**/*.py | ||||||
|  | 
 | ||||||
|  | !/tests | ||||||
|  | !/tests/**/ | ||||||
|  | !/tests/**/*.py | ||||||
|  | 
 | ||||||
|  | !/assets | ||||||
|  | !/assets/**/ | ||||||
|  | 
 | ||||||
|  | !/dist | ||||||
|  | !/dist/VERSION | ||||||
|  | 
 | ||||||
|  | ################################################################ | ||||||
|  | # AUXLIARY | ||||||
|  | ################################################################ | ||||||
|  | 
 | ||||||
|  | /logs | ||||||
|  | 
 | ||||||
|  | ################################################################ | ||||||
|  | # ARTEFACTS | ||||||
|  | ################################################################ | ||||||
|  | 
 | ||||||
|  | /**/__pycache__ | ||||||
|  | /**/.DS_Store | ||||||
|  | /**/__archive__* | ||||||
|  | 
 | ||||||
|  | ################################################################ | ||||||
|  | # Git Keep | ||||||
|  | ################################################################ | ||||||
|  | 
 | ||||||
|  | !/**/.gitkeep | ||||||
							
								
								
									
										0
									
								
								code/python/LICENSE
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								code/python/LICENSE
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										92
									
								
								code/python/Makefile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										92
									
								
								code/python/Makefile
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,92 @@ | |||||||
|  | SHELL:=/usr/bin/env bash | ||||||
|  | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 | ||||||
|  | # Makefile
 | ||||||
|  | # NOTE: Do not change the contents of this file!
 | ||||||
|  | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 | ||||||
|  | 
 | ||||||
|  | include .env | ||||||
|  | 
 | ||||||
|  | ################################
 | ||||||
|  | # VARIABLES
 | ||||||
|  | ################################
 | ||||||
|  | 
 | ||||||
|  | ARTEFACT_NAME:=${APPNAME} | ||||||
|  | PYTHON:=python3 | ||||||
|  | ifeq ($(OS),Windows_NT) | ||||||
|  | ARTEFACT_NAME:=${APPNAME}.exe | ||||||
|  | PYTHON=py -3 | ||||||
|  | endif | ||||||
|  | 
 | ||||||
|  | ################################
 | ||||||
|  | # Macros
 | ||||||
|  | ################################
 | ||||||
|  | 
 | ||||||
|  | define create_folder_if_not_exists | ||||||
|  | 	@if ! [ -d "$(1)" ]; then mkdir "$(1)"; fi | ||||||
|  | endef | ||||||
|  | 
 | ||||||
|  | define create_folder_if_not_exists | ||||||
|  | 	@touch "$(1)"; | ||||||
|  | endef | ||||||
|  | 
 | ||||||
|  | define delete_if_file_exists | ||||||
|  | 	@if [ -f "$(1)" ]; then rm "$(1)"; fi | ||||||
|  | endef | ||||||
|  | 
 | ||||||
|  | define delete_if_folder_exists | ||||||
|  | 	@if [ -d "$(1)" ]; then rm -rf "$(1)"; fi | ||||||
|  | endef | ||||||
|  | 
 | ||||||
|  | define clean_all_files | ||||||
|  | 	@find . -type f -name "$(1)" -exec basename {} \; | ||||||
|  | 	@find . -type f -name "$(1)" -exec rm {} \; 2> /dev/null | ||||||
|  | endef | ||||||
|  | 
 | ||||||
|  | define clean_all_folders | ||||||
|  | 	@find . -type d -name "$(1)" -exec basename {} \; | ||||||
|  | 	@find . -type d -name "$(1)" -exec rm -rf {} \; 2> /dev/null | ||||||
|  | endef | ||||||
|  | 
 | ||||||
|  | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 | ||||||
|  | # TARGETS
 | ||||||
|  | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 | ||||||
|  | 
 | ||||||
|  | ################################
 | ||||||
|  | # BASIC TARGETS: setup, build, run
 | ||||||
|  | ################################
 | ||||||
|  | setup: check-system-requirements setup-no-checks | ||||||
|  | setup-no-checks: | ||||||
|  | 	@${PYTHON} -m pip install -r "requirements" | ||||||
|  | run: | ||||||
|  | 	@${PYTHON} src/main.py; | ||||||
|  | all: setup run | ||||||
|  | ################################
 | ||||||
|  | # TARGETS: testing
 | ||||||
|  | ################################
 | ||||||
|  | unit-test: unit-tests | ||||||
|  | unit-tests: | ||||||
|  | 	@cd tests && \
 | ||||||
|  | 		${PYTHON} -m unittest discover -v \
 | ||||||
|  | 			--start-directory "." \
 | ||||||
|  | 			--top-level-directory ".." \
 | ||||||
|  | 			--pattern "test_*.py" | ||||||
|  | ################################
 | ||||||
|  | # AUXILIARY (INTERNAL TARGETS)
 | ||||||
|  | ################################
 | ||||||
|  | check-system-requirements: | ||||||
|  | 	@if ! ( ${PYTHON} --version >> /dev/null 2> /dev/null ); then \
 | ||||||
|  | 		echo "Install Python 3.10.x first!"; \
 | ||||||
|  | 		exit 1; \
 | ||||||
|  | 	fi | ||||||
|  | 	@${PYTHON} --version | ||||||
|  | ################################
 | ||||||
|  | # TARGETS: clean
 | ||||||
|  | ################################
 | ||||||
|  | clean: | ||||||
|  | 	@echo "All system artefacts will be force removed." | ||||||
|  | 	@$(call clean_all_files,.DS_Store) | ||||||
|  | 	@echo "All build artefacts will be force removed." | ||||||
|  | 	@$(call clean_all_folders,__pycache__) | ||||||
|  | 	@$(call clean_all_folders,.pytest_cache) | ||||||
|  | 	@$(call delete_if_file_exists,dist/${ARTEFACT_NAME}) | ||||||
|  | 	@exit 0 | ||||||
							
								
								
									
										3
									
								
								code/python/README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								code/python/README.md
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,3 @@ | |||||||
|  | # ADS2 - Implementierung in Python # | ||||||
|  | 
 | ||||||
|  | (_Noch nicht implementiert_) | ||||||
							
								
								
									
										1
									
								
								code/python/dist/VERSION
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								code/python/dist/VERSION
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1 @@ | |||||||
|  | 0.0.0 | ||||||
							
								
								
									
										4
									
								
								code/python/requirements
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								code/python/requirements
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,4 @@ | |||||||
|  | pip>=22.0.4 | ||||||
|  | typing>=3.7.4.3 | ||||||
|  | numpy>=1.22.3 | ||||||
|  | pandas>=1.4.1 | ||||||
							
								
								
									
										33
									
								
								code/python/src/main.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								code/python/src/main.py
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,33 @@ | |||||||
|  | #!/usr/bin/env python3 | ||||||
|  | # -*- coding: utf-8 -*- | ||||||
|  | 
 | ||||||
|  | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||||||
|  | # IMPORTS | ||||||
|  | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||||||
|  | 
 | ||||||
|  | import os; | ||||||
|  | import sys; | ||||||
|  | 
 | ||||||
|  | os.chdir(os.path.join(os.path.dirname(__file__), '..')); | ||||||
|  | sys.path.insert(0, os.getcwd()); | ||||||
|  | 
 | ||||||
|  | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||||||
|  | # GLOBAL CONSTANTS/VARIABLES | ||||||
|  | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||||||
|  | 
 | ||||||
|  | # | ||||||
|  | 
 | ||||||
|  | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||||||
|  | # MAIN METHOD | ||||||
|  | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||||||
|  | 
 | ||||||
|  | def enter(): | ||||||
|  |     print('Hello world!') | ||||||
|  |     return; | ||||||
|  | 
 | ||||||
|  | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||||||
|  | # EXECUTION | ||||||
|  | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||||||
|  | 
 | ||||||
|  | if __name__ == '__main__': | ||||||
|  |     enter(); | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user