Skip to content

Commit

Permalink
#416 updated python extracts
Browse files Browse the repository at this point in the history
  • Loading branch information
andydandy74 committed Oct 11, 2024
1 parent 36c4bb0 commit a5d6a1c
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion nodes/3.x/python/FileSystem.FileSize.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import clr
import System.IO.FileInfo
import System.IO

def GetFileSize(file):
if str(file.GetType()) == "System.IO.FileInfo":
Expand Down
2 changes: 1 addition & 1 deletion nodes/3.x/python/RandomList.AsIntegers.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import clr
import System.Random
import System

min = IN[0]
max = IN[1]
Expand Down
8 changes: 4 additions & 4 deletions nodes/3.x/python/System.CPUs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
from System.Management import ManagementObject, ManagementObjectSearcher
sysinfo = ManagementObjectSearcher("Select NumberOfProcessors, NumberOfLogicalProcessors from Win32_ComputerSystem").Get()
for sysdata in sysinfo:
physicalProcessors = sysdata.Item["NumberOfProcessors"]
logicalProcessors = sysdata.Item["NumberOfLogicalProcessors"]
physicalProcessors = sysdata.get_Item("NumberOfProcessors")
logicalProcessors = sysdata.get_Item("NumberOfLogicalProcessors")
sysinfo = ManagementObjectSearcher("Select NumberOfCores, MaxClockSpeed from Win32_Processor").Get()
cores = 0
for sysdata in sysinfo:
cores += sysdata.Item["NumberOfCores"]
cpuspeed = sysdata.Item["MaxClockSpeed"]
cores += sysdata.get_Item("NumberOfCores")
cpuspeed = sysdata.get_Item("MaxClockSpeed")
OUT = (physicalProcessors, logicalProcessors, cores, float(cpuspeed)/1000)
4 changes: 2 additions & 2 deletions nodes/3.x/python/System.Memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
sysinfo = ManagementObjectSearcher("Select Capacity from Win32_PhysicalMemory").Get()
installedMem = 0
for sysdata in sysinfo:
installedMem += sysdata.Item["Capacity"]
installedMem += sysdata.get_Item("Capacity")
sysinfo = ManagementObjectSearcher("Select FreePhysicalMemory from Win32_OperatingSystem").Get()
for sysdata in sysinfo:
freeMem = sysdata.Item["FreePhysicalMemory"]
freeMem = sysdata.get_Item("FreePhysicalMemory")
procMem = Process.GetCurrentProcess().WorkingSet64
OUT = (float(installedMem)/1073741824, float(freeMem)/1048576, float(procMem)/1073741824)
3 changes: 2 additions & 1 deletion nodes/3.x/python/TimeSpan.EvaluateLapTimes.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
import clr
OUT = [x - y for x, y in zip(IN[0][1:], IN[0][:-1])], IN[0][-1]-IN[0][0]
from System import DateTime
OUT = [x.Subtract(y) for x, y in zip(IN[0][1:], IN[0][:-1])], IN[0][-1].Subtract(IN[0][0])
8 changes: 4 additions & 4 deletions nodes/3.x/python/VersionNumber.Compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from System import Version

if isinstance(IN[0], list):
if isinstance(IN[1], list): OUT = [x.CompareTo(y) for x,y in zip(IN[0], IN[1])]
else: OUT = [x.CompareTo(IN[1]) for x in IN[0]]
if isinstance(IN[1], list): OUT = [Version(x).CompareTo(Version(y)) for x,y in zip(IN[0], IN[1])]
else: OUT = [Version(x).CompareTo(Version(IN[1])) for x in IN[0]]
else:
if isinstance(IN[1], list): OUT = [IN[0].CompareTo(x) for x in IN[1]]
else: OUT = IN[0].CompareTo(IN[1])
if isinstance(IN[1], list): OUT = [Version(IN[0]).CompareTo(Version(x)) for x in IN[1]]
else: OUT = Version(IN[0]).CompareTo(Version(IN[1]))
2 changes: 1 addition & 1 deletion nodes/3.x/python/Wall.Orientation.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def WallOrientation(wall):
if flipped: return wall.Orientation.ToVector().Reverse()
else: return wall.Orientation.ToVector()
else:
direction = (lcurve.GetEndPoint(1) - lcurve.GetEndPoint(0)).Normalize()
direction = (lcurve.GetEndPoint(1).Subtract(lcurve.GetEndPoint(0))).Normalize()
if flipped: return XYZ.BasisZ.CrossProduct(direction).ToVector().Reverse()
else: return XYZ.BasisZ.CrossProduct(direction).ToVector()
else: return None
Expand Down

0 comments on commit a5d6a1c

Please sign in to comment.