Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/python-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Python Lint

on:
push:
pull_request:

jobs:
pyright:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Set up Node.js (for pyright)
uses: actions/setup-node@v4
with:
node-version: 20

- name: Install pyright
run: npm install -g pyright

- name: Run pyright
run: pyright
13 changes: 4 additions & 9 deletions gettools.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,7 @@
import zipfile
import time

# For Python 3.0 and later
import urllib
# noinspection PyCompatibility
from urllib.request import urlopen, Request, urlretrieve, install_opener
# noinspection PyCompatibility
from urllib.request import urlopen, build_opener, install_opener, Request, urlretrieve
from html.parser import HTMLParser

# Check minimal Python version is 3
Expand Down Expand Up @@ -69,11 +65,10 @@ def convertpath(path):
return path.replace(os.path.sep, '/')

def reporthook(count, block_size, total_size):
global start_time
if count == 0:
start_time = time.time()
reporthook.start_time = time.time()
return
duration = time.time() - start_time
duration = time.time() - reporthook.start_time
progress_size = int(count * block_size)
speed = int(progress_size / (1024 * duration)) if duration>0 else 0
percent = min(int(count*block_size*100/total_size),100)
Expand Down Expand Up @@ -170,7 +165,7 @@ def DownloadAndExtractTarFile(url, dest):
print('Retrieving Darwin tools from: ' + urlpost15)
try:
# Try to get tools from packages folder
opener = urllib.request.build_opener()
opener = build_opener()
opener.addheaders = [('User-Agent','Magic Browser')]
install_opener(opener)
urlretrieve(urlpost15, convertpath(dest + '/tools/' + tarName), reporthook)
Expand Down
19 changes: 19 additions & 0 deletions pyrightconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
// Assume Windows environment so winreg and other Windows-only modules are available
"pythonPlatform": "Windows",

// Point to your source if not at repo root (optional)
"include": [ "." ],

// Match Pylance defaults (what VS 2022 is showing you)
"typeCheckingMode": "basic",

// Keep useful checks
"reportUnboundVariable": "error",
"reportAttributeAccessIssue": "error",
"reportWildcardImportFromLibrary": "warning",

// Disable overly strict stuff you don�t want in CI
"reportMissingImports": "none",
"reportMissingModuleSource": "none"
}
4 changes: 1 addition & 3 deletions unlocker.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@
# Setup imports depending on whether IronPython or CPython
if sys.platform == 'win32' \
or sys.platform == 'cli':
# noinspection PyUnresolvedReferences
from winreg import *
from winreg import ConnectRegistry, HKEY_LOCAL_MACHINE, OpenKey, QueryValueEx



Expand Down Expand Up @@ -343,7 +342,6 @@ def patchvmkctl(name):
print('smcPresent Patched: ' + name)


# noinspection PyUnresolvedReferences
def main():
# Work around absent Platform module on VMkernel
if os.name == 'nt' or os.name == 'cli':
Expand Down