本文整理汇总了Python中System.Collections.Generic.List方法的典型用法代码示例。如果您正苦于以下问题:Python Generic.List方法的具体用法?Python Generic.List怎么用?Python Generic.List使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Collections.Generic
的用法示例。
在下文中一共展示了Generic.List方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: DrawForeground
# 需要导入模块: from System.Collections import Generic [as 别名]
# 或者: from System.Collections.Generic import List [as 别名]
def DrawForeground(self, e):
lines = List[Line](self.lines_count)
for i, j in self.lines:
sp = self.points[i]
ep = self.points[j]
lines.Add(Line(Point3d(*sp), Point3d(*ep)))
e.Display.DrawLines(lines, self.color, self.thickness)
for i, (u, v) in enumerate(self.splines):
sp = self.points[u]
ep = self.points[v]
th = self.spline_thickness[i]
e.Display.DrawLine(Line(Point3d(*sp), Point3d(*ep)), self.spline_color, th)
# ==============================================================================
# Main
# ==============================================================================
示例2: test_generic_list
# 需要导入模块: from System.Collections import Generic [as 别名]
# 或者: from System.Collections.Generic import List [as 别名]
def test_generic_list(self):
"""https://github.com/IronLanguages/ironpython2/issues/109"""
from System.Collections.Generic import List
lst = List[str]()
lst.Add('Hello')
lst.Add('World')
vals = []
for v in lst[1:]:
vals.append(v)
self.assertEqual(vals, ['World'])
示例3: test_ipy2_gh39
# 需要导入模块: from System.Collections import Generic [as 别名]
# 或者: from System.Collections.Generic import List [as 别名]
def test_ipy2_gh39(self):
"""https://github.com/IronLanguages/ironpython2/issues/39"""
from System.Collections.Generic import List
rng = range(10000)
lst = List[object](rng)
it = iter(lst)
# Loop compilation occurs after 100 iterations, however it occurs in parallel.
# Use a number >> 100 so that we actually hit the compiled code.
for i in rng:
self.assertEqual(i, next(it))
示例4: CompileAsDll
# 需要导入模块: from System.Collections import Generic [as 别名]
# 或者: from System.Collections.Generic import List [as 别名]
def CompileAsDll(fileName, assemblyName):
sources = List[str]()
sources.Add(fileName)
pc = PythonCompiler(sources, assemblyName)
pc.TargetKind = System.Reflection.Emit.PEFileKinds.Dll
pc.Compile()
示例5: CompileOneFileAsConsoleApp1
# 需要导入模块: from System.Collections import Generic [as 别名]
# 或者: from System.Collections.Generic import List [as 别名]
def CompileOneFileAsConsoleApp1(fileName, assemblyName, setMainFile) :
sources = List[str]()
sources.Add(fileName)
pc = PythonCompiler(sources, assemblyName)
if setMainFile:
pc.MainFile = fileName
pc.Compile()
示例6: CompileOneFileAsConsoleApp2
# 需要导入模块: from System.Collections import Generic [as 别名]
# 或者: from System.Collections.Generic import List [as 别名]
def CompileOneFileAsConsoleApp2(fileName, assemblyName):
sources = List[str]()
sources.Add(fileName)
pc = PythonCompiler(sources, assemblyName)
pc.MainFile = "NotExistFile"
pc.Compile()
示例7: UsingReference
# 需要导入模块: from System.Collections import Generic [as 别名]
# 或者: from System.Collections.Generic import List [as 别名]
def UsingReference(fileName, typeName, assemblyName):
sources = List[str]()
sources.Add(fileName)
pc = PythonCompiler(sources, assemblyName)
pc.MainFile = fileName
refAsms = List[str]()
refAsms.Add(System.Type.GetType(typeName).Assembly.FullName)
pc.ReferencedAssemblies = refAsms
pc.Compile()
示例8: CheckIncludeDebugInformation
# 需要导入模块: from System.Collections import Generic [as 别名]
# 或者: from System.Collections.Generic import List [as 别名]
def CheckIncludeDebugInformation(fileName, assemblyName, include):
sources = List[str]()
sources.Add(fileName)
pc = PythonCompiler(sources, assemblyName)
pc.IncludeDebugInformation = include
pc.Compile()
示例9: PreprocessFailures
# 需要导入模块: from System.Collections import Generic [as 别名]
# 或者: from System.Collections.Generic import List [as 别名]
def PreprocessFailures(self, fa):
failList = List[FailureMessageAccessor](fa.GetFailureMessages() )
for failure in failList:
failID = failure.GetFailureDefinitionId()
if failID == BuiltInFailures.InaccurateFailures.InaccurateLine\
or failID == BuiltInFailures.OverlapFailures.DuplicatePoints :
fa.DeleteWarning(failure)
return FailureProcessingResult.Continue
示例10: test_generic_list
# 需要导入模块: from System.Collections import Generic [as 别名]
# 或者: from System.Collections.Generic import List [as 别名]
def test_generic_list(self):
"""https://github.com/IronLanguages/ironpython2/issues/109"""
from System.Collections.Generic import List
lst = List[str]()
lst.Add('Hello')
lst.Add('World')
vals = []
for v in lst[1:]:
vals.append(v)
self.assertEqual(vals, ['World'])
lst.Add('Universe')
self.assertEqual(list(lst[0::2]), ['Hello', 'Universe'])
示例11: PreprocessFailures
# 需要导入模块: from System.Collections import Generic [as 别名]
# 或者: from System.Collections.Generic import List [as 别名]
def PreprocessFailures(self, failuresAccessor):
fail_list = List[FailureMessageAccessor]()
fail_acc_list = failuresAccessor.GetFailureMessages().GetEnumerator()
for failure in fail_acc_list:
failure_id = failure.GetFailureDefinitionId()
failure_severity = failure.GetSeverity()
failure_type = BuiltInFailures.RoomFailures.RoomNotEnclosed
if failure_id == failure_type:
print("{0} with id: {1} of type: RoomNotEnclosed removed!".format(failure_severity, failure_id.Guid))
failuresAccessor.DeleteWarning(failure)
return FailureProcessingResult.Continue
# "Start" the transaction
示例12: DrawForeground
# 需要导入模块: from System.Collections import Generic [as 别名]
# 或者: from System.Collections.Generic import List [as 别名]
def DrawForeground(self, e):
try:
if self.color:
draw = e.Display.DrawPoint
if self.size:
for xyz, size, color in zip(self.points, self.size, self.color):
draw(Point3d(*xyz), Simple, size, color)
else:
for xyz, color in zip(self.points, self.color):
draw(Point3d(*xyz), Simple, self._default_size, color)
elif self.size:
draw = e.Display.DrawPoint
if self.color:
for xyz, size, color in zip(self.points, self.size, self.color):
draw(Point3d(*xyz), Simple, size, color)
else:
for xyz, size in zip(self.points, self.size):
draw(Point3d(*xyz), Simple, size, self._default_color)
else:
points = List[Point3d](len(self.points))
for xyz in self.points:
points.Add(Point3d(*xyz))
e.Display.DrawPoints(points, Simple, self._default_size, self._default_color)
except Exception as e:
print(e)
# ==============================================================================
# Main
# ==============================================================================
示例13: DrawForeground
# 需要导入模块: from System.Collections import Generic [as 别名]
# 或者: from System.Collections.Generic import List [as 别名]
def DrawForeground(self, e):
try:
if self.color:
draw = e.Display.DrawLine
if self.thickness:
for i, (start, end) in enumerate(self.lines):
draw(Point3d(*start), Point3d(*end), self.color[i], self.thickness[i])
else:
for i, (start, end) in enumerate(self.lines):
draw(Point3d(*start), Point3d(*end), self.color[i], self._default_thickness)
elif self.thickness:
draw = e.Display.DrawLine
if self.color:
for i, (start, end) in enumerate(self.lines):
draw(Point3d(*start), Point3d(*end), self.color[i], self.thickness[i])
else:
for i, (start, end) in enumerate(self.lines):
draw(Point3d(*start), Point3d(*end), self._default_color, self.thickness[i])
else:
lines = List[Line](len(self.lines))
for start, end in self.lines:
lines.Add(Line(Point3d(*start), Point3d(*end)))
e.Display.DrawLines(lines, self._default_color, self._default_thickness)
except Exception as e:
print(e)
# ==============================================================================
# Main
# ==============================================================================
示例14: DrawForeground
# 需要导入模块: from System.Collections import Generic [as 别名]
# 或者: from System.Collections.Generic import List [as 别名]
def DrawForeground(self, e):
draw_line = e.Display.DrawLine
draw_lines = e.Display.DrawLines
if self.color:
if self.thickness:
for i, start, end in self.lines:
draw_line(start, end, self.color[i], self.thickness[i])
else:
for i, start, end in self.lines:
draw_line(start, end, self.color[i], self._default_thickness)
elif self.thickness:
if self.color:
for i, start, end in self.lines:
draw_line(start, end, self.color[i], self.thickness[i])
else:
for i, start, end in self.lines:
draw_line(start, end, self._default_color, self.thickness[i])
else:
lines = List[Line](self.mesh.number_of_edges())
for i, start, end in self.lines:
lines.Add(Line(start, end))
draw_lines(lines, self._default_color, self._default_thickness)
# ==============================================================================
# Main
# ==============================================================================
示例15: test_safe_length_returns_length_for_net_list
# 需要导入模块: from System.Collections import Generic [as 别名]
# 或者: from System.Collections.Generic import List [as 别名]
def test_safe_length_returns_length_for_net_list():
a = List[Int32]()
a.Add(1)
a.Add(2)
a.Add(6)
n = safe_length(a)
assert n==3