File tree Expand file tree Collapse file tree 6 files changed +34
-14
lines changed Expand file tree Collapse file tree 6 files changed +34
-14
lines changed Original file line number Diff line number Diff line change 1616 - run : python3 -mpip install -r requirements.txt
1717 - run : git clone --depth=1 https://github.com/adafruit/Adafruit_Learning_System_Guides learn
1818 - run : env LEARN_GUIDE_REPO=learn/ python3 create_requirement_images.py
19- - uses : actions/upload-artifact@v2
19+ - uses : actions/upload-artifact@v4
2020 with :
2121 name : images
2222 path : generated_images
Original file line number Diff line number Diff line change @@ -6,3 +6,15 @@ __pycache__
66latest_bundle_data.json
77latest_bundle_tag.json
88generated_images
9+
10+ # Virtual environment-specific files
11+ .env
12+ .venv
13+
14+ # MacOS-specific files
15+ * .DS_Store
16+
17+ # IDE-specific files
18+ .idea
19+ .vscode
20+ * ~
Original file line number Diff line number Diff line change 88 hooks :
99 - id : black
1010- repo : https://github.com/fsfe/reuse-tool
11- rev : v0.12.1
11+ rev : v1.1.2
1212 hooks :
1313 - id : reuse
1414- repo : https://github.com/pre-commit/pre-commit-hooks
1818 - id : end-of-file-fixer
1919 - id : trailing-whitespace
2020- repo : https://github.com/pycqa/pylint
21- rev : pylint- 2.7.1
21+ rev : v3. 2.7
2222 hooks :
2323 - id : pylint
2424 name : pylint (library code)
Original file line number Diff line number Diff line change @@ -20,7 +20,14 @@ It will create images in the `generated_images` directory.
2020### Generate Single Learn Guide Image
2121
2222``` shell
23- python3 create_requirement_images.py --guide [Learn Guide Name]
23+ python3 create_requirement_images.py learn --guide [Learn Guide Name]
2424# OR
25- python3 create_requirement_images.py -g [Learn Guide Name]
25+ python3 create_requirement_images.py learn -g [Learn Guide Name]
26+ ```
27+
28+ ### Help Command
29+ The help command will list all possible commands and arguments.
30+
31+ ``` shell
32+ python3 create_requirement_images.py --help
2633```
Original file line number Diff line number Diff line change 3838TEXT_COLOR = "#B0B0B0"
3939HIDDEN_TEXT_COLOR = "#808080"
4040
41- f = open ("latest_bundle_data.json" , "r" )
42- bundle_data = json .load (f )
43- f .close ()
41+ with open ("latest_bundle_data.json" , "r" , encoding = "utf-8" ) as f :
42+ bundle_data = json .load (f )
4443
4544
4645def asset_path (asset_name ):
@@ -415,14 +414,16 @@ def make_sd_dir(position):
415414 PADDING + (LINE_SPACING * (7 + project_files_count )),
416415 )
417416 make_libraries (final_list_to_render , _libraries_position )
417+
418418 _sd_dir_position = (
419419 76 ,
420420 PADDING
421- + (LINE_SPACING * (7 + project_files_count + len (final_list_to_render ))),
421+ + (LINE_SPACING * (7 + project_files_count + len (final_list_to_render )))
422+ + (1 if context ["added_settings_toml" ] else 0 ) * LINE_SPACING ,
422423 )
423424 make_sd_dir (_sd_dir_position )
424425
425- img .save ("generated_images/{}.png" . format ( image_name ) )
426+ img .save (f "generated_images/{ image_name } .png" )
426427
427428
428429def generate_learn_requirement_image ( # pylint: disable=invalid-name
Original file line number Diff line number Diff line change @@ -116,14 +116,14 @@ def ensure_latest_bundle():
116116
117117ensure_latest_bundle ()
118118
119- with open ("latest_bundle_data.json" , "r" ) as f :
119+ with open ("latest_bundle_data.json" , "r" , encoding = "utf-8" ) as f :
120120 bundle_data = json .load (f )
121121
122122
123123def get_files_for_project (project_name ):
124124 """Get the set of files for a learn project"""
125125 found_files = set ()
126- project_dir = "{ }/{}/". format ( LEARN_GUIDE_REPO , project_name )
126+ project_dir = f" { LEARN_GUIDE_REPO } /{ project_name } /"
127127
128128 full_tree = os .walk (project_dir )
129129 root_level = next (full_tree )
@@ -153,11 +153,11 @@ def get_libs_for_project(project_name):
153153 """Get the set of libraries for a learn project"""
154154 found_libs = set ()
155155 found_imports = []
156- project_dir = "{}{ }/". format ( LEARN_GUIDE_REPO , project_name )
156+ project_dir = f" { LEARN_GUIDE_REPO } { project_name } /"
157157 for file in os .listdir (project_dir ):
158158 if file .endswith (".py" ):
159159
160- found_imports = findimports .find_imports ("{}{}" . format ( project_dir , file ) )
160+ found_imports = findimports .find_imports (f" { project_dir } { file } " )
161161
162162 for cur_import in found_imports :
163163 cur_lib = cur_import .name .split ("." )[0 ]
You can’t perform that action at this time.
0 commit comments