13c8a10e39d60c078193d403b253270cdc4abc80
- Author
- Carlo Sala <carlosalag@protonmail.com>
- Committer
- Carlo Sala <carlosalag@protonmail.com>
- Date
Message
Diff
This diff is truncated to protect this page.
1diff --git a/.editorconfig b/.editorconfig
2index b5321de59eab105519a7635c51dd5e67655b9e80..b349bcc4211d6839464ee54f8e468f323787c467 100644
3--- a/.editorconfig
4+++ b/.editorconfig
5@@ -6,3 +6,6 @@ insert_final_newline = true
6 charset = utf-8
7 indent_size = 2
8 indent_style = space
9+
10+[*.py]
11+indent_size = 4
12diff --git a/.github/workflows/dependencies/updater.py b/.github/workflows/dependencies/updater.py
13index f54d316f938383dc4d15bd146d0df06eed1bdb58..765cb26fe1194ff9abf167fbae3da21c6cfab1aa 100644
14--- a/.github/workflows/dependencies/updater.py
15+++ b/.github/workflows/dependencies/updater.py
16@@ -1,12 +1,14 @@
17 import os
18+import shutil
19 import subprocess
20 import sys
21-import requests
22-import shutil
23-import yaml
24+import timeit
25 from copy import deepcopy
26 from typing import Optional, TypedDict
27
28+import requests
29+import yaml
30+
31 # Get TMP_DIR variable from environment
32 TMP_DIR = os.path.join(os.environ.get("TMP_DIR", "/tmp"), "ohmyzsh")
33 # Relative path to dependencies.yml file
34@@ -14,28 +16,29 @@ DEPS_YAML_FILE = ".github/dependencies.yml"
35 # Dry run flag
36 DRY_RUN = os.environ.get("DRY_RUN", "0") == "1"
37
38-import timeit
39+
40 class CodeTimer:
41- def __init__(self, name=None):
42- self.name = " '" + name + "'" if name else ''
43+ def __init__(self, name=None):
44+ self.name = " '" + name + "'" if name else ""
45
46- def __enter__(self):
47- self.start = timeit.default_timer()
48+ def __enter__(self):
49+ self.start = timeit.default_timer()
50
51- def __exit__(self, exc_type, exc_value, traceback):
52- self.took = (timeit.default_timer() - self.start) * 1000.0
53- print('Code block' + self.name + ' took: ' + str(self.took) + ' ms')
54+ def __exit__(self, exc_type, exc_value, traceback):
55+ self.took = (timeit.default_timer() - self.start) * 1000.0
56+ print("Code block" + self.name + " took: " + str(self.took) + " ms")
57
58
59 ### YAML representation
60 def str_presenter(dumper, data):
61- """
62- Configures yaml for dumping multiline strings
63- Ref: https://stackoverflow.com/a/33300001
64- """
65- if len(data.splitlines()) > 1: # check for multiline string
66- return dumper.represent_scalar('tag:yaml.org,2002:str', data, style='|')
67- return dumper.represent_scalar('tag:yaml.org,2002:str', data)
68+ """
69+ Configures yaml for dumping multiline strings
70+ Ref: https://stackoverflow.com/a/33300001
71+ """
72+ if len(data.splitlines()) > 1: # check for multiline string
73+ return dumper.represent_scalar("tag:yaml.org,2002:str", data, style="|")
74+ return dumper.represent_scalar("tag:yaml.org,2002:str", data)
75+
76
77 yaml.add_representer(str, str_presenter)
78 yaml.representer.SafeRepresenter.add_representer(str, str_presenter)
79@@ -43,408 +46,451 @@ yaml.representer.SafeRepresenter.add_representer(str, str_presenter)
80
81 # Types
82 class DependencyDict(TypedDict):
83- repo: str
84- branch: str
85- version: str
86- precopy: Optional[str]
87- postcopy: Optional[str]
88+ repo: str
89+ branch: str
90+ version: str
91+ precopy: Optional[str]
92+ postcopy: Optional[str]
93+
94
95 class DependencyYAML(TypedDict):
96- dependencies: dict[str, DependencyDict]
97+ dependencies: dict[str, DependencyDict]
98+
99
100 class UpdateStatus(TypedDict):
101- has_updates: bool
102- version: Optional[str]
103- compare_url: Optional[str]
104- head_ref: Optional[str]
105- head_url: Optional[str]
106+ has_updates: bool
107+ version: Optional[str]
108+ compare_url: Optional[str]
109+ head_ref: Optional[str]
110+ head_url: Optional[str]
111
112
113 class CommandRunner:
114- class Exception(Exception):
115- def __init__(self, message, returncode, stage, stdout, stderr):