added initial
This commit is contained in:
		
						commit
						f5180334f8
					
				
					 8 changed files with 108 additions and 0 deletions
				
			
		
							
								
								
									
										1
									
								
								.gitignore
									
										
									
									
										vendored
									
									
										Symbolic link
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
										
									
									
										vendored
									
									
										Symbolic link
									
								
							|  | @ -0,0 +1 @@ | ||||||
|  | .pscaffold/.gitignore | ||||||
							
								
								
									
										22
									
								
								.gitlab-ci.yml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								.gitlab-ci.yml
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,22 @@ | ||||||
|  | image: python | ||||||
|  | 
 | ||||||
|  | test:pylama: | ||||||
|  |     stage: test | ||||||
|  |     only: | ||||||
|  |         - master | ||||||
|  |         - develop | ||||||
|  |     before_script: | ||||||
|  |         - if test -r requirements.txt; then pip install -r requirements.txt; fi | ||||||
|  |     script: | ||||||
|  |         if test -x "$(which pylama)"; then pylama *.py; fi | ||||||
|  | 
 | ||||||
|  | test:pytest: | ||||||
|  |     stage: test | ||||||
|  |     only: | ||||||
|  |         - master | ||||||
|  |         - develop | ||||||
|  |     before_script: | ||||||
|  |         - if test -r requirements.txt; then pip install -r requirements.txt; fi | ||||||
|  |     script: | ||||||
|  |         if test -x "$(which pytest)"; then pytest .; fi | ||||||
|  | 
 | ||||||
							
								
								
									
										3
									
								
								.gitmodules
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								.gitmodules
									
										
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1,3 @@ | ||||||
|  | [submodule ".pscaffold"] | ||||||
|  | 	path = .pscaffold | ||||||
|  | 	url = git@gitlab.com:schtobia/pscaffold.git | ||||||
							
								
								
									
										1
									
								
								.pscaffold
									
										
									
									
									
										Submodule
									
								
							
							
						
						
									
										1
									
								
								.pscaffold
									
										
									
									
									
										Submodule
									
								
							|  | @ -0,0 +1 @@ | ||||||
|  | Subproject commit 524a5a12433b02c6961b1ae73807cf8eb0e6958b | ||||||
							
								
								
									
										1
									
								
								.style.yapf
									
										
									
									
									
										Symbolic link
									
								
							
							
						
						
									
										1
									
								
								.style.yapf
									
										
									
									
									
										Symbolic link
									
								
							|  | @ -0,0 +1 @@ | ||||||
|  | .pscaffold/.style.yapf | ||||||
							
								
								
									
										1
									
								
								pylama.ini
									
										
									
									
									
										Symbolic link
									
								
							
							
						
						
									
										1
									
								
								pylama.ini
									
										
									
									
									
										Symbolic link
									
								
							|  | @ -0,0 +1 @@ | ||||||
|  | .pscaffold/pylama.ini | ||||||
							
								
								
									
										11
									
								
								requirements.txt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								requirements.txt
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,11 @@ | ||||||
|  | eradicate>=2.0.0 | ||||||
|  | isort>=5.5.0 | ||||||
|  | mccabe>=0.6.0 | ||||||
|  | mypy>=0.812 | ||||||
|  | pycodestyle>=2.6.0 | ||||||
|  | pydocstyle>=5.1.0 | ||||||
|  | pyflakes>=2.2.0 | ||||||
|  | pylama>=7.7.0 | ||||||
|  | pylint>=2.6.0 | ||||||
|  | todotxtio>=0.2.3 | ||||||
|  | yapf>=0.27.0 | ||||||
							
								
								
									
										68
									
								
								todo.py
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										68
									
								
								todo.py
									
										
									
									
									
										Executable file
									
								
							|  | @ -0,0 +1,68 @@ | ||||||
|  | #! /usr/bin/env python3 | ||||||
|  | # -*- coding: utf-8 -*- | ||||||
|  | 
 | ||||||
|  | """Retrieves covid19 numbers from RKI for `argos <https://github.com/p-e-w/argos>`.""" | ||||||
|  | 
 | ||||||
|  | # <bitbar.title>httping</bitbar.title> | ||||||
|  | # <bitbar.version>v1.0</bitbar.version> | ||||||
|  | # <bitbar.author>Tobias Schmidl</bitbar.author> | ||||||
|  | # <bitbar.author.github>schtobia</bitbar.author.github> | ||||||
|  | # <bitbar.desc>Short description of what your plugin does.</bitbar.desc> | ||||||
|  | # <bitbar.image></bitbar.image> | ||||||
|  | # <bitbar.dependencies>python,requests</bitbar.dependencies> | ||||||
|  | # <bitbar.abouturl>https://gitlab.com/schtobia/argos-corona/blob/master/corona.py</bitbar.abouturl> | ||||||
|  | 
 | ||||||
|  | from __future__ import annotations | ||||||
|  | 
 | ||||||
|  | from pathlib import Path | ||||||
|  | 
 | ||||||
|  | import todotxtio  # type: ignore | ||||||
|  | 
 | ||||||
|  | __author__ = "Tobias Schmidl" | ||||||
|  | __copyright__ = "Copyright 2021, Tobias Schmidl" | ||||||
|  | __license__ = "MIT" | ||||||
|  | __version__ = "1.0" | ||||||
|  | __maintainer__ = "Tobias Schmidl" | ||||||
|  | 
 | ||||||
|  | TODO_TXT_PATH = Path.home() / '.todo-txt' / 'todo.txt' | ||||||
|  | COLOR_LIST = { | ||||||
|  |     1: ['#fc8d59'], | ||||||
|  |     2: ['#fc8d59', '#91cf60'], | ||||||
|  |     3: ['#fc8d59', '#ffffbf', '#91cf60'], | ||||||
|  |     4: ['#d7191c', '#fdae61', '#a6d96a', '#1a9641'], | ||||||
|  |     5: ['#d7191c', '#fdae61', '#ffffbf', '#a6d96a', '#1a9641'], | ||||||
|  |     6: ['#d73027', '#fc8d59', '#fee08b', '#d9ef8b', '#91cf60', '#1a9850'], | ||||||
|  |     7: ['#d73027', '#fc8d59', '#fee08b', '#ffffbf', '#d9ef8b', '#91cf60', '#1a9850'], | ||||||
|  |     8: ['#d73027', '#f46d43', '#fdae61', '#fee08b', '#d9ef8b', '#a6d96a', '#66bd63', '#1a9850'], | ||||||
|  |     9: ['#d73027', '#f46d43', '#fdae61', '#fee08b', '#ffffbf', '#d9ef8b', '#a6d96a', '#66bd63', '#1a9850'], | ||||||
|  |     10: ['#a50026', '#d73027', '#f46d43', '#fdae61', '#fee08b', '#d9ef8b', '#a6d96a', '#66bd63', '#1a9850', '#006837'], | ||||||
|  |     11: [ | ||||||
|  |         '#a50026', '#d73027', '#f46d43', '#fdae61', '#fee08b', '#ffffbf', '#d9ef8b', '#a6d96a', '#66bd63', '#1a9850', | ||||||
|  |         '#006837' | ||||||
|  |     ] | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | if __name__ == "__main__": | ||||||
|  |     list_of_tasks = todotxtio.from_file(TODO_TXT_PATH) | ||||||
|  |     list_of_priorities = [int(x.priority, base=16) for x in list_of_tasks] | ||||||
|  |     max_prio = max(list_of_priorities) | ||||||
|  |     min_prio = min(list_of_priorities) | ||||||
|  |     print("Tasks:", len(list_of_tasks)) | ||||||
|  |     print("---") | ||||||
|  |     for task in list_of_tasks: | ||||||
|  |         priority = int(task.priority, base=16) | ||||||
|  |         old_range = max_prio - min_prio + 1 | ||||||
|  |         new_range = len(set(list_of_priorities)) | ||||||
|  |         priority = int(((priority - min_prio) * new_range) / old_range) | ||||||
|  |         if "due" not in task.tags: | ||||||
|  |             print("<span size=\"larger\" weight=\"bold\">" + task.priority + | ||||||
|  |                   "</span>: <span size=\"medium\" foreground=\"" + COLOR_LIST[new_range][priority] + "\">" + task.text + | ||||||
|  |                   "</span>") | ||||||
|  |         else: | ||||||
|  |             print("<span size=\"larger\" weight=\"bold\">" + task.priority + | ||||||
|  |                   "</span>: <span size=\"medium\" background=\"white\" foreground=\"black\">" + task.tags["due"] + | ||||||
|  |                   "</span> <span size=\"medium\" foreground=\"" + COLOR_LIST[new_range][priority] + "\">" + task.text + | ||||||
|  |                   "</span>") | ||||||
|  |         print("--", " ".join(["@" + x for x in task.contexts])) | ||||||
|  |         print("--", " ".join(["+" + x for x in task.projects])) | ||||||
|  |         print("--", " ".join([key + ": " + value for key, value in task.tags.items() if key != "due"])) | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue