1
0
Fork 0

python: run isort, add shebangs on all files

This commit is contained in:
Félix Piédallu 2024-02-07 14:49:55 +01:00
parent e74cb5522a
commit a6c976b309
15 changed files with 55 additions and 31 deletions

View file

@ -0,0 +1 @@
#!/usr/bin/env python3

View file

@ -2,12 +2,13 @@
import argparse import argparse
import json import json
import toml
import os import os
from pathlib import Path from pathlib import Path
import toml
from jinja2 import Environment, FileSystemLoader from jinja2 import Environment, FileSystemLoader
def value_for_lang(values, lang): def value_for_lang(values, lang):
if not isinstance(values, dict): if not isinstance(values, dict):
return values return values

View file

@ -1,15 +1,16 @@
import os #!/usr/bin/env python3
import hmac
import shlex
import hashlib
import asyncio import asyncio
import hashlib
import hmac
import os
import shlex
import tempfile import tempfile
from make_readme import generate_READMEs
from sanic import Sanic, response from sanic import Sanic, response
from sanic.response import text from sanic.response import text
from make_readme import generate_READMEs
app = Sanic(__name__) app = Sanic(__name__)
github_webhook_secret = open("github_webhook_secret", "r").read().strip() github_webhook_secret = open("github_webhook_secret", "r").read().strip()

View file

@ -0,0 +1 @@
#!/usr/bin/env python3

View file

@ -1,9 +1,11 @@
#!/usr/bin/python3 #!/usr/bin/python3
import json import json
import sys
import requests
import os import os
import subprocess import subprocess
import sys
import requests
catalog = requests.get("https://raw.githubusercontent.com/YunoHost/apps/master/apps.json").json() catalog = requests.get("https://raw.githubusercontent.com/YunoHost/apps/master/apps.json").json()

View file

@ -1,7 +1,8 @@
#!/usr/bin/python3 #!/usr/bin/python3
import json
import csv import csv
import json
def find_cpe(app_id): def find_cpe(app_id):
with open("../../patches/add-cpe/cpe.csv", newline='') as f: with open("../../patches/add-cpe/cpe.csv", newline='') as f:

View file

@ -1,13 +1,15 @@
import time #!/usr/bin/env python3
import glob
import hashlib import hashlib
import os
import re import re
import sys import sys
import requests import time
import toml
import os
import glob
from datetime import datetime from datetime import datetime
import requests
import toml
from rest_api import GithubAPI, GitlabAPI, RefType from rest_api import GithubAPI, GitlabAPI, RefType
STRATEGIES = [ STRATEGIES = [

View file

@ -1,8 +1,11 @@
from enum import Enum #!/usr/bin/env python3
import re import re
import requests from enum import Enum
from typing import List from typing import List
import requests
class RefType(Enum): class RefType(Enum):
tags = 1 tags = 1

View file

@ -1,14 +1,17 @@
#!venv/bin/python3 #!/usr/bin/env python3
import sys, os, time import json
import urllib.request, json import os
import re import re
import sys
import time
import urllib.request
from github import Github
import github import github
from github import Github
# Debug # Debug
from rich.traceback import install from rich.traceback import install
install(width=150, show_locals=True, locals_max_length=None, locals_max_string=None) install(width=150, show_locals=True, locals_max_length=None, locals_max_string=None)
##### #####

View file

@ -1,4 +1,4 @@
#!venv/bin/python3 #!/usr/bin/env python3
# Obtained with `pip install PyGithub`, better within a venv # Obtained with `pip install PyGithub`, better within a venv
from github import Github from github import Github

View file

@ -2,10 +2,10 @@
import json import json
import sys import sys
from difflib import SequenceMatcher
from functools import cache from functools import cache
from pathlib import Path from pathlib import Path
from typing import Any, Dict, Generator, List, Tuple from typing import Any, Dict, Generator, List, Tuple
from difflib import SequenceMatcher
import jsonschema import jsonschema
import toml import toml

View file

@ -0,0 +1 @@
#!/usr/bin/env python3

View file

@ -1,7 +1,9 @@
#!/usr/bin/env python3
import argparse import argparse
import json
import os import os
import re import re
import json
import subprocess import subprocess
from glob import glob from glob import glob
@ -226,7 +228,8 @@ def _convert_v1_manifest_to_v2(app_path):
def _dump_v2_manifest_as_toml(manifest): def _dump_v2_manifest_as_toml(manifest):
import re import re
from tomlkit import document, nl, table, dumps, comment
from tomlkit import comment, document, dumps, nl, table
toml_manifest = document() toml_manifest = document()
toml_manifest.add("packaging_format", 2) toml_manifest.add("packaging_format", 2)

View file

@ -1,3 +1,5 @@
#!/usr/bin/env python3
import copy import copy

View file

@ -1,12 +1,15 @@
import time #!/usr/bin/env python3
import toml
import requests import json
import tempfile
import os import os
import sys import sys
import json import tempfile
import time
from collections import OrderedDict from collections import OrderedDict
import requests
import toml
token = open(os.path.dirname(__file__) + "/../../.github_token").read().strip() token = open(os.path.dirname(__file__) + "/../../.github_token").read().strip()
tmpdir = tempfile.mkdtemp(prefix="update_app_levels_") tmpdir = tempfile.mkdtemp(prefix="update_app_levels_")