mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 03:46:05 +08:00
Fixed one new class variable. Updated the script to run mypy.
This commit is contained in:
parent
eb43806d7a
commit
4715afdad6
@ -1,6 +1,6 @@
|
||||
from UM.Math.Color import Color
|
||||
from UM.Application import Application
|
||||
|
||||
from typing import Any
|
||||
import numpy
|
||||
|
||||
|
||||
@ -173,7 +173,7 @@ class LayerPolygon:
|
||||
|
||||
return normals
|
||||
|
||||
__color_map = None
|
||||
__color_map = None # type: numpy.ndarray[Any]
|
||||
|
||||
## Gets the instance of the VersionUpgradeManager, or creates one.
|
||||
@classmethod
|
||||
|
22
run_mypy.py
22
run_mypy.py
@ -1,8 +1,17 @@
|
||||
#!env python
|
||||
import os
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
os.putenv("MYPYPATH", r".;.\plugins;.\plugins\VersionUpgrade;..\Uranium_hint\;..\Uranium_hint\stubs\\" )
|
||||
# A quick Python implementation of unix 'where' command.
|
||||
def where(exeName):
|
||||
searchPath = os.getenv("PATH")
|
||||
paths = searchPath.split(";" if sys.platform == "win32" else ":")
|
||||
for path in paths:
|
||||
candidatePath = os.path.join(path, exeName)
|
||||
if os.path.exists(candidatePath):
|
||||
return candidatePath
|
||||
return None
|
||||
|
||||
def findModules(path):
|
||||
result = []
|
||||
@ -11,6 +20,13 @@ def findModules(path):
|
||||
result.append(entry.name)
|
||||
return result
|
||||
|
||||
def main():
|
||||
os.putenv("MYPYPATH", r".;.\plugins;.\plugins\VersionUpgrade;..\Uranium_hint\;..\Uranium_hint\stubs\\" )
|
||||
|
||||
# Mypy really needs to be run via its Python script otherwise it can't find its data files.
|
||||
mypyExe = where("mypy.bat" if sys.platform == "win32" else "mypy")
|
||||
mypyModule = os.path.join(os.path.dirname(mypyExe), "mypy")
|
||||
|
||||
plugins = findModules("plugins")
|
||||
plugins.sort()
|
||||
|
||||
@ -18,7 +34,7 @@ mods = ["cura"] + plugins + findModules("plugins/VersionUpgrade")
|
||||
|
||||
for mod in mods:
|
||||
print("------------- Checking module {mod}".format(**locals()))
|
||||
result = subprocess.run(["python", r"c:\python35\Scripts\mypy", "-p", mod])
|
||||
result = subprocess.run([sys.executable, mypyModule, "-p", mod])
|
||||
if result.returncode != 0:
|
||||
print("""
|
||||
Module {mod} failed checking. :(
|
||||
@ -29,3 +45,5 @@ else:
|
||||
|
||||
Done checking. All is good.
|
||||
""")
|
||||
return 0
|
||||
sys.exit(main())
|
||||
|
Loading…
x
Reference in New Issue
Block a user