mirror of
				https://github.com/lubuntu-team/ci-tooling.git
				synced 2025-10-31 14:04:05 +00:00 
			
		
		
		
	Fix ModuleNotFoundError
Summary:
The jobgenerator failed because of a missing module.
  * Add tabulate to requirements.txt
  * Fix flake8 errors:
    - Removed unused imports
    - Boolean comparison with is and not ==
    - Line length
    - Removed whitespaces before and after parentheses
Test Plan:
1. Install it from the requirements
2. Start jobgenerator
3. Check, that it does not fail because of missing tabulate module.
Reviewers: tsimonq2, teward
Differential Revision: https://phab.lubuntu.me/D95
			
			
This commit is contained in:
		
							parent
							
								
									c6f4117ab7
								
							
						
					
					
						commit
						73939dc9b5
					
				| @ -16,8 +16,6 @@ | |||||||
| # along with this program.  If not, see <https://www.gnu.org/licenses/>. | # along with this program.  If not, see <https://www.gnu.org/licenses/>. | ||||||
| 
 | 
 | ||||||
| import time | import time | ||||||
| import tabulate |  | ||||||
| import sys |  | ||||||
| from tabulate import tabulate | from tabulate import tabulate | ||||||
| 
 | 
 | ||||||
| tabulate.PRESERVE_WHITESPACE = True | tabulate.PRESERVE_WHITESPACE = True | ||||||
| @ -68,7 +66,7 @@ class TimerMetrics: | |||||||
|             self.data[name]["total_time"] = 0.0 |             self.data[name]["total_time"] = 0.0 | ||||||
| 
 | 
 | ||||||
|         # If it is there, only act if it's running |         # If it is there, only act if it's running | ||||||
|         elif self.data[name]["running"] == False: |         elif self.data[name]["running"] is False: | ||||||
|             # Now we're running |             # Now we're running | ||||||
|             self.data[name]["running"] = True |             self.data[name]["running"] = True | ||||||
| 
 | 
 | ||||||
| @ -92,7 +90,7 @@ class TimerMetrics: | |||||||
|             assert ValueError("Timer " + name + " not found") |             assert ValueError("Timer " + name + " not found") | ||||||
| 
 | 
 | ||||||
|         # If the timer is running, update total_time and stop it |         # If the timer is running, update total_time and stop it | ||||||
|         if self.data[name]["running"] == True: |         if self.data[name]["running"] is True: | ||||||
|             # Stop the timer |             # Stop the timer | ||||||
|             self.data[name]["running"] = False |             self.data[name]["running"] = False | ||||||
| 
 | 
 | ||||||
| @ -118,7 +116,6 @@ class TimerMetrics: | |||||||
|             return run_function |             return run_function | ||||||
|         return wrap |         return wrap | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
|     def display(self): |     def display(self): | ||||||
|         """Print a pretty(-ish) table with all of the data in it""" |         """Print a pretty(-ish) table with all of the data in it""" | ||||||
| 
 | 
 | ||||||
| @ -133,7 +130,10 @@ class TimerMetrics: | |||||||
| 
 | 
 | ||||||
|         # Sort the data into descending order and then put them into two lists |         # Sort the data into descending order and then put them into two lists | ||||||
|         # Keys have one list and values have another |         # Keys have one list and values have another | ||||||
|         s_pretty = {k: v for k, v in sorted(pretty.items(), key=lambda item: item[1], reverse=True)} |         s_pretty = {k: v for k, | ||||||
|  |                     v in sorted(pretty.items(), | ||||||
|  |                                 key=lambda item: item[1], | ||||||
|  |                                 reverse=True)} | ||||||
|         table["Timer"] = list(s_pretty.keys()) |         table["Timer"] = list(s_pretty.keys()) | ||||||
|         table["Seconds"] = list(s_pretty.values()) |         table["Seconds"] = list(s_pretty.values()) | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -3,3 +3,4 @@ jinja2 | |||||||
| jenkinsapi | jenkinsapi | ||||||
| GitPython | GitPython | ||||||
| PyYAML | PyYAML | ||||||
|  | tabulate | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user