Instruction
stringlengths
362
7.83k
output_code
stringlengths
1
945
Next line prediction: <|code_start|># Purpose: blocks section # Created: 09.08.2012, taken from my package ezdxf # Copyright (C) 2011, Manfred Moitzi # License: MIT-License from __future__ import unicode_literals __author__ = "mozman <mozman@gmx.at>" class BlocksSection(object): name = 'blocks' def __init__(self): self._blocks = dict() @staticmethod def from_tags(tags, drawing): blocks_section = BlocksSection() if drawing.grab_blocks: blocks_section._build(tags) return blocks_section def _build(self, tags): if len(tags) == 3: # empty block section return groups = list() <|code_end|> . Use current file imports: (from itertools import islice from .tags import TagGroups from .entitysection import build_entities ) and context including class names, function names, or small code snippets from other files: # Path: dxfgrabber/tags.py # class TagGroups(list): # """ # Group of tags starting with a SplitTag and ending before the next SplitTag. # # A SplitTag is a tag with code == splitcode, like (0, 'SECTION') for splitcode=0. # # """ # def __init__(self, tags, split_code=0): # super(TagGroups, self).__init__() # self._build_groups(tags, split_code) # # def _build_groups(self, tags, splitcode): # def append(tag): # first do nothing, skip tags in front of the first split tag # pass # group = None # for tag in tags: # has to work with iterators/generators # if tag.code == splitcode: # if group is not None: # self.append(group) # group = Tags([tag]) # append = group.append # redefine append: add tags to this group # else: # append(tag) # if group is not None: # self.append(group) # # def get_name(self, index): # return self[index][0].value # # @staticmethod # def from_text(text, split_code=0): # return TagGroups(Tags.from_text(text), split_code) # # Path: dxfgrabber/entitysection.py # def build_entities(tag_groups): # def build_entity(group): # try: # entity = entity_factory(Tags(group)) # except KeyError: # entity = None # ignore unsupported entities # return entity # # entities = list() # collector = None # for group in tag_groups: # entity = build_entity(group) # if entity is not None: # if collector: # if entity.dxftype == 'SEQEND': # collector.stop() # entities.append(collector.entity) # collector = None # else: # collector.append(entity) # elif entity.dxftype in ('POLYLINE', 'POLYFACE', 'POLYMESH'): # collector = _Collector(entity) # elif entity.dxftype == 'INSERT' and entity.attribsfollow: # collector = _Collector(entity) # else: # entities.append(entity) # return entities . Output only the next line.
for group in TagGroups(islice(tags, 2, len(tags)-1)):
Predict the next line for this snippet: <|code_start|># Purpose: blocks section # Created: 09.08.2012, taken from my package ezdxf # Copyright (C) 2011, Manfred Moitzi # License: MIT-License from __future__ import unicode_literals __author__ = "mozman <mozman@gmx.at>" class BlocksSection(object): name = 'blocks' def __init__(self): self._blocks = dict() @staticmethod def from_tags(tags, drawing): blocks_section = BlocksSection() if drawing.grab_blocks: blocks_section._build(tags) return blocks_section def _build(self, tags): if len(tags) == 3: # empty block section return groups = list() for group in TagGroups(islice(tags, 2, len(tags)-1)): groups.append(group) if group[0].value == 'ENDBLK': <|code_end|> with the help of current file imports: from itertools import islice from .tags import TagGroups from .entitysection import build_entities and context from other files: # Path: dxfgrabber/tags.py # class TagGroups(list): # """ # Group of tags starting with a SplitTag and ending before the next SplitTag. # # A SplitTag is a tag with code == splitcode, like (0, 'SECTION') for splitcode=0. # # """ # def __init__(self, tags, split_code=0): # super(TagGroups, self).__init__() # self._build_groups(tags, split_code) # # def _build_groups(self, tags, splitcode): # def append(tag): # first do nothing, skip tags in front of the first split tag # pass # group = None # for tag in tags: # has to work with iterators/generators # if tag.code == splitcode: # if group is not None: # self.append(group) # group = Tags([tag]) # append = group.append # redefine append: add tags to this group # else: # append(tag) # if group is not None: # self.append(group) # # def get_name(self, index): # return self[index][0].value # # @staticmethod # def from_text(text, split_code=0): # return TagGroups(Tags.from_text(text), split_code) # # Path: dxfgrabber/entitysection.py # def build_entities(tag_groups): # def build_entity(group): # try: # entity = entity_factory(Tags(group)) # except KeyError: # entity = None # ignore unsupported entities # return entity # # entities = list() # collector = None # for group in tag_groups: # entity = build_entity(group) # if entity is not None: # if collector: # if entity.dxftype == 'SEQEND': # collector.stop() # entities.append(collector.entity) # collector = None # else: # collector.append(entity) # elif entity.dxftype in ('POLYLINE', 'POLYFACE', 'POLYMESH'): # collector = _Collector(entity) # elif entity.dxftype == 'INSERT' and entity.attribsfollow: # collector = _Collector(entity) # else: # entities.append(entity) # return entities , which may contain function names, class names, or code. Output only the next line.
entities = build_entities(groups)
Using the snippet: <|code_start|> ole = Import_IPT.checkVersion(filename) if (ole): if (Import_IPT.read(ole)): return Import_IPT elif (ext == '.ipn'): ole = Import_IPT.checkVersion(filename) if (ole): if (Import_IPT.read(ole)): return Import_IPT elif (ext == '.idw'): ole = Import_IPT.checkVersion(filename) if (ole): if (Import_IPT.read(ole)): return Import_IPT elif (ext == '.f3d'): if (importerF3D.read(filename)): return importerF3D return None def isFileValid(filename): if (not os.path.exists(os.path.abspath(filename))): logError(u"File doesn't exists (%s)!", os.path.abspath(filename)) return False if (not os.path.isfile(filename)): logError(u"Can't import folders!") return False if (filename.split(".")[-1].lower() in ("ipt", "iam", "ipn", "idw")): if (not isOleFile(filename)): logError(u"ERROR> '%s' is not a valid Autodesk Inventor file!", filename) return False <|code_end|> , determine the next line of code. You have imports: import os, sys, FreeCAD, FreeCADGui, importerSAT, importerDXF, Import_IPT, importerF3D import Acis, importerClasses from importerUtils import canImport, logInfo, logWarning, logError, logAlways, getAuthor, getComment, getLastModifiedBy, setThumbnail from olefile import isOleFile from importerFreeCAD import createGroup from pivy import coin and context (class names, function names, or code) available: # Path: importerUtils.py # def canImport(): # global _can_import # return _can_import # # def logInfo(msg, *args): # if (__prmPrefOW__.GetBool("checkLogging", False)): _log("logInfo", Console.PrintMessage, msg, args) # # def logWarning(msg, *args): # if (__prmPrefOW__.GetBool("checkWarning", False)): _log("logWarning", Console.PrintWarning, msg, args) # # def logError(msg, *args): # if (__prmPrefOW__.GetBool("checkError", True)): _log("logError", Console.PrintError, msg, args) # # def logAlways(msg, *args): # _log("logAlways", Console.PrintMessage, msg, args) # # def getAuthor(): # return _author # # def getComment(): # global _comment # return _comment # # def getLastModifiedBy(): # global _lastModifiedBy # return _lastModifiedBy # # def setThumbnail(thumbnail): # global _thumbnail # _thumbnail = thumbnail # return # # Path: importerFreeCAD.py # def createGroup(name): # return newObject('App::DocumentObjectGroup', name) . Output only the next line.
return canImport()
Given snippet: <|code_start|> if (FreeCAD.GuiUp): # adjust camara position and orientation g = FreeCADGui.getDocument(doc.Name) v = g.ActiveView c = v.getCameraNode() p = coin.SbVec3f(1, 1, 1) o = coin.SbVec3f(0, 0, 0) u = coin.SbVec3f(0, 1, 0) c.position.setValue(p) c.pointAt( o, u ) FreeCADGui.SendMsgToActiveView("ViewFit") def insert(filename, docname, skip = [], only = [], root = None): ''' opens an Autodesk Inventor file in the current document ''' doc = FreeCAD.listDocuments().get(docname) if (doc): if (isFileValid(filename)): logAlways(u"Importing: %s", filename) reader = read(filename) if (reader is not None): name = os.path.splitext(os.path.basename(filename))[0] name = decode(name) group = insertGroup(name) reader.create3dModel(group, doc) releaseMemory() FreeCADGui.SendMsgToActiveView("ViewFit") else: _open(filename, skip, only, root) <|code_end|> , continue by predicting the next line. Consider current file imports: import os, sys, FreeCAD, FreeCADGui, importerSAT, importerDXF, Import_IPT, importerF3D import Acis, importerClasses from importerUtils import canImport, logInfo, logWarning, logError, logAlways, getAuthor, getComment, getLastModifiedBy, setThumbnail from olefile import isOleFile from importerFreeCAD import createGroup from pivy import coin and context: # Path: importerUtils.py # def canImport(): # global _can_import # return _can_import # # def logInfo(msg, *args): # if (__prmPrefOW__.GetBool("checkLogging", False)): _log("logInfo", Console.PrintMessage, msg, args) # # def logWarning(msg, *args): # if (__prmPrefOW__.GetBool("checkWarning", False)): _log("logWarning", Console.PrintWarning, msg, args) # # def logError(msg, *args): # if (__prmPrefOW__.GetBool("checkError", True)): _log("logError", Console.PrintError, msg, args) # # def logAlways(msg, *args): # _log("logAlways", Console.PrintMessage, msg, args) # # def getAuthor(): # return _author # # def getComment(): # global _comment # return _comment # # def getLastModifiedBy(): # global _lastModifiedBy # return _lastModifiedBy # # def setThumbnail(thumbnail): # global _thumbnail # _thumbnail = thumbnail # return # # Path: importerFreeCAD.py # def createGroup(name): # return newObject('App::DocumentObjectGroup', name) which might include code, classes, or functions. Output only the next line.
logInfo(u"DONE!")
Using the snippet: <|code_start|># -*- coding: utf-8 -*- ''' importer.py: Collection of 3D Mesh importers ''' __author__ = "Jens M. Plonka" __copyright__ = 'Copyright 2018, Germany' __url__ = "https://www.github.com/jmplonka/InventorLoader" def decode(name): "decodes encoded strings" decodedName = name try: decodedName = name.encode(sys.getfilesystemencoding()).decode("utf8") except: <|code_end|> , determine the next line of code. You have imports: import os, sys, FreeCAD, FreeCADGui, importerSAT, importerDXF, Import_IPT, importerF3D import Acis, importerClasses from importerUtils import canImport, logInfo, logWarning, logError, logAlways, getAuthor, getComment, getLastModifiedBy, setThumbnail from olefile import isOleFile from importerFreeCAD import createGroup from pivy import coin and context (class names, function names, or code) available: # Path: importerUtils.py # def canImport(): # global _can_import # return _can_import # # def logInfo(msg, *args): # if (__prmPrefOW__.GetBool("checkLogging", False)): _log("logInfo", Console.PrintMessage, msg, args) # # def logWarning(msg, *args): # if (__prmPrefOW__.GetBool("checkWarning", False)): _log("logWarning", Console.PrintWarning, msg, args) # # def logError(msg, *args): # if (__prmPrefOW__.GetBool("checkError", True)): _log("logError", Console.PrintError, msg, args) # # def logAlways(msg, *args): # _log("logAlways", Console.PrintMessage, msg, args) # # def getAuthor(): # return _author # # def getComment(): # global _comment # return _comment # # def getLastModifiedBy(): # global _lastModifiedBy # return _lastModifiedBy # # def setThumbnail(thumbnail): # global _thumbnail # _thumbnail = thumbnail # return # # Path: importerFreeCAD.py # def createGroup(name): # return newObject('App::DocumentObjectGroup', name) . Output only the next line.
logWarning(" Couldn't determine character encoding for filename - using unencoded!\n")
Predict the next line for this snippet: <|code_start|> if (importerSAT.readText(filename)): return importerSAT elif (ext in ['.sab', '.smb', '.smbh']): if (importerSAT.readBinary(filename)): return importerSAT elif (ext == '.dxf'): if (importerDXF.read(filename)): return importerDXF elif (ext == '.iam'): ole = Import_IPT.checkVersion(filename) if (ole): if (Import_IPT.read(ole)): return Import_IPT elif (ext == '.ipn'): ole = Import_IPT.checkVersion(filename) if (ole): if (Import_IPT.read(ole)): return Import_IPT elif (ext == '.idw'): ole = Import_IPT.checkVersion(filename) if (ole): if (Import_IPT.read(ole)): return Import_IPT elif (ext == '.f3d'): if (importerF3D.read(filename)): return importerF3D return None def isFileValid(filename): if (not os.path.exists(os.path.abspath(filename))): <|code_end|> with the help of current file imports: import os, sys, FreeCAD, FreeCADGui, importerSAT, importerDXF, Import_IPT, importerF3D import Acis, importerClasses from importerUtils import canImport, logInfo, logWarning, logError, logAlways, getAuthor, getComment, getLastModifiedBy, setThumbnail from olefile import isOleFile from importerFreeCAD import createGroup from pivy import coin and context from other files: # Path: importerUtils.py # def canImport(): # global _can_import # return _can_import # # def logInfo(msg, *args): # if (__prmPrefOW__.GetBool("checkLogging", False)): _log("logInfo", Console.PrintMessage, msg, args) # # def logWarning(msg, *args): # if (__prmPrefOW__.GetBool("checkWarning", False)): _log("logWarning", Console.PrintWarning, msg, args) # # def logError(msg, *args): # if (__prmPrefOW__.GetBool("checkError", True)): _log("logError", Console.PrintError, msg, args) # # def logAlways(msg, *args): # _log("logAlways", Console.PrintMessage, msg, args) # # def getAuthor(): # return _author # # def getComment(): # global _comment # return _comment # # def getLastModifiedBy(): # global _lastModifiedBy # return _lastModifiedBy # # def setThumbnail(thumbnail): # global _thumbnail # _thumbnail = thumbnail # return # # Path: importerFreeCAD.py # def createGroup(name): # return newObject('App::DocumentObjectGroup', name) , which may contain function names, class names, or code. Output only the next line.
logError(u"File doesn't exists (%s)!", os.path.abspath(filename))
Continue the code snippet: <|code_start|> if (not isOleFile(filename)): logError(u"ERROR> '%s' is not a valid Autodesk Inventor file!", filename) return False return canImport() def releaseMemory(): setThumbnail(None) Acis.releaseMemory() importerClasses.releaseModel() def adjustView(doc): if (FreeCAD.GuiUp): # adjust camara position and orientation g = FreeCADGui.getDocument(doc.Name) v = g.ActiveView c = v.getCameraNode() p = coin.SbVec3f(1, 1, 1) o = coin.SbVec3f(0, 0, 0) u = coin.SbVec3f(0, 1, 0) c.position.setValue(p) c.pointAt( o, u ) FreeCADGui.SendMsgToActiveView("ViewFit") def insert(filename, docname, skip = [], only = [], root = None): ''' opens an Autodesk Inventor file in the current document ''' doc = FreeCAD.listDocuments().get(docname) if (doc): if (isFileValid(filename)): <|code_end|> . Use current file imports: import os, sys, FreeCAD, FreeCADGui, importerSAT, importerDXF, Import_IPT, importerF3D import Acis, importerClasses from importerUtils import canImport, logInfo, logWarning, logError, logAlways, getAuthor, getComment, getLastModifiedBy, setThumbnail from olefile import isOleFile from importerFreeCAD import createGroup from pivy import coin and context (classes, functions, or code) from other files: # Path: importerUtils.py # def canImport(): # global _can_import # return _can_import # # def logInfo(msg, *args): # if (__prmPrefOW__.GetBool("checkLogging", False)): _log("logInfo", Console.PrintMessage, msg, args) # # def logWarning(msg, *args): # if (__prmPrefOW__.GetBool("checkWarning", False)): _log("logWarning", Console.PrintWarning, msg, args) # # def logError(msg, *args): # if (__prmPrefOW__.GetBool("checkError", True)): _log("logError", Console.PrintError, msg, args) # # def logAlways(msg, *args): # _log("logAlways", Console.PrintMessage, msg, args) # # def getAuthor(): # return _author # # def getComment(): # global _comment # return _comment # # def getLastModifiedBy(): # global _lastModifiedBy # return _lastModifiedBy # # def setThumbnail(thumbnail): # global _thumbnail # _thumbnail = thumbnail # return # # Path: importerFreeCAD.py # def createGroup(name): # return newObject('App::DocumentObjectGroup', name) . Output only the next line.
logAlways(u"Importing: %s", filename)
Predict the next line after this snippet: <|code_start|> c.pointAt( o, u ) FreeCADGui.SendMsgToActiveView("ViewFit") def insert(filename, docname, skip = [], only = [], root = None): ''' opens an Autodesk Inventor file in the current document ''' doc = FreeCAD.listDocuments().get(docname) if (doc): if (isFileValid(filename)): logAlways(u"Importing: %s", filename) reader = read(filename) if (reader is not None): name = os.path.splitext(os.path.basename(filename))[0] name = decode(name) group = insertGroup(name) reader.create3dModel(group, doc) releaseMemory() FreeCADGui.SendMsgToActiveView("ViewFit") else: _open(filename, skip, only, root) logInfo(u"DONE!") return def _open(filename, skip = [], only = [], root = None): reader = read(filename) if (reader is not None): name = os.path.splitext(os.path.basename(filename))[0] doc = FreeCAD.newDocument(decode(name)) doc.Label = name <|code_end|> using the current file's imports: import os, sys, FreeCAD, FreeCADGui, importerSAT, importerDXF, Import_IPT, importerF3D import Acis, importerClasses from importerUtils import canImport, logInfo, logWarning, logError, logAlways, getAuthor, getComment, getLastModifiedBy, setThumbnail from olefile import isOleFile from importerFreeCAD import createGroup from pivy import coin and any relevant context from other files: # Path: importerUtils.py # def canImport(): # global _can_import # return _can_import # # def logInfo(msg, *args): # if (__prmPrefOW__.GetBool("checkLogging", False)): _log("logInfo", Console.PrintMessage, msg, args) # # def logWarning(msg, *args): # if (__prmPrefOW__.GetBool("checkWarning", False)): _log("logWarning", Console.PrintWarning, msg, args) # # def logError(msg, *args): # if (__prmPrefOW__.GetBool("checkError", True)): _log("logError", Console.PrintError, msg, args) # # def logAlways(msg, *args): # _log("logAlways", Console.PrintMessage, msg, args) # # def getAuthor(): # return _author # # def getComment(): # global _comment # return _comment # # def getLastModifiedBy(): # global _lastModifiedBy # return _lastModifiedBy # # def setThumbnail(thumbnail): # global _thumbnail # _thumbnail = thumbnail # return # # Path: importerFreeCAD.py # def createGroup(name): # return newObject('App::DocumentObjectGroup', name) . Output only the next line.
doc.CreatedBy = getAuthor()
Given the code snippet: <|code_start|> def insert(filename, docname, skip = [], only = [], root = None): ''' opens an Autodesk Inventor file in the current document ''' doc = FreeCAD.listDocuments().get(docname) if (doc): if (isFileValid(filename)): logAlways(u"Importing: %s", filename) reader = read(filename) if (reader is not None): name = os.path.splitext(os.path.basename(filename))[0] name = decode(name) group = insertGroup(name) reader.create3dModel(group, doc) releaseMemory() FreeCADGui.SendMsgToActiveView("ViewFit") else: _open(filename, skip, only, root) logInfo(u"DONE!") return def _open(filename, skip = [], only = [], root = None): reader = read(filename) if (reader is not None): name = os.path.splitext(os.path.basename(filename))[0] doc = FreeCAD.newDocument(decode(name)) doc.Label = name doc.CreatedBy = getAuthor() doc.LastModifiedBy = getLastModifiedBy() <|code_end|> , generate the next line using the imports in this file: import os, sys, FreeCAD, FreeCADGui, importerSAT, importerDXF, Import_IPT, importerF3D import Acis, importerClasses from importerUtils import canImport, logInfo, logWarning, logError, logAlways, getAuthor, getComment, getLastModifiedBy, setThumbnail from olefile import isOleFile from importerFreeCAD import createGroup from pivy import coin and context (functions, classes, or occasionally code) from other files: # Path: importerUtils.py # def canImport(): # global _can_import # return _can_import # # def logInfo(msg, *args): # if (__prmPrefOW__.GetBool("checkLogging", False)): _log("logInfo", Console.PrintMessage, msg, args) # # def logWarning(msg, *args): # if (__prmPrefOW__.GetBool("checkWarning", False)): _log("logWarning", Console.PrintWarning, msg, args) # # def logError(msg, *args): # if (__prmPrefOW__.GetBool("checkError", True)): _log("logError", Console.PrintError, msg, args) # # def logAlways(msg, *args): # _log("logAlways", Console.PrintMessage, msg, args) # # def getAuthor(): # return _author # # def getComment(): # global _comment # return _comment # # def getLastModifiedBy(): # global _lastModifiedBy # return _lastModifiedBy # # def setThumbnail(thumbnail): # global _thumbnail # _thumbnail = thumbnail # return # # Path: importerFreeCAD.py # def createGroup(name): # return newObject('App::DocumentObjectGroup', name) . Output only the next line.
doc.Comment = getComment()
Given snippet: <|code_start|> FreeCADGui.SendMsgToActiveView("ViewFit") def insert(filename, docname, skip = [], only = [], root = None): ''' opens an Autodesk Inventor file in the current document ''' doc = FreeCAD.listDocuments().get(docname) if (doc): if (isFileValid(filename)): logAlways(u"Importing: %s", filename) reader = read(filename) if (reader is not None): name = os.path.splitext(os.path.basename(filename))[0] name = decode(name) group = insertGroup(name) reader.create3dModel(group, doc) releaseMemory() FreeCADGui.SendMsgToActiveView("ViewFit") else: _open(filename, skip, only, root) logInfo(u"DONE!") return def _open(filename, skip = [], only = [], root = None): reader = read(filename) if (reader is not None): name = os.path.splitext(os.path.basename(filename))[0] doc = FreeCAD.newDocument(decode(name)) doc.Label = name doc.CreatedBy = getAuthor() <|code_end|> , continue by predicting the next line. Consider current file imports: import os, sys, FreeCAD, FreeCADGui, importerSAT, importerDXF, Import_IPT, importerF3D import Acis, importerClasses from importerUtils import canImport, logInfo, logWarning, logError, logAlways, getAuthor, getComment, getLastModifiedBy, setThumbnail from olefile import isOleFile from importerFreeCAD import createGroup from pivy import coin and context: # Path: importerUtils.py # def canImport(): # global _can_import # return _can_import # # def logInfo(msg, *args): # if (__prmPrefOW__.GetBool("checkLogging", False)): _log("logInfo", Console.PrintMessage, msg, args) # # def logWarning(msg, *args): # if (__prmPrefOW__.GetBool("checkWarning", False)): _log("logWarning", Console.PrintWarning, msg, args) # # def logError(msg, *args): # if (__prmPrefOW__.GetBool("checkError", True)): _log("logError", Console.PrintError, msg, args) # # def logAlways(msg, *args): # _log("logAlways", Console.PrintMessage, msg, args) # # def getAuthor(): # return _author # # def getComment(): # global _comment # return _comment # # def getLastModifiedBy(): # global _lastModifiedBy # return _lastModifiedBy # # def setThumbnail(thumbnail): # global _thumbnail # _thumbnail = thumbnail # return # # Path: importerFreeCAD.py # def createGroup(name): # return newObject('App::DocumentObjectGroup', name) which might include code, classes, or functions. Output only the next line.
doc.LastModifiedBy = getLastModifiedBy()
Using the snippet: <|code_start|># -*- coding: utf-8 -*- ''' importer.py: Collection of 3D Mesh importers ''' __author__ = "Jens M. Plonka" __copyright__ = 'Copyright 2018, Germany' __url__ = "https://www.github.com/jmplonka/InventorLoader" def decode(name): "decodes encoded strings" decodedName = name try: decodedName = name.encode(sys.getfilesystemencoding()).decode("utf8") except: logWarning(" Couldn't determine character encoding for filename - using unencoded!\n") return decodedName def insertGroup(filename): grpName = os.path.splitext(os.path.basename(filename))[0] #There's a problem with adding groups starting with numbers! root = createGroup('_%s' %(grpName)) root.Label = grpName return root def read(filename): <|code_end|> , determine the next line of code. You have imports: import os, sys, FreeCAD, FreeCADGui, importerSAT, importerDXF, Import_IPT, importerF3D import Acis, importerClasses from importerUtils import canImport, logInfo, logWarning, logError, logAlways, getAuthor, getComment, getLastModifiedBy, setThumbnail from olefile import isOleFile from importerFreeCAD import createGroup from pivy import coin and context (class names, function names, or code) available: # Path: importerUtils.py # def canImport(): # global _can_import # return _can_import # # def logInfo(msg, *args): # if (__prmPrefOW__.GetBool("checkLogging", False)): _log("logInfo", Console.PrintMessage, msg, args) # # def logWarning(msg, *args): # if (__prmPrefOW__.GetBool("checkWarning", False)): _log("logWarning", Console.PrintWarning, msg, args) # # def logError(msg, *args): # if (__prmPrefOW__.GetBool("checkError", True)): _log("logError", Console.PrintError, msg, args) # # def logAlways(msg, *args): # _log("logAlways", Console.PrintMessage, msg, args) # # def getAuthor(): # return _author # # def getComment(): # global _comment # return _comment # # def getLastModifiedBy(): # global _lastModifiedBy # return _lastModifiedBy # # def setThumbnail(thumbnail): # global _thumbnail # _thumbnail = thumbnail # return # # Path: importerFreeCAD.py # def createGroup(name): # return newObject('App::DocumentObjectGroup', name) . Output only the next line.
setThumbnail(None)
Given the following code snippet before the placeholder: <|code_start|># -*- coding: utf-8 -*- ''' importer.py: Collection of 3D Mesh importers ''' __author__ = "Jens M. Plonka" __copyright__ = 'Copyright 2018, Germany' __url__ = "https://www.github.com/jmplonka/InventorLoader" def decode(name): "decodes encoded strings" decodedName = name try: decodedName = name.encode(sys.getfilesystemencoding()).decode("utf8") except: logWarning(" Couldn't determine character encoding for filename - using unencoded!\n") return decodedName def insertGroup(filename): grpName = os.path.splitext(os.path.basename(filename))[0] #There's a problem with adding groups starting with numbers! <|code_end|> , predict the next line using imports from the current file: import os, sys, FreeCAD, FreeCADGui, importerSAT, importerDXF, Import_IPT, importerF3D import Acis, importerClasses from importerUtils import canImport, logInfo, logWarning, logError, logAlways, getAuthor, getComment, getLastModifiedBy, setThumbnail from olefile import isOleFile from importerFreeCAD import createGroup from pivy import coin and context including class names, function names, and sometimes code from other files: # Path: importerUtils.py # def canImport(): # global _can_import # return _can_import # # def logInfo(msg, *args): # if (__prmPrefOW__.GetBool("checkLogging", False)): _log("logInfo", Console.PrintMessage, msg, args) # # def logWarning(msg, *args): # if (__prmPrefOW__.GetBool("checkWarning", False)): _log("logWarning", Console.PrintWarning, msg, args) # # def logError(msg, *args): # if (__prmPrefOW__.GetBool("checkError", True)): _log("logError", Console.PrintError, msg, args) # # def logAlways(msg, *args): # _log("logAlways", Console.PrintMessage, msg, args) # # def getAuthor(): # return _author # # def getComment(): # global _comment # return _comment # # def getLastModifiedBy(): # global _lastModifiedBy # return _lastModifiedBy # # def setThumbnail(thumbnail): # global _thumbnail # _thumbnail = thumbnail # return # # Path: importerFreeCAD.py # def createGroup(name): # return newObject('App::DocumentObjectGroup', name) . Output only the next line.
root = createGroup('_%s' %(grpName))
Given the code snippet: <|code_start|># Purpose: handle tables section # Created: 21.07.2012, taken from my ezdxf project # Copyright (C) 2012, Manfred Moitzi # License: MIT License from __future__ import unicode_literals __author__ = "mozman <mozman@gmx.at>" TABLENAMES = { 'layer' : 'layers', 'ltype' : 'linetypes', 'appid' : 'appids', 'dimstyle' : 'dimstyles', 'style' : 'styles', 'ucs' : 'ucs', 'view' : 'views', 'vport' : 'viewports', 'block_record': 'block_records', } # support for further tables types are possible TABLESMAP = { <|code_end|> , generate the next line using the imports in this file: from .defaultchunk import iterchunks, DefaultChunk from .layers import LayerTable from .styles import StyleTable from .linetypes import LinetypeTable and context (functions, classes, or occasionally code) from other files: # Path: dxfgrabber/layers.py # class LayerTable(Table): # name = 'layers' # # @staticmethod # def from_tags(tags): # layers = LayerTable() # for entrytags in layers.entry_tags(tags): # layer = Layer(entrytags) # layers._table_entries[layer.name] = layer # return layers . Output only the next line.
'LAYER': LayerTable,
Predict the next line after this snippet: <|code_start|> class EntitySection(object): name = 'entities' def __init__(self): self._entities = list() @classmethod def from_tags(cls, tags, drawing): entity_section = cls() entity_section._build(tags) return entity_section def get_entities(self): return self._entities def __len__(self): return len(self._entities) def __iter__(self): return iter(self._entities) def __getitem__(self, index): return self._entities[index] def _build(self, tags): if len(tags) == 3: # empty entities section return <|code_end|> using the current file's imports: from itertools import islice from .tags import TagGroups, DXFStructureError from .tags import Tags from .dxfentities import entity_factory and any relevant context from other files: # Path: dxfgrabber/tags.py # class TagGroups(list): # """ # Group of tags starting with a SplitTag and ending before the next SplitTag. # # A SplitTag is a tag with code == splitcode, like (0, 'SECTION') for splitcode=0. # # """ # def __init__(self, tags, split_code=0): # super(TagGroups, self).__init__() # self._build_groups(tags, split_code) # # def _build_groups(self, tags, splitcode): # def append(tag): # first do nothing, skip tags in front of the first split tag # pass # group = None # for tag in tags: # has to work with iterators/generators # if tag.code == splitcode: # if group is not None: # self.append(group) # group = Tags([tag]) # append = group.append # redefine append: add tags to this group # else: # append(tag) # if group is not None: # self.append(group) # # def get_name(self, index): # return self[index][0].value # # @staticmethod # def from_text(text, split_code=0): # return TagGroups(Tags.from_text(text), split_code) # # class DXFStructureError(Exception): # pass # # Path: dxfgrabber/tags.py # class Tags(list): # """ DXFTag() chunk as flat list. """ # def find_all(self, code): # """ Returns a list of DXFTag(code, ...). """ # return [tag for tag in self if tag.code == code] # # def tag_index(self, code, start=0, end=None): # """Return first index of DXFTag(code, value). # """ # if end is None: # end = len(self) # index = start # while index < end: # if self[index].code == code: # return index # index += 1 # raise ValueError(code) # # def get_value(self, code): # for tag in self: # if tag.code == code: # return tag.value # raise ValueError(code) # # @staticmethod # def from_text(text): # return Tags(string_tagger(text)) # # def get_type(self): # return self.__getitem__(0).value # # def plain_tags(self): # yield no app data and no xdata # is_app_data = False # for tag in self: # if tag.code >= 1000: # skip xdata # continue # if tag.code == APP_DATA_MARKER: # if is_app_data: # tag.value == '}' # is_app_data = False # end of app data # else: # value == '{APPID' # is_app_data = True # start of app data # continue # if not is_app_data: # yield tag # # def xdata(self): # index = 0 # end = len(self) # while index < end: # if self[index].code > 999: # all xdata tag codes are >= 1000 # return self[index:] # xdata is always at the end of the DXF entity # index += 1 # return [] # # def app_data(self): # app_data = {} # app_tags = None # for tag in self: # if tag.code == APP_DATA_MARKER: # if tag.value == '}': # end of app data # app_tags.append(tag) # app_data[app_tags[0].value] = app_tags # app_tags = None # else: # app_tags = [tag] # else: # if app_tags is not None: # collection app data # app_tags.append(tag) # return app_data # # def subclasses(self): # classes = {} # name = 'noname' # tags = [] # for tag in self.plain_tags(): # if tag.code == SUBCLASS_MARKER: # classes[name] = tags # tags = [] # name = tag.value # else: # tags.append(tag) # classes[name] = tags # return classes # # def get_subclass(self, name): # classes = self.subclasses() # return classes.get(name, 'noname') # # Path: dxfgrabber/dxfentities.py # def entity_factory(tags): # dxftype = tags.get_type() # cls = EntityTable[dxftype] # get entity class or raise KeyError # entity = cls() # call constructor # list(entity.setup_attributes(tags)) # setup dxf attributes - chain of generators # return entity . Output only the next line.
groups = TagGroups(islice(tags, 2, len(tags)-1))
Given snippet: <|code_start|> @classmethod def from_tags(cls, tags, drawing): entity_section = cls() entity_section._build(tags) return entity_section def get_entities(self): return self._entities def __len__(self): return len(self._entities) def __iter__(self): return iter(self._entities) def __getitem__(self, index): return self._entities[index] def _build(self, tags): if len(tags) == 3: # empty entities section return groups = TagGroups(islice(tags, 2, len(tags)-1)) self._entities = build_entities(groups) class ObjectsSection(EntitySection): name = 'objects' def build_entities(tag_groups): def build_entity(group): try: <|code_end|> , continue by predicting the next line. Consider current file imports: from itertools import islice from .tags import TagGroups, DXFStructureError from .tags import Tags from .dxfentities import entity_factory and context: # Path: dxfgrabber/tags.py # class TagGroups(list): # """ # Group of tags starting with a SplitTag and ending before the next SplitTag. # # A SplitTag is a tag with code == splitcode, like (0, 'SECTION') for splitcode=0. # # """ # def __init__(self, tags, split_code=0): # super(TagGroups, self).__init__() # self._build_groups(tags, split_code) # # def _build_groups(self, tags, splitcode): # def append(tag): # first do nothing, skip tags in front of the first split tag # pass # group = None # for tag in tags: # has to work with iterators/generators # if tag.code == splitcode: # if group is not None: # self.append(group) # group = Tags([tag]) # append = group.append # redefine append: add tags to this group # else: # append(tag) # if group is not None: # self.append(group) # # def get_name(self, index): # return self[index][0].value # # @staticmethod # def from_text(text, split_code=0): # return TagGroups(Tags.from_text(text), split_code) # # class DXFStructureError(Exception): # pass # # Path: dxfgrabber/tags.py # class Tags(list): # """ DXFTag() chunk as flat list. """ # def find_all(self, code): # """ Returns a list of DXFTag(code, ...). """ # return [tag for tag in self if tag.code == code] # # def tag_index(self, code, start=0, end=None): # """Return first index of DXFTag(code, value). # """ # if end is None: # end = len(self) # index = start # while index < end: # if self[index].code == code: # return index # index += 1 # raise ValueError(code) # # def get_value(self, code): # for tag in self: # if tag.code == code: # return tag.value # raise ValueError(code) # # @staticmethod # def from_text(text): # return Tags(string_tagger(text)) # # def get_type(self): # return self.__getitem__(0).value # # def plain_tags(self): # yield no app data and no xdata # is_app_data = False # for tag in self: # if tag.code >= 1000: # skip xdata # continue # if tag.code == APP_DATA_MARKER: # if is_app_data: # tag.value == '}' # is_app_data = False # end of app data # else: # value == '{APPID' # is_app_data = True # start of app data # continue # if not is_app_data: # yield tag # # def xdata(self): # index = 0 # end = len(self) # while index < end: # if self[index].code > 999: # all xdata tag codes are >= 1000 # return self[index:] # xdata is always at the end of the DXF entity # index += 1 # return [] # # def app_data(self): # app_data = {} # app_tags = None # for tag in self: # if tag.code == APP_DATA_MARKER: # if tag.value == '}': # end of app data # app_tags.append(tag) # app_data[app_tags[0].value] = app_tags # app_tags = None # else: # app_tags = [tag] # else: # if app_tags is not None: # collection app data # app_tags.append(tag) # return app_data # # def subclasses(self): # classes = {} # name = 'noname' # tags = [] # for tag in self.plain_tags(): # if tag.code == SUBCLASS_MARKER: # classes[name] = tags # tags = [] # name = tag.value # else: # tags.append(tag) # classes[name] = tags # return classes # # def get_subclass(self, name): # classes = self.subclasses() # return classes.get(name, 'noname') # # Path: dxfgrabber/dxfentities.py # def entity_factory(tags): # dxftype = tags.get_type() # cls = EntityTable[dxftype] # get entity class or raise KeyError # entity = cls() # call constructor # list(entity.setup_attributes(tags)) # setup dxf attributes - chain of generators # return entity which might include code, classes, or functions. Output only the next line.
entity = entity_factory(Tags(group))
Continue the code snippet: <|code_start|> @classmethod def from_tags(cls, tags, drawing): entity_section = cls() entity_section._build(tags) return entity_section def get_entities(self): return self._entities def __len__(self): return len(self._entities) def __iter__(self): return iter(self._entities) def __getitem__(self, index): return self._entities[index] def _build(self, tags): if len(tags) == 3: # empty entities section return groups = TagGroups(islice(tags, 2, len(tags)-1)) self._entities = build_entities(groups) class ObjectsSection(EntitySection): name = 'objects' def build_entities(tag_groups): def build_entity(group): try: <|code_end|> . Use current file imports: from itertools import islice from .tags import TagGroups, DXFStructureError from .tags import Tags from .dxfentities import entity_factory and context (classes, functions, or code) from other files: # Path: dxfgrabber/tags.py # class TagGroups(list): # """ # Group of tags starting with a SplitTag and ending before the next SplitTag. # # A SplitTag is a tag with code == splitcode, like (0, 'SECTION') for splitcode=0. # # """ # def __init__(self, tags, split_code=0): # super(TagGroups, self).__init__() # self._build_groups(tags, split_code) # # def _build_groups(self, tags, splitcode): # def append(tag): # first do nothing, skip tags in front of the first split tag # pass # group = None # for tag in tags: # has to work with iterators/generators # if tag.code == splitcode: # if group is not None: # self.append(group) # group = Tags([tag]) # append = group.append # redefine append: add tags to this group # else: # append(tag) # if group is not None: # self.append(group) # # def get_name(self, index): # return self[index][0].value # # @staticmethod # def from_text(text, split_code=0): # return TagGroups(Tags.from_text(text), split_code) # # class DXFStructureError(Exception): # pass # # Path: dxfgrabber/tags.py # class Tags(list): # """ DXFTag() chunk as flat list. """ # def find_all(self, code): # """ Returns a list of DXFTag(code, ...). """ # return [tag for tag in self if tag.code == code] # # def tag_index(self, code, start=0, end=None): # """Return first index of DXFTag(code, value). # """ # if end is None: # end = len(self) # index = start # while index < end: # if self[index].code == code: # return index # index += 1 # raise ValueError(code) # # def get_value(self, code): # for tag in self: # if tag.code == code: # return tag.value # raise ValueError(code) # # @staticmethod # def from_text(text): # return Tags(string_tagger(text)) # # def get_type(self): # return self.__getitem__(0).value # # def plain_tags(self): # yield no app data and no xdata # is_app_data = False # for tag in self: # if tag.code >= 1000: # skip xdata # continue # if tag.code == APP_DATA_MARKER: # if is_app_data: # tag.value == '}' # is_app_data = False # end of app data # else: # value == '{APPID' # is_app_data = True # start of app data # continue # if not is_app_data: # yield tag # # def xdata(self): # index = 0 # end = len(self) # while index < end: # if self[index].code > 999: # all xdata tag codes are >= 1000 # return self[index:] # xdata is always at the end of the DXF entity # index += 1 # return [] # # def app_data(self): # app_data = {} # app_tags = None # for tag in self: # if tag.code == APP_DATA_MARKER: # if tag.value == '}': # end of app data # app_tags.append(tag) # app_data[app_tags[0].value] = app_tags # app_tags = None # else: # app_tags = [tag] # else: # if app_tags is not None: # collection app data # app_tags.append(tag) # return app_data # # def subclasses(self): # classes = {} # name = 'noname' # tags = [] # for tag in self.plain_tags(): # if tag.code == SUBCLASS_MARKER: # classes[name] = tags # tags = [] # name = tag.value # else: # tags.append(tag) # classes[name] = tags # return classes # # def get_subclass(self, name): # classes = self.subclasses() # return classes.get(name, 'noname') # # Path: dxfgrabber/dxfentities.py # def entity_factory(tags): # dxftype = tags.get_type() # cls = EntityTable[dxftype] # get entity class or raise KeyError # entity = cls() # call constructor # list(entity.setup_attributes(tags)) # setup dxf attributes - chain of generators # return entity . Output only the next line.
entity = entity_factory(Tags(group))
Next line prediction: <|code_start|> self.desc = desc def _getParameters(self): return super(GROUP, self)._getParameters() + [self.desc] ############################################################# # Global functions ############################################################# def export(filename, satHeader, satBodies): dt = datetime.now() # 2018-05-13T08:03:27-07:00 user = getAuthor() desc = getDescription() orga = '' proc = 'InventorImporter 0.9' auth = '' _initExport() global _scale _scale = satHeader.scale appPrtDef = APPLICATION_PROTOCOL_DEFINITION() bodies = [] for body in satBodies: body.name = filename bodies += _convertBody(body, appPrtDef) PRODUCT_RELATED_PRODUCT_CATEGORY('part', bodies) path, f = os.path.split(filename) name, x = os.path.splitext(f) <|code_end|> . Use current file imports: (from datetime import datetime from importerUtils import isEqual, getDumpFolder from FreeCAD import Vector as VEC, Placement as PLC from importerUtils import logInfo, logWarning, logError, logAlways, isEqual1D, getAuthor, getDescription, getColorDefault from importerConstants import CENTER, DIR_X, DIR_Y, DIR_Z, ENCODING_FS import traceback, inspect, os, sys, Acis, math, re, Part, io ) and context including class names, function names, or small code snippets from other files: # Path: importerUtils.py # def isEqual(a, b, e = 0.0001): # if (a is None): return isEqual(b, CENTER) # if (b is None): return isEqual(a, CENTER) # return ((a - b).Length < e) # # def getDumpFolder(): # global _dump_folder # return _dump_folder # # Path: importerUtils.py # def logInfo(msg, *args): # if (__prmPrefOW__.GetBool("checkLogging", False)): _log("logInfo", Console.PrintMessage, msg, args) # # def logWarning(msg, *args): # if (__prmPrefOW__.GetBool("checkWarning", False)): _log("logWarning", Console.PrintWarning, msg, args) # # def logError(msg, *args): # if (__prmPrefOW__.GetBool("checkError", True)): _log("logError", Console.PrintError, msg, args) # # def logAlways(msg, *args): # _log("logAlways", Console.PrintMessage, msg, args) # # def isEqual1D(a, b, e = 0.0001): # if (a is None): return isEqual1D(b, 0.0) # if (b is None): return isEqual1D(a, 0.0) # return abs(a - b) < e # # def getAuthor(): # return _author # # def getDescription(): # return _description # # def getColorDefault(): # global _colorDefault # return _colorDefault # # Path: importerConstants.py # CENTER = VEC(0, 0, 0) # # DIR_X = VEC(1, 0, 0) # # DIR_Y = VEC(0, 1, 0) # # DIR_Z = VEC(0, 0, 1) # # ENCODING_FS = 'utf8' . Output only the next line.
path = getDumpFolder().replace('\\', '/')
Using the snippet: <|code_start|> path, f = os.path.split(filename) name, x = os.path.splitext(f) path = getDumpFolder().replace('\\', '/') stepfile = "%s/%s.step" %(path, name) step = u"ISO-10303-21;\n" step += u"HEADER;\n" step += u"FILE_DESCRIPTION(('FreeCAD Model'),'2;1');\n" step += u"FILE_NAME('%s'," %(stepfile) step += u"'%s'," %(dt.strftime("%Y-%m-%dT%H:%M:%S")) if (sys.version_info.major < 3): step += u"('%s')," %(user.decode('utf8')) else: step += u"('%s')," %(user) step += u"('%s')," %(orga) step += u"'%s'," %(proc) step += u"'FreeCAD','%s');\n" %(auth) step += u"FILE_SCHEMA (('AUTOMOTIVE_DESIGN { 1 0 10303 214 1 1 1 1}'));\n" step += u"ENDSEC;\n" step += u"\n" step += u"DATA;\n" step += _exportList(_entities) step += u"ENDSEC;\n" step += u"END-ISO-10303-21;" with io.open(stepfile, 'wt', encoding="UTF-8") as stepFile: stepFile.write(step) # logAlways(u"STEP file written to '%s'.", stepfile) <|code_end|> , determine the next line of code. You have imports: from datetime import datetime from importerUtils import isEqual, getDumpFolder from FreeCAD import Vector as VEC, Placement as PLC from importerUtils import logInfo, logWarning, logError, logAlways, isEqual1D, getAuthor, getDescription, getColorDefault from importerConstants import CENTER, DIR_X, DIR_Y, DIR_Z, ENCODING_FS import traceback, inspect, os, sys, Acis, math, re, Part, io and context (class names, function names, or code) available: # Path: importerUtils.py # def isEqual(a, b, e = 0.0001): # if (a is None): return isEqual(b, CENTER) # if (b is None): return isEqual(a, CENTER) # return ((a - b).Length < e) # # def getDumpFolder(): # global _dump_folder # return _dump_folder # # Path: importerUtils.py # def logInfo(msg, *args): # if (__prmPrefOW__.GetBool("checkLogging", False)): _log("logInfo", Console.PrintMessage, msg, args) # # def logWarning(msg, *args): # if (__prmPrefOW__.GetBool("checkWarning", False)): _log("logWarning", Console.PrintWarning, msg, args) # # def logError(msg, *args): # if (__prmPrefOW__.GetBool("checkError", True)): _log("logError", Console.PrintError, msg, args) # # def logAlways(msg, *args): # _log("logAlways", Console.PrintMessage, msg, args) # # def isEqual1D(a, b, e = 0.0001): # if (a is None): return isEqual1D(b, 0.0) # if (b is None): return isEqual1D(a, 0.0) # return abs(a - b) < e # # def getAuthor(): # return _author # # def getDescription(): # return _description # # def getColorDefault(): # global _colorDefault # return _colorDefault # # Path: importerConstants.py # CENTER = VEC(0, 0, 0) # # DIR_X = VEC(1, 0, 0) # # DIR_Y = VEC(0, 1, 0) # # DIR_Z = VEC(0, 0, 1) # # ENCODING_FS = 'utf8' . Output only the next line.
logInfo(u"STEP file written to '%s'.", stepfile)
Predict the next line after this snippet: <|code_start|> torus.placement = _createAxis2Placement3D('', center, 'Origin', axis, 'center_axis', ref, 'ref_axis') if (minor < 0.0): return torus, (sense != 'forward') return torus, (sense == 'forward') def _createSurfaceFaceShape(acisFace, shape): surface = acisFace._surface.getSurface() if (isinstance(surface, Acis.SurfaceCone)): return _createSurfaceCone(surface.center, surface.axis, surface.cosine, surface.sine, surface.major, acisFace.sense) if (isinstance(surface, Acis.SurfacePlane)): return _createSurfacePlane(surface.root, surface.normal, acisFace.sense) if (isinstance(surface, Acis.SurfaceSphere)): return _createSurfaceSphere(surface.center, surface.radius, surface.pole, acisFace.sense) if (isinstance(surface, Acis.SurfaceTorus)): return _createSurfaceToroid(surface.major, surface.minor, surface.center, surface.axis, acisFace.sense) if (isinstance(shape, Part.BSplineSurface)): return _createSurfaceBSpline(shape, surface, acisFace.sense) # if (isinstance(shape, Part.Mesh)): # return _createSurfaceMesh(shape, acisFace.sense) if (isinstance(shape, Part.Cone)): return _createSurfaceCone(surface.center, surface.axis, surface.cosine, surface.sine, surface.major, acisFace.sense) if (isinstance(shape, Part.Cylinder)): return _createSurfaceCylinder(shape.Center, shape.Axis, shape.Radius, acisFace.sense) if (isinstance(shape, Part.Plane)): return _createSurfacePlane(shape.Position, shape.Axis, acisFace.sense) if (isinstance(shape, Part.Sphere)): return _createSurfaceSphere(surface.center, surface.radius, surface.pole, acisFace.sense) if (isinstance(shape, Part.SurfaceOfRevolution)): return _createSurfaceRevolution(surface.profile, surface.center, surface.axis, acisFace.sense) if (isinstance(shape, Part.Toroid)): return _createSurfaceToroid(surface.major, surface.minor, surface.center, surface.axis, acisFace.sense) <|code_end|> using the current file's imports: from datetime import datetime from importerUtils import isEqual, getDumpFolder from FreeCAD import Vector as VEC, Placement as PLC from importerUtils import logInfo, logWarning, logError, logAlways, isEqual1D, getAuthor, getDescription, getColorDefault from importerConstants import CENTER, DIR_X, DIR_Y, DIR_Z, ENCODING_FS import traceback, inspect, os, sys, Acis, math, re, Part, io and any relevant context from other files: # Path: importerUtils.py # def isEqual(a, b, e = 0.0001): # if (a is None): return isEqual(b, CENTER) # if (b is None): return isEqual(a, CENTER) # return ((a - b).Length < e) # # def getDumpFolder(): # global _dump_folder # return _dump_folder # # Path: importerUtils.py # def logInfo(msg, *args): # if (__prmPrefOW__.GetBool("checkLogging", False)): _log("logInfo", Console.PrintMessage, msg, args) # # def logWarning(msg, *args): # if (__prmPrefOW__.GetBool("checkWarning", False)): _log("logWarning", Console.PrintWarning, msg, args) # # def logError(msg, *args): # if (__prmPrefOW__.GetBool("checkError", True)): _log("logError", Console.PrintError, msg, args) # # def logAlways(msg, *args): # _log("logAlways", Console.PrintMessage, msg, args) # # def isEqual1D(a, b, e = 0.0001): # if (a is None): return isEqual1D(b, 0.0) # if (b is None): return isEqual1D(a, 0.0) # return abs(a - b) < e # # def getAuthor(): # return _author # # def getDescription(): # return _description # # def getColorDefault(): # global _colorDefault # return _colorDefault # # Path: importerConstants.py # CENTER = VEC(0, 0, 0) # # DIR_X = VEC(1, 0, 0) # # DIR_Y = VEC(0, 1, 0) # # DIR_Z = VEC(0, 0, 1) # # ENCODING_FS = 'utf8' . Output only the next line.
logWarning("Can't export surface '%s.%s'!" %(shape.__class__.__module__, shape.__class__.__name__))
Here is a snippet: <|code_start|> def getAttribute(self): l = [_obj2str(p) for p in self._getParameters()] return "%s(%s)" %(self._getClassName(), ",".join(l)) def toString(self): l = [_obj2str(p) for p in self._getParameters()] return "%s(%s)" %(self._getClassName(), ",".join(l)) def __str__(self): return self.toString() def __repr__(self): l = [_obj2str(p) for p in self._getParameters()] return u"#%d\t= %s(%s)" %(self.id, self._getClassName(), ",".join(l)) class ExportEntity(AnonymEntity): def __init__(self): super(ExportEntity, self).__init__() self.isexported = False def _getClassName(self): return self.__class__.__name__ def exportProperties(self): step = u"" variables = self._getParameters() for a in variables: try: if (isinstance(a, ReferencedEntity)): step += a.exportSTEP() elif (type(a) == list): step += _exportList_(a) elif (type(a) == tuple): step += _exportList_(a) except: <|code_end|> . Write the next line using the current file imports: from datetime import datetime from importerUtils import isEqual, getDumpFolder from FreeCAD import Vector as VEC, Placement as PLC from importerUtils import logInfo, logWarning, logError, logAlways, isEqual1D, getAuthor, getDescription, getColorDefault from importerConstants import CENTER, DIR_X, DIR_Y, DIR_Z, ENCODING_FS import traceback, inspect, os, sys, Acis, math, re, Part, io and context from other files: # Path: importerUtils.py # def isEqual(a, b, e = 0.0001): # if (a is None): return isEqual(b, CENTER) # if (b is None): return isEqual(a, CENTER) # return ((a - b).Length < e) # # def getDumpFolder(): # global _dump_folder # return _dump_folder # # Path: importerUtils.py # def logInfo(msg, *args): # if (__prmPrefOW__.GetBool("checkLogging", False)): _log("logInfo", Console.PrintMessage, msg, args) # # def logWarning(msg, *args): # if (__prmPrefOW__.GetBool("checkWarning", False)): _log("logWarning", Console.PrintWarning, msg, args) # # def logError(msg, *args): # if (__prmPrefOW__.GetBool("checkError", True)): _log("logError", Console.PrintError, msg, args) # # def logAlways(msg, *args): # _log("logAlways", Console.PrintMessage, msg, args) # # def isEqual1D(a, b, e = 0.0001): # if (a is None): return isEqual1D(b, 0.0) # if (b is None): return isEqual1D(a, 0.0) # return abs(a - b) < e # # def getAuthor(): # return _author # # def getDescription(): # return _description # # def getColorDefault(): # global _colorDefault # return _colorDefault # # Path: importerConstants.py # CENTER = VEC(0, 0, 0) # # DIR_X = VEC(1, 0, 0) # # DIR_Y = VEC(0, 1, 0) # # DIR_Z = VEC(0, 0, 1) # # ENCODING_FS = 'utf8' , which may include functions, classes, or code. Output only the next line.
logError(traceback.format_exc())
Given the code snippet: <|code_start|> except: ec = EDGE_CURVE('', p1, p2, curve, sense) _edgeCurves[key] = ec return ec def _exportList_(a): step = '' for i in a: if (isinstance(i, ExportEntity)): step += i.exportSTEP() elif (type(i) == list): step += _exportList_(i) elif (type(i) == tuple): step += _exportList_(i) return step def _createCurveComp(acisCurve): # TODO return acisCurve def _createCurveDegenerate(acisCurve): # TODO return acisCurve def _createCurveEllipse(acisCurve): global _ellipses key = '%s,%s,%s,%s' %(acisCurve.center, acisCurve.axis, acisCurve.major, acisCurve.ratio) try: circle = _ellipses[key] except: <|code_end|> , generate the next line using the imports in this file: from datetime import datetime from importerUtils import isEqual, getDumpFolder from FreeCAD import Vector as VEC, Placement as PLC from importerUtils import logInfo, logWarning, logError, logAlways, isEqual1D, getAuthor, getDescription, getColorDefault from importerConstants import CENTER, DIR_X, DIR_Y, DIR_Z, ENCODING_FS import traceback, inspect, os, sys, Acis, math, re, Part, io and context (functions, classes, or occasionally code) from other files: # Path: importerUtils.py # def isEqual(a, b, e = 0.0001): # if (a is None): return isEqual(b, CENTER) # if (b is None): return isEqual(a, CENTER) # return ((a - b).Length < e) # # def getDumpFolder(): # global _dump_folder # return _dump_folder # # Path: importerUtils.py # def logInfo(msg, *args): # if (__prmPrefOW__.GetBool("checkLogging", False)): _log("logInfo", Console.PrintMessage, msg, args) # # def logWarning(msg, *args): # if (__prmPrefOW__.GetBool("checkWarning", False)): _log("logWarning", Console.PrintWarning, msg, args) # # def logError(msg, *args): # if (__prmPrefOW__.GetBool("checkError", True)): _log("logError", Console.PrintError, msg, args) # # def logAlways(msg, *args): # _log("logAlways", Console.PrintMessage, msg, args) # # def isEqual1D(a, b, e = 0.0001): # if (a is None): return isEqual1D(b, 0.0) # if (b is None): return isEqual1D(a, 0.0) # return abs(a - b) < e # # def getAuthor(): # return _author # # def getDescription(): # return _description # # def getColorDefault(): # global _colorDefault # return _colorDefault # # Path: importerConstants.py # CENTER = VEC(0, 0, 0) # # DIR_X = VEC(1, 0, 0) # # DIR_Y = VEC(0, 1, 0) # # DIR_Z = VEC(0, 0, 1) # # ENCODING_FS = 'utf8' . Output only the next line.
if (isEqual1D(acisCurve.ratio, 1.0)):
Continue the code snippet: <|code_start|> super(GEOMETRIC_REPRESENTATION_ITEM, self).__init__() class SURFACE(ReferencedEntity): def __init__(self): super(SURFACE, self).__init__() class RATIONAL_B_SPLINE_SURFACE(ReferencedEntity): def __init__(self, weights): super(RATIONAL_B_SPLINE_SURFACE, self).__init__() self.weights = weights def _getParameters(self): return super(RATIONAL_B_SPLINE_SURFACE, self)._getParameters() + [self.weights] class REPRESENTATION_ITEM(NamedEntity): def __init__(self, name): super(REPRESENTATION_ITEM, self).__init__() class GROUP(NamedEntity): def __init__(self, name = '', desc=None): super(GROUP, self).__init__(name) self.desc = desc def _getParameters(self): return super(GROUP, self)._getParameters() + [self.desc] ############################################################# # Global functions ############################################################# def export(filename, satHeader, satBodies): dt = datetime.now() # 2018-05-13T08:03:27-07:00 <|code_end|> . Use current file imports: from datetime import datetime from importerUtils import isEqual, getDumpFolder from FreeCAD import Vector as VEC, Placement as PLC from importerUtils import logInfo, logWarning, logError, logAlways, isEqual1D, getAuthor, getDescription, getColorDefault from importerConstants import CENTER, DIR_X, DIR_Y, DIR_Z, ENCODING_FS import traceback, inspect, os, sys, Acis, math, re, Part, io and context (classes, functions, or code) from other files: # Path: importerUtils.py # def isEqual(a, b, e = 0.0001): # if (a is None): return isEqual(b, CENTER) # if (b is None): return isEqual(a, CENTER) # return ((a - b).Length < e) # # def getDumpFolder(): # global _dump_folder # return _dump_folder # # Path: importerUtils.py # def logInfo(msg, *args): # if (__prmPrefOW__.GetBool("checkLogging", False)): _log("logInfo", Console.PrintMessage, msg, args) # # def logWarning(msg, *args): # if (__prmPrefOW__.GetBool("checkWarning", False)): _log("logWarning", Console.PrintWarning, msg, args) # # def logError(msg, *args): # if (__prmPrefOW__.GetBool("checkError", True)): _log("logError", Console.PrintError, msg, args) # # def logAlways(msg, *args): # _log("logAlways", Console.PrintMessage, msg, args) # # def isEqual1D(a, b, e = 0.0001): # if (a is None): return isEqual1D(b, 0.0) # if (b is None): return isEqual1D(a, 0.0) # return abs(a - b) < e # # def getAuthor(): # return _author # # def getDescription(): # return _description # # def getColorDefault(): # global _colorDefault # return _colorDefault # # Path: importerConstants.py # CENTER = VEC(0, 0, 0) # # DIR_X = VEC(1, 0, 0) # # DIR_Y = VEC(0, 1, 0) # # DIR_Z = VEC(0, 0, 1) # # ENCODING_FS = 'utf8' . Output only the next line.
user = getAuthor()
Given the following code snippet before the placeholder: <|code_start|> class SURFACE(ReferencedEntity): def __init__(self): super(SURFACE, self).__init__() class RATIONAL_B_SPLINE_SURFACE(ReferencedEntity): def __init__(self, weights): super(RATIONAL_B_SPLINE_SURFACE, self).__init__() self.weights = weights def _getParameters(self): return super(RATIONAL_B_SPLINE_SURFACE, self)._getParameters() + [self.weights] class REPRESENTATION_ITEM(NamedEntity): def __init__(self, name): super(REPRESENTATION_ITEM, self).__init__() class GROUP(NamedEntity): def __init__(self, name = '', desc=None): super(GROUP, self).__init__(name) self.desc = desc def _getParameters(self): return super(GROUP, self)._getParameters() + [self.desc] ############################################################# # Global functions ############################################################# def export(filename, satHeader, satBodies): dt = datetime.now() # 2018-05-13T08:03:27-07:00 user = getAuthor() <|code_end|> , predict the next line using imports from the current file: from datetime import datetime from importerUtils import isEqual, getDumpFolder from FreeCAD import Vector as VEC, Placement as PLC from importerUtils import logInfo, logWarning, logError, logAlways, isEqual1D, getAuthor, getDescription, getColorDefault from importerConstants import CENTER, DIR_X, DIR_Y, DIR_Z, ENCODING_FS import traceback, inspect, os, sys, Acis, math, re, Part, io and context including class names, function names, and sometimes code from other files: # Path: importerUtils.py # def isEqual(a, b, e = 0.0001): # if (a is None): return isEqual(b, CENTER) # if (b is None): return isEqual(a, CENTER) # return ((a - b).Length < e) # # def getDumpFolder(): # global _dump_folder # return _dump_folder # # Path: importerUtils.py # def logInfo(msg, *args): # if (__prmPrefOW__.GetBool("checkLogging", False)): _log("logInfo", Console.PrintMessage, msg, args) # # def logWarning(msg, *args): # if (__prmPrefOW__.GetBool("checkWarning", False)): _log("logWarning", Console.PrintWarning, msg, args) # # def logError(msg, *args): # if (__prmPrefOW__.GetBool("checkError", True)): _log("logError", Console.PrintError, msg, args) # # def logAlways(msg, *args): # _log("logAlways", Console.PrintMessage, msg, args) # # def isEqual1D(a, b, e = 0.0001): # if (a is None): return isEqual1D(b, 0.0) # if (b is None): return isEqual1D(a, 0.0) # return abs(a - b) < e # # def getAuthor(): # return _author # # def getDescription(): # return _description # # def getColorDefault(): # global _colorDefault # return _colorDefault # # Path: importerConstants.py # CENTER = VEC(0, 0, 0) # # DIR_X = VEC(1, 0, 0) # # DIR_Y = VEC(0, 1, 0) # # DIR_Z = VEC(0, 0, 1) # # ENCODING_FS = 'utf8' . Output only the next line.
desc = getDescription()
Given the following code snippet before the placeholder: <|code_start|> return u"(%s)" %(",".join([_obj2str(i) for i in l])) def _obj2str(o): if (o is None): return _str2str(o) if (type(o) == int): return u"%d" %(o) if (sys.version_info.major < 3): if (type(o) == long): return u"%d" %(o) if (type(o) == unicode): return _str2str(o) if (type(o) == float): return _dbl2str(o) if (type(o) == bool): return _bool2str(o) if (type(o) == str): return _str2str(o) if (isinstance(o, AnyEntity)): return "*" if (isinstance(o, E)): return u"%r" %(o) if (isinstance(o, AnonymEntity)): return _entity2str(o) if (type(o) == list): return _lst2str(o) if (type(o) == tuple): return _lst2str(o) raise Exception("Don't know how to convert '%s' into a string!" %(o.__class__.__name__)) def _values3D(v): return [v.x, v.y, v.z] def getColor(entity): global _colorPalette r = g = b = None color = entity.getColor() if (color): r, g, b = color.red, color.green, color.blue else: <|code_end|> , predict the next line using imports from the current file: from datetime import datetime from importerUtils import isEqual, getDumpFolder from FreeCAD import Vector as VEC, Placement as PLC from importerUtils import logInfo, logWarning, logError, logAlways, isEqual1D, getAuthor, getDescription, getColorDefault from importerConstants import CENTER, DIR_X, DIR_Y, DIR_Z, ENCODING_FS import traceback, inspect, os, sys, Acis, math, re, Part, io and context including class names, function names, and sometimes code from other files: # Path: importerUtils.py # def isEqual(a, b, e = 0.0001): # if (a is None): return isEqual(b, CENTER) # if (b is None): return isEqual(a, CENTER) # return ((a - b).Length < e) # # def getDumpFolder(): # global _dump_folder # return _dump_folder # # Path: importerUtils.py # def logInfo(msg, *args): # if (__prmPrefOW__.GetBool("checkLogging", False)): _log("logInfo", Console.PrintMessage, msg, args) # # def logWarning(msg, *args): # if (__prmPrefOW__.GetBool("checkWarning", False)): _log("logWarning", Console.PrintWarning, msg, args) # # def logError(msg, *args): # if (__prmPrefOW__.GetBool("checkError", True)): _log("logError", Console.PrintError, msg, args) # # def logAlways(msg, *args): # _log("logAlways", Console.PrintMessage, msg, args) # # def isEqual1D(a, b, e = 0.0001): # if (a is None): return isEqual1D(b, 0.0) # if (b is None): return isEqual1D(a, 0.0) # return abs(a - b) < e # # def getAuthor(): # return _author # # def getDescription(): # return _description # # def getColorDefault(): # global _colorDefault # return _colorDefault # # Path: importerConstants.py # CENTER = VEC(0, 0, 0) # # DIR_X = VEC(1, 0, 0) # # DIR_Y = VEC(0, 1, 0) # # DIR_Z = VEC(0, 0, 1) # # ENCODING_FS = 'utf8' . Output only the next line.
color = getColorDefault()
Continue the code snippet: <|code_start|> if (curve is not None): oe = ORIENTED_EDGE((acisCoEdge.sense == 'forward')) p1 = _createVertexPoint(acisEdge.getStart()) p2 = _createVertexPoint(acisEdge.getEnd()) e = _createEdgeCurve(p1, p2, curve, (acisEdge.sense == 'forward')) oe.edge = e return oe return None def _createBoundaries(acisLoops): boundaries = [] isouter = True for acisLoop in acisLoops: coedges = acisLoop.getCoEdges() edges = [] for index in coedges: acisCoEdge = coedges[index] edge = _createCoEdge(acisCoEdge) if (edge is not None): edges.append(edge) if (len(edges) > 0): face = FACE_BOUND('', True) loop = EDGE_LOOP('', edges) face.wire = loop boundaries.append(face) return boundaries def _calculateRef(axis): if (isEqual1D(axis.x, 1.0)): return DIR_Y if (isEqual1D(axis.x, -1.0)): return -DIR_Y <|code_end|> . Use current file imports: from datetime import datetime from importerUtils import isEqual, getDumpFolder from FreeCAD import Vector as VEC, Placement as PLC from importerUtils import logInfo, logWarning, logError, logAlways, isEqual1D, getAuthor, getDescription, getColorDefault from importerConstants import CENTER, DIR_X, DIR_Y, DIR_Z, ENCODING_FS import traceback, inspect, os, sys, Acis, math, re, Part, io and context (classes, functions, or code) from other files: # Path: importerUtils.py # def isEqual(a, b, e = 0.0001): # if (a is None): return isEqual(b, CENTER) # if (b is None): return isEqual(a, CENTER) # return ((a - b).Length < e) # # def getDumpFolder(): # global _dump_folder # return _dump_folder # # Path: importerUtils.py # def logInfo(msg, *args): # if (__prmPrefOW__.GetBool("checkLogging", False)): _log("logInfo", Console.PrintMessage, msg, args) # # def logWarning(msg, *args): # if (__prmPrefOW__.GetBool("checkWarning", False)): _log("logWarning", Console.PrintWarning, msg, args) # # def logError(msg, *args): # if (__prmPrefOW__.GetBool("checkError", True)): _log("logError", Console.PrintError, msg, args) # # def logAlways(msg, *args): # _log("logAlways", Console.PrintMessage, msg, args) # # def isEqual1D(a, b, e = 0.0001): # if (a is None): return isEqual1D(b, 0.0) # if (b is None): return isEqual1D(a, 0.0) # return abs(a - b) < e # # def getAuthor(): # return _author # # def getDescription(): # return _description # # def getColorDefault(): # global _colorDefault # return _colorDefault # # Path: importerConstants.py # CENTER = VEC(0, 0, 0) # # DIR_X = VEC(1, 0, 0) # # DIR_Y = VEC(0, 1, 0) # # DIR_Z = VEC(0, 0, 1) # # ENCODING_FS = 'utf8' . Output only the next line.
return DIR_X.cross(axis) # any perpendicular vector to normal?!?
Using the snippet: <|code_start|> acisEdge = acisCoEdge.getEdge() curve = _createCurve(acisEdge.getCurve()) if (curve is not None): oe = ORIENTED_EDGE((acisCoEdge.sense == 'forward')) p1 = _createVertexPoint(acisEdge.getStart()) p2 = _createVertexPoint(acisEdge.getEnd()) e = _createEdgeCurve(p1, p2, curve, (acisEdge.sense == 'forward')) oe.edge = e return oe return None def _createBoundaries(acisLoops): boundaries = [] isouter = True for acisLoop in acisLoops: coedges = acisLoop.getCoEdges() edges = [] for index in coedges: acisCoEdge = coedges[index] edge = _createCoEdge(acisCoEdge) if (edge is not None): edges.append(edge) if (len(edges) > 0): face = FACE_BOUND('', True) loop = EDGE_LOOP('', edges) face.wire = loop boundaries.append(face) return boundaries def _calculateRef(axis): <|code_end|> , determine the next line of code. You have imports: from datetime import datetime from importerUtils import isEqual, getDumpFolder from FreeCAD import Vector as VEC, Placement as PLC from importerUtils import logInfo, logWarning, logError, logAlways, isEqual1D, getAuthor, getDescription, getColorDefault from importerConstants import CENTER, DIR_X, DIR_Y, DIR_Z, ENCODING_FS import traceback, inspect, os, sys, Acis, math, re, Part, io and context (class names, function names, or code) available: # Path: importerUtils.py # def isEqual(a, b, e = 0.0001): # if (a is None): return isEqual(b, CENTER) # if (b is None): return isEqual(a, CENTER) # return ((a - b).Length < e) # # def getDumpFolder(): # global _dump_folder # return _dump_folder # # Path: importerUtils.py # def logInfo(msg, *args): # if (__prmPrefOW__.GetBool("checkLogging", False)): _log("logInfo", Console.PrintMessage, msg, args) # # def logWarning(msg, *args): # if (__prmPrefOW__.GetBool("checkWarning", False)): _log("logWarning", Console.PrintWarning, msg, args) # # def logError(msg, *args): # if (__prmPrefOW__.GetBool("checkError", True)): _log("logError", Console.PrintError, msg, args) # # def logAlways(msg, *args): # _log("logAlways", Console.PrintMessage, msg, args) # # def isEqual1D(a, b, e = 0.0001): # if (a is None): return isEqual1D(b, 0.0) # if (b is None): return isEqual1D(a, 0.0) # return abs(a - b) < e # # def getAuthor(): # return _author # # def getDescription(): # return _description # # def getColorDefault(): # global _colorDefault # return _colorDefault # # Path: importerConstants.py # CENTER = VEC(0, 0, 0) # # DIR_X = VEC(1, 0, 0) # # DIR_Y = VEC(0, 1, 0) # # DIR_Z = VEC(0, 0, 1) # # ENCODING_FS = 'utf8' . Output only the next line.
if (isEqual1D(axis.x, 1.0)): return DIR_Y
Next line prediction: <|code_start|> self.sec2 = None self.set = None self.exp = None def __str__(self): return "[%s], %s, '%s', [%s]" %(IntArr2Str(self.a1, 4), self.size, self.a2, IntArr2Str(self.a3, 2)) class UFRxAppendix(UFRxObject): def __init__(self): self.p1 = () self.p2 = 0 class UFRxBOM(UFRxObject): def __init__(self): self.unit = '' self.name = '' self.repr = '' self.value = 0.0 self.pad = 0 def __str__(self): return "BOM: %s = %s (%04X)" %(self.name, self.repr, self.pad) def readBoolean(data, offset, log, txt): v, i = getBoolean(data, offset) log.write("\t%s:\t%s\n" %(txt, v)) return v, i def readDateTime(data, offset, log, txt): v, i = getDateTime(data, offset) log.write("\t%s:\t%s\n" %(txt, v)) return v, i def readVersionInfo(data, offset, log, txt): <|code_end|> . Use current file imports: (import traceback, io, re from importerUtils import * from importerClasses import VersionInfo from FreeCAD import BoundBox ) and context including class names, function names, or small code snippets from other files: # Path: importerClasses.py # class VersionInfo(object): # def __init__(self): # self.revision = 0 # self.minor = 0 # self.major = 0 # self.data = (0, 0, 0, 0, 0) # def getDisplayName(self): # if (self.major > 11): # return "Version %d.%d%d" %(self.major + 1996, self.minor, self.revision) # return "Version %d.%d%d" %(self.major, self.minor, self.revision) # def getBits(self): return 64 if ((self.data[0] & 0x40)) > 0 else 32 # def __str__(self): return "Version %d.%d.%d [%s]" %(self.major, self.minor, self.revision, IntArr2Str(self.data, 2)) # def __repr__(self): return self.__str__() . Output only the next line.
v = VersionInfo() # [00 00 18 40 00 00 A0 41]
Predict the next line after this snippet: <|code_start|> self.label = u'' self.orgPath = u'' self.fmtId = None self.dataPath = u'' self.dataLen = 0 self.data = [] self.orgPathW = u'' self.labelW = u'' self.defPathW = u'' def __repr__(self): return str(self.getDict()) def getDict(self): """populate temp dict that stores configurations""" return { "size": self.size, "header": self.header, "label": self.label, "orgPath": self.orgPath, "fmtId": self.fmtId, "dataPath": self.dataPath, "dataLen": self.dataLen, "orgPathW": self.orgPathW, "labelW": self.labelW, "defPathW": self.defPathW, } def read(self, data): """ parses olenative structure""" self.size, i = getUInt32(data, 0) <|code_end|> using the current file's imports: from importerUtils import getUInt16, getUInt32, getLen32Text8, getLen32Text16 and any relevant context from other files: # Path: importerUtils.py # def getUInt16(data, offset): # ''' # Returns a single unsingned 16-Bit value. # Args: # data # A binary string. # offset # The zero based offset of the unsigned 16-Bit value. # Returns: # The unsigned 16-Bit value at offset. # The new position in the 'stream'. # ''' # val, = UINT16(data, offset) # return val, offset + 2 # # def getUInt32(data, offset): # ''' # Returns a single unsingned 32-Bit value. # Args: # data # A binary string. # offset # The zero based offset of the unsigned 32-Bit value. # Returns: # The unsigned 32-Bit value at offset. # The new position in the 'stream'. # ''' # val, = UINT32(data, offset) # return val, offset + 4 # # def getLen32Text8(data, offset): # l, i = getUInt32(data, offset) # try: # txt, i = getText8(data, i, l) # except UnicodeDecodeError: # txt = data[i:i+l] # i += l # return txt, i # # def getLen32Text16(data, offset): # l, i = getUInt32(data, offset) # end = i + 2 * l # txt = data[i: end].decode('UTF-16LE') # if (txt[-1:] == '\0'): # txt = txt[:-1] # # if (txt[-1:] == '\n'): # txt = txt[:-1] # return txt, end . Output only the next line.
self.header, i = getUInt16(data, i)# get flag1, typically a hardcoded value of 02 00
Continue the code snippet: <|code_start|> self.header = None self.label = u'' self.orgPath = u'' self.fmtId = None self.dataPath = u'' self.dataLen = 0 self.data = [] self.orgPathW = u'' self.labelW = u'' self.defPathW = u'' def __repr__(self): return str(self.getDict()) def getDict(self): """populate temp dict that stores configurations""" return { "size": self.size, "header": self.header, "label": self.label, "orgPath": self.orgPath, "fmtId": self.fmtId, "dataPath": self.dataPath, "dataLen": self.dataLen, "orgPathW": self.orgPathW, "labelW": self.labelW, "defPathW": self.defPathW, } def read(self, data): """ parses olenative structure""" <|code_end|> . Use current file imports: from importerUtils import getUInt16, getUInt32, getLen32Text8, getLen32Text16 and context (classes, functions, or code) from other files: # Path: importerUtils.py # def getUInt16(data, offset): # ''' # Returns a single unsingned 16-Bit value. # Args: # data # A binary string. # offset # The zero based offset of the unsigned 16-Bit value. # Returns: # The unsigned 16-Bit value at offset. # The new position in the 'stream'. # ''' # val, = UINT16(data, offset) # return val, offset + 2 # # def getUInt32(data, offset): # ''' # Returns a single unsingned 32-Bit value. # Args: # data # A binary string. # offset # The zero based offset of the unsigned 32-Bit value. # Returns: # The unsigned 32-Bit value at offset. # The new position in the 'stream'. # ''' # val, = UINT32(data, offset) # return val, offset + 4 # # def getLen32Text8(data, offset): # l, i = getUInt32(data, offset) # try: # txt, i = getText8(data, i, l) # except UnicodeDecodeError: # txt = data[i:i+l] # i += l # return txt, i # # def getLen32Text16(data, offset): # l, i = getUInt32(data, offset) # end = i + 2 * l # txt = data[i: end].decode('UTF-16LE') # if (txt[-1:] == '\0'): # txt = txt[:-1] # # if (txt[-1:] == '\n'): # txt = txt[:-1] # return txt, end . Output only the next line.
self.size, i = getUInt32(data, 0)
Predict the next line after this snippet: <|code_start|> self.dataLen = 0 self.data = [] self.orgPathW = u'' self.labelW = u'' self.defPathW = u'' def __repr__(self): return str(self.getDict()) def getDict(self): """populate temp dict that stores configurations""" return { "size": self.size, "header": self.header, "label": self.label, "orgPath": self.orgPath, "fmtId": self.fmtId, "dataPath": self.dataPath, "dataLen": self.dataLen, "orgPathW": self.orgPathW, "labelW": self.labelW, "defPathW": self.defPathW, } def read(self, data): """ parses olenative structure""" self.size, i = getUInt32(data, 0) self.header, i = getUInt16(data, i)# get flag1, typically a hardcoded value of 02 00 self.label, i = getText(data, i) self.orgPath, i = getText(data, i) self.fmtId, i = getUInt32(data, i) # 0x0300 => empedded, 0x0100 => linked <|code_end|> using the current file's imports: from importerUtils import getUInt16, getUInt32, getLen32Text8, getLen32Text16 and any relevant context from other files: # Path: importerUtils.py # def getUInt16(data, offset): # ''' # Returns a single unsingned 16-Bit value. # Args: # data # A binary string. # offset # The zero based offset of the unsigned 16-Bit value. # Returns: # The unsigned 16-Bit value at offset. # The new position in the 'stream'. # ''' # val, = UINT16(data, offset) # return val, offset + 2 # # def getUInt32(data, offset): # ''' # Returns a single unsingned 32-Bit value. # Args: # data # A binary string. # offset # The zero based offset of the unsigned 32-Bit value. # Returns: # The unsigned 32-Bit value at offset. # The new position in the 'stream'. # ''' # val, = UINT32(data, offset) # return val, offset + 4 # # def getLen32Text8(data, offset): # l, i = getUInt32(data, offset) # try: # txt, i = getText8(data, i, l) # except UnicodeDecodeError: # txt = data[i:i+l] # i += l # return txt, i # # def getLen32Text16(data, offset): # l, i = getUInt32(data, offset) # end = i + 2 * l # txt = data[i: end].decode('UTF-16LE') # if (txt[-1:] == '\0'): # txt = txt[:-1] # # if (txt[-1:] == '\n'): # txt = txt[:-1] # return txt, end . Output only the next line.
self.dataPath, i = getLen32Text8(data, i)
Predict the next line for this snippet: <|code_start|> def __repr__(self): return str(self.getDict()) def getDict(self): """populate temp dict that stores configurations""" return { "size": self.size, "header": self.header, "label": self.label, "orgPath": self.orgPath, "fmtId": self.fmtId, "dataPath": self.dataPath, "dataLen": self.dataLen, "orgPathW": self.orgPathW, "labelW": self.labelW, "defPathW": self.defPathW, } def read(self, data): """ parses olenative structure""" self.size, i = getUInt32(data, 0) self.header, i = getUInt16(data, i)# get flag1, typically a hardcoded value of 02 00 self.label, i = getText(data, i) self.orgPath, i = getText(data, i) self.fmtId, i = getUInt32(data, i) # 0x0300 => empedded, 0x0100 => linked self.dataPath, i = getLen32Text8(data, i) self.dataLen, i = getUInt32(data, i) self.data = data[i:i+self.dataLen] i += self.dataLen if (len(data) - i > 12): <|code_end|> with the help of current file imports: from importerUtils import getUInt16, getUInt32, getLen32Text8, getLen32Text16 and context from other files: # Path: importerUtils.py # def getUInt16(data, offset): # ''' # Returns a single unsingned 16-Bit value. # Args: # data # A binary string. # offset # The zero based offset of the unsigned 16-Bit value. # Returns: # The unsigned 16-Bit value at offset. # The new position in the 'stream'. # ''' # val, = UINT16(data, offset) # return val, offset + 2 # # def getUInt32(data, offset): # ''' # Returns a single unsingned 32-Bit value. # Args: # data # A binary string. # offset # The zero based offset of the unsigned 32-Bit value. # Returns: # The unsigned 32-Bit value at offset. # The new position in the 'stream'. # ''' # val, = UINT32(data, offset) # return val, offset + 4 # # def getLen32Text8(data, offset): # l, i = getUInt32(data, offset) # try: # txt, i = getText8(data, i, l) # except UnicodeDecodeError: # txt = data[i:i+l] # i += l # return txt, i # # def getLen32Text16(data, offset): # l, i = getUInt32(data, offset) # end = i + 2 * l # txt = data[i: end].decode('UTF-16LE') # if (txt[-1:] == '\0'): # txt = txt[:-1] # # if (txt[-1:] == '\n'): # txt = txt[:-1] # return txt, end , which may contain function names, class names, or code. Output only the next line.
self.orgPathW, i = getLen32Text16(data, i) # command16
Based on the snippet: <|code_start|> The zero based offset of the UID. Returns: The UID at offset. The new position in the 'stream'. ''' end = offset + 16 val = UID(bytes_le=data[offset:end]) return val, end def getDateTime(data, offset): ''' Returns a timestamp (datetime). Args: data A binary string. offset The zero based offset of the timestamp. Returns: The timestamp at offset. The new position in the 'stream'. ''' val, = DATETIME(data, offset) if val != 0: return datetime.datetime(1601, 1, 1) + datetime.timedelta(microseconds=val/10.), offset + 8 return None, offset + 8 def getText8(data, offset, l): i = offset end = i + l try: <|code_end|> , predict the immediate next line with the help of imports: import os, sys, datetime, FreeCADGui, json, shutil, re import sys from PySide.QtCore import * from PySide.QtGui import * from struct import Struct, unpack_from, pack from FreeCAD import Vector as VEC, Console, ParamGet from olefile import OleFileIO from importerConstants import ENCODING_FS and context (classes, functions, sometimes code) from other files: # Path: importerConstants.py # ENCODING_FS = 'utf8' . Output only the next line.
txt = data[i: end].decode(ENCODING_FS)
Given the following code snippet before the placeholder: <|code_start|>def getParameterization(pts, fac, closed): # Computes a knot Sequence for a set of points # fac (0-1) : parameterization factor # 0 -> Uniform # 0.5 -> Centripetal # 1.0 -> Chord-Length if closed: # we need to add the first point as the end point pts.append(pts[0]) params = [0] for i in range(1, len(pts)): p = pts[i].sub(pts[i-1]) pl = pow(p.Length, fac) # parametrization -> Chord-Length params.append(params[-1] + pl) return params class BDY_GEOM(object): def __init__(self, svId): self.svId = svId self.shape = None self.__ready_to_build__ = True # Don't try to create me more than once def build(self): if (self.__ready_to_build__): self.__ready_to_build__ = False self.buildCurve() return self.shape class BDY_GEOM_CIRCLE(BDY_GEOM): def __init__(self): super(BDY_GEOM_CIRCLE, self).__init__('circle') self.curve = None self.twist = (None, None) <|code_end|> , predict the next line using imports from the current file: import traceback, Part, Draft, os, FreeCAD, re from importerUtils import * from FreeCAD import Vector as VEC, Rotation as ROT, Placement as PLC, Matrix as MAT, Base from math import pi, fabs, degrees, asin, sin, cos, tan, atan2, ceil, e, cosh, sinh, tanh, acos, acosh, asin, asinh, atan, atanh, log, sqrt, exp, log10 from importerConstants import MIN_0, MIN_PI, MIN_PI2, MIN_INF, MAX_2PI, MAX_PI, MAX_PI2, MAX_INF, MAX_LEN from importerConstants import CENTER, DIR_X, DIR_Y, DIR_Z, ENCODING_FS and context including class names, function names, and sometimes code from other files: # Path: importerConstants.py # MIN_0 = 0.0 # # MIN_PI = -pi # # MIN_PI2 = -pi / 2 # # MIN_INF = float('-inf') # # MAX_2PI = 2 * pi # # MAX_PI = pi # # MAX_PI2 = pi / 2 # # MAX_INF = float('inf') # # MAX_LEN = 2e+100 # # Path: importerConstants.py # CENTER = VEC(0, 0, 0) # # DIR_X = VEC(1, 0, 0) # # DIR_Y = VEC(0, 1, 0) # # DIR_Z = VEC(0, 0, 1) # # ENCODING_FS = 'utf8' . Output only the next line.
self.parameters = (MIN_0, MAX_2PI)
Predict the next line for this snippet: <|code_start|> tol11, i = getLength(chunks, i) if (not chunks[i].tag in [TAG_UTF8_U8, TAG_IDENT, TAG_SUBIDENT]): i += 1 # newer Inventor versions (>2017 p13, i = readBS2Curve(chunks, i) else: raise AssertionError("wrong singularity %s" %(singularity)) t21, i = getValue(chunks, i) s21, i = readSurface(chunks, i) c21, i = readCurve(chunks, i) p21, i = readBS2Curve(chunks, i) v21, i = getVector(chunks, i) p22, i = readBS2Curve(chunks, i) s22, tol21, i = readSplineSurface(chunks, i, True) c1, i = readCurve(chunks, i) a1, i = getFloats(chunks, i, 2) l1, i = getLong(chunks, i) # non_ rU, i = getInterval(chunks, i, MIN_INF, MAX_INF, 1.0) rV, i = getInterval(chunks, i, MIN_INF, MAX_INF, 1.0) a1, i = getFloats(chunks, i, 4)# 1, 0.05, 1e-4, 1 i = self.setSurfaceShape(chunks, i, inventor, 'g2_blend_spl_sur') if (inventor): # Discontinuity-Info di1, i = getFloatArray(chunks, i) di2, i = getFloatArray(chunks, i) di3, i = getFloatArray(chunks, i) return i def setHelixCircle(self, chunks, index, inventor): self.subtype = 'helix_spl_circ' <|code_end|> with the help of current file imports: import traceback, Part, Draft, os, FreeCAD, re from importerUtils import * from FreeCAD import Vector as VEC, Rotation as ROT, Placement as PLC, Matrix as MAT, Base from math import pi, fabs, degrees, asin, sin, cos, tan, atan2, ceil, e, cosh, sinh, tanh, acos, acosh, asin, asinh, atan, atanh, log, sqrt, exp, log10 from importerConstants import MIN_0, MIN_PI, MIN_PI2, MIN_INF, MAX_2PI, MAX_PI, MAX_PI2, MAX_INF, MAX_LEN from importerConstants import CENTER, DIR_X, DIR_Y, DIR_Z, ENCODING_FS and context from other files: # Path: importerConstants.py # MIN_0 = 0.0 # # MIN_PI = -pi # # MIN_PI2 = -pi / 2 # # MIN_INF = float('-inf') # # MAX_2PI = 2 * pi # # MAX_PI = pi # # MAX_PI2 = pi / 2 # # MAX_INF = float('inf') # # MAX_LEN = 2e+100 # # Path: importerConstants.py # CENTER = VEC(0, 0, 0) # # DIR_X = VEC(1, 0, 0) # # DIR_Y = VEC(0, 1, 0) # # DIR_Z = VEC(0, 0, 1) # # ENCODING_FS = 'utf8' , which may contain function names, class names, or code. Output only the next line.
angle, i = getInterval(chunks, index, MIN_PI, MAX_PI, 1.0)
Given snippet: <|code_start|> self.normal = DIR_Z self.uvorigin = CENTER self.sensev = 'forward_v' self.urange = Interval(Range('I', MIN_INF), Range('I', MAX_INF)) self.vrange = Interval(Range('I', MIN_INF), Range('I', MAX_INF)) def getSatTextGeometry(self, index): return "%s %s %s %s %s %s #" %(vec2sat(self.root), vec2sat(self.normal), vec2sat(self.uvorigin), self.sensev, self.urange, self.vrange) def __repr__(self): return "Surface-Plane: root=%s, normal=%s, uvorigin=%s" %(self.root, self.normal, self.uvorigin) def setSubtype(self, chunks, index): self.root, i = getLocation(chunks, index) self.normal, i = getVector(chunks, i) self.uvorigin, i = getLocation(chunks, i) self.sensev, i = getEnumByTag(chunks, i, SENSEV) self.urange, i = getInterval(chunks, i, MIN_INF, MAX_INF, getScale()) self.vrange, i = getInterval(chunks, i, MIN_INF, MAX_INF, getScale()) return i def build(self, face = None): if (self.__ready_to_build__): self.__ready_to_build__ = False plane = Part.Plane(self.root, self.normal) self.shape = plane.toShape() return self.shape class SurfaceSphere(Surface): def __init__(self): super(SurfaceSphere, self).__init__('sphere') self.center = CENTER self.radius = 0.0 self.uvorigin = DIR_X self.pole = DIR_Z self.sensev = 'forward_v' self.urange = Interval(Range('I', MIN_0), Range('I', MAX_2PI)) <|code_end|> , continue by predicting the next line. Consider current file imports: import traceback, Part, Draft, os, FreeCAD, re from importerUtils import * from FreeCAD import Vector as VEC, Rotation as ROT, Placement as PLC, Matrix as MAT, Base from math import pi, fabs, degrees, asin, sin, cos, tan, atan2, ceil, e, cosh, sinh, tanh, acos, acosh, asin, asinh, atan, atanh, log, sqrt, exp, log10 from importerConstants import MIN_0, MIN_PI, MIN_PI2, MIN_INF, MAX_2PI, MAX_PI, MAX_PI2, MAX_INF, MAX_LEN from importerConstants import CENTER, DIR_X, DIR_Y, DIR_Z, ENCODING_FS and context: # Path: importerConstants.py # MIN_0 = 0.0 # # MIN_PI = -pi # # MIN_PI2 = -pi / 2 # # MIN_INF = float('-inf') # # MAX_2PI = 2 * pi # # MAX_PI = pi # # MAX_PI2 = pi / 2 # # MAX_INF = float('inf') # # MAX_LEN = 2e+100 # # Path: importerConstants.py # CENTER = VEC(0, 0, 0) # # DIR_X = VEC(1, 0, 0) # # DIR_Y = VEC(0, 1, 0) # # DIR_Z = VEC(0, 0, 1) # # ENCODING_FS = 'utf8' which might include code, classes, or functions. Output only the next line.
self.vrange = Interval(Range('I', MIN_PI2), Range('I', MAX_PI2))
Given the following code snippet before the placeholder: <|code_start|> def readBS3Surface(chunks, index): nbs, degreeU, degreeV, i = getDimensionSurface(chunks, index) if (nbs == 'nullbs'): return None, i if (nbs in ('nubs', 'nurbs')): closureU, closureV, singularityU, singularityV, countU, countV, i = getClosureSurface(chunks, i) spline = BS3_Surface(nbs == 'nurbs', closureU == 'periodic', closureV == 'periodic', degreeU, degreeV) i = spline.readPoints3DMap(countU, countV, chunks, i) return spline, i if (nbs == 'summary'): x, i = getFloat(chunks, i) arr, i = getFloatArray(chunks, i) tol, i = getLength(chunks, i) closureU, i = getEnumByValue(chunks, i, CLOSURE) closureV, i = getEnumByValue(chunks, i, CLOSURE) singularityU, i = getSingularity(chunks, i) singularityV, i = getSingularity(chunks, i) # FIXME: create a surface from these values! -> ../tutorials/2012/Tube and Pipe/Example_iparts/45Elbow.ipt return None, i def readSplineSurface(chunks, index, tolerance): singularity, i = getSingularity(chunks, index) if (singularity == 'full'): spline, i = readBS3Surface(chunks, i) if ((spline is not None) and tolerance): tol, i = getLength(chunks, i) return spline, tol, i return spline, None, i if ((singularity == 'none') or (singularity == 4)): <|code_end|> , predict the next line using imports from the current file: import traceback, Part, Draft, os, FreeCAD, re from importerUtils import * from FreeCAD import Vector as VEC, Rotation as ROT, Placement as PLC, Matrix as MAT, Base from math import pi, fabs, degrees, asin, sin, cos, tan, atan2, ceil, e, cosh, sinh, tanh, acos, acosh, asin, asinh, atan, atanh, log, sqrt, exp, log10 from importerConstants import MIN_0, MIN_PI, MIN_PI2, MIN_INF, MAX_2PI, MAX_PI, MAX_PI2, MAX_INF, MAX_LEN from importerConstants import CENTER, DIR_X, DIR_Y, DIR_Z, ENCODING_FS and context including class names, function names, and sometimes code from other files: # Path: importerConstants.py # MIN_0 = 0.0 # # MIN_PI = -pi # # MIN_PI2 = -pi / 2 # # MIN_INF = float('-inf') # # MAX_2PI = 2 * pi # # MAX_PI = pi # # MAX_PI2 = pi / 2 # # MAX_INF = float('inf') # # MAX_LEN = 2e+100 # # Path: importerConstants.py # CENTER = VEC(0, 0, 0) # # DIR_X = VEC(1, 0, 0) # # DIR_Y = VEC(0, 1, 0) # # DIR_Z = VEC(0, 0, 1) # # ENCODING_FS = 'utf8' . Output only the next line.
rngU, i = getInterval(chunks, i, MIN_INF, MAX_INF, 1.0)
Given the following code snippet before the placeholder: <|code_start|>def getParameterization(pts, fac, closed): # Computes a knot Sequence for a set of points # fac (0-1) : parameterization factor # 0 -> Uniform # 0.5 -> Centripetal # 1.0 -> Chord-Length if closed: # we need to add the first point as the end point pts.append(pts[0]) params = [0] for i in range(1, len(pts)): p = pts[i].sub(pts[i-1]) pl = pow(p.Length, fac) # parametrization -> Chord-Length params.append(params[-1] + pl) return params class BDY_GEOM(object): def __init__(self, svId): self.svId = svId self.shape = None self.__ready_to_build__ = True # Don't try to create me more than once def build(self): if (self.__ready_to_build__): self.__ready_to_build__ = False self.buildCurve() return self.shape class BDY_GEOM_CIRCLE(BDY_GEOM): def __init__(self): super(BDY_GEOM_CIRCLE, self).__init__('circle') self.curve = None self.twist = (None, None) <|code_end|> , predict the next line using imports from the current file: import traceback, Part, Draft, os, FreeCAD, re from importerUtils import * from FreeCAD import Vector as VEC, Rotation as ROT, Placement as PLC, Matrix as MAT, Base from math import pi, fabs, degrees, asin, sin, cos, tan, atan2, ceil, e, cosh, sinh, tanh, acos, acosh, asin, asinh, atan, atanh, log, sqrt, exp, log10 from importerConstants import MIN_0, MIN_PI, MIN_PI2, MIN_INF, MAX_2PI, MAX_PI, MAX_PI2, MAX_INF, MAX_LEN from importerConstants import CENTER, DIR_X, DIR_Y, DIR_Z, ENCODING_FS and context including class names, function names, and sometimes code from other files: # Path: importerConstants.py # MIN_0 = 0.0 # # MIN_PI = -pi # # MIN_PI2 = -pi / 2 # # MIN_INF = float('-inf') # # MAX_2PI = 2 * pi # # MAX_PI = pi # # MAX_PI2 = pi / 2 # # MAX_INF = float('inf') # # MAX_LEN = 2e+100 # # Path: importerConstants.py # CENTER = VEC(0, 0, 0) # # DIR_X = VEC(1, 0, 0) # # DIR_Y = VEC(0, 1, 0) # # DIR_Z = VEC(0, 0, 1) # # ENCODING_FS = 'utf8' . Output only the next line.
self.parameters = (MIN_0, MAX_2PI)
Given snippet: <|code_start|> tol11, i = getLength(chunks, i) if (not chunks[i].tag in [TAG_UTF8_U8, TAG_IDENT, TAG_SUBIDENT]): i += 1 # newer Inventor versions (>2017 p13, i = readBS2Curve(chunks, i) else: raise AssertionError("wrong singularity %s" %(singularity)) t21, i = getValue(chunks, i) s21, i = readSurface(chunks, i) c21, i = readCurve(chunks, i) p21, i = readBS2Curve(chunks, i) v21, i = getVector(chunks, i) p22, i = readBS2Curve(chunks, i) s22, tol21, i = readSplineSurface(chunks, i, True) c1, i = readCurve(chunks, i) a1, i = getFloats(chunks, i, 2) l1, i = getLong(chunks, i) # non_ rU, i = getInterval(chunks, i, MIN_INF, MAX_INF, 1.0) rV, i = getInterval(chunks, i, MIN_INF, MAX_INF, 1.0) a1, i = getFloats(chunks, i, 4)# 1, 0.05, 1e-4, 1 i = self.setSurfaceShape(chunks, i, inventor, 'g2_blend_spl_sur') if (inventor): # Discontinuity-Info di1, i = getFloatArray(chunks, i) di2, i = getFloatArray(chunks, i) di3, i = getFloatArray(chunks, i) return i def setHelixCircle(self, chunks, index, inventor): self.subtype = 'helix_spl_circ' <|code_end|> , continue by predicting the next line. Consider current file imports: import traceback, Part, Draft, os, FreeCAD, re from importerUtils import * from FreeCAD import Vector as VEC, Rotation as ROT, Placement as PLC, Matrix as MAT, Base from math import pi, fabs, degrees, asin, sin, cos, tan, atan2, ceil, e, cosh, sinh, tanh, acos, acosh, asin, asinh, atan, atanh, log, sqrt, exp, log10 from importerConstants import MIN_0, MIN_PI, MIN_PI2, MIN_INF, MAX_2PI, MAX_PI, MAX_PI2, MAX_INF, MAX_LEN from importerConstants import CENTER, DIR_X, DIR_Y, DIR_Z, ENCODING_FS and context: # Path: importerConstants.py # MIN_0 = 0.0 # # MIN_PI = -pi # # MIN_PI2 = -pi / 2 # # MIN_INF = float('-inf') # # MAX_2PI = 2 * pi # # MAX_PI = pi # # MAX_PI2 = pi / 2 # # MAX_INF = float('inf') # # MAX_LEN = 2e+100 # # Path: importerConstants.py # CENTER = VEC(0, 0, 0) # # DIR_X = VEC(1, 0, 0) # # DIR_Y = VEC(0, 1, 0) # # DIR_Z = VEC(0, 0, 1) # # ENCODING_FS = 'utf8' which might include code, classes, or functions. Output only the next line.
angle, i = getInterval(chunks, index, MIN_PI, MAX_PI, 1.0)
Here is a snippet: <|code_start|> self.normal = DIR_Z self.uvorigin = CENTER self.sensev = 'forward_v' self.urange = Interval(Range('I', MIN_INF), Range('I', MAX_INF)) self.vrange = Interval(Range('I', MIN_INF), Range('I', MAX_INF)) def getSatTextGeometry(self, index): return "%s %s %s %s %s %s #" %(vec2sat(self.root), vec2sat(self.normal), vec2sat(self.uvorigin), self.sensev, self.urange, self.vrange) def __repr__(self): return "Surface-Plane: root=%s, normal=%s, uvorigin=%s" %(self.root, self.normal, self.uvorigin) def setSubtype(self, chunks, index): self.root, i = getLocation(chunks, index) self.normal, i = getVector(chunks, i) self.uvorigin, i = getLocation(chunks, i) self.sensev, i = getEnumByTag(chunks, i, SENSEV) self.urange, i = getInterval(chunks, i, MIN_INF, MAX_INF, getScale()) self.vrange, i = getInterval(chunks, i, MIN_INF, MAX_INF, getScale()) return i def build(self, face = None): if (self.__ready_to_build__): self.__ready_to_build__ = False plane = Part.Plane(self.root, self.normal) self.shape = plane.toShape() return self.shape class SurfaceSphere(Surface): def __init__(self): super(SurfaceSphere, self).__init__('sphere') self.center = CENTER self.radius = 0.0 self.uvorigin = DIR_X self.pole = DIR_Z self.sensev = 'forward_v' self.urange = Interval(Range('I', MIN_0), Range('I', MAX_2PI)) <|code_end|> . Write the next line using the current file imports: import traceback, Part, Draft, os, FreeCAD, re from importerUtils import * from FreeCAD import Vector as VEC, Rotation as ROT, Placement as PLC, Matrix as MAT, Base from math import pi, fabs, degrees, asin, sin, cos, tan, atan2, ceil, e, cosh, sinh, tanh, acos, acosh, asin, asinh, atan, atanh, log, sqrt, exp, log10 from importerConstants import MIN_0, MIN_PI, MIN_PI2, MIN_INF, MAX_2PI, MAX_PI, MAX_PI2, MAX_INF, MAX_LEN from importerConstants import CENTER, DIR_X, DIR_Y, DIR_Z, ENCODING_FS and context from other files: # Path: importerConstants.py # MIN_0 = 0.0 # # MIN_PI = -pi # # MIN_PI2 = -pi / 2 # # MIN_INF = float('-inf') # # MAX_2PI = 2 * pi # # MAX_PI = pi # # MAX_PI2 = pi / 2 # # MAX_INF = float('inf') # # MAX_LEN = 2e+100 # # Path: importerConstants.py # CENTER = VEC(0, 0, 0) # # DIR_X = VEC(1, 0, 0) # # DIR_Y = VEC(0, 1, 0) # # DIR_Z = VEC(0, 0, 1) # # ENCODING_FS = 'utf8' , which may include functions, classes, or code. Output only the next line.
self.vrange = Interval(Range('I', MIN_PI2), Range('I', MAX_PI2))
Given the following code snippet before the placeholder: <|code_start|> def readBS3Surface(chunks, index): nbs, degreeU, degreeV, i = getDimensionSurface(chunks, index) if (nbs == 'nullbs'): return None, i if (nbs in ('nubs', 'nurbs')): closureU, closureV, singularityU, singularityV, countU, countV, i = getClosureSurface(chunks, i) spline = BS3_Surface(nbs == 'nurbs', closureU == 'periodic', closureV == 'periodic', degreeU, degreeV) i = spline.readPoints3DMap(countU, countV, chunks, i) return spline, i if (nbs == 'summary'): x, i = getFloat(chunks, i) arr, i = getFloatArray(chunks, i) tol, i = getLength(chunks, i) closureU, i = getEnumByValue(chunks, i, CLOSURE) closureV, i = getEnumByValue(chunks, i, CLOSURE) singularityU, i = getSingularity(chunks, i) singularityV, i = getSingularity(chunks, i) # FIXME: create a surface from these values! -> ../tutorials/2012/Tube and Pipe/Example_iparts/45Elbow.ipt return None, i def readSplineSurface(chunks, index, tolerance): singularity, i = getSingularity(chunks, index) if (singularity == 'full'): spline, i = readBS3Surface(chunks, i) if ((spline is not None) and tolerance): tol, i = getLength(chunks, i) return spline, tol, i return spline, None, i if ((singularity == 'none') or (singularity == 4)): <|code_end|> , predict the next line using imports from the current file: import traceback, Part, Draft, os, FreeCAD, re from importerUtils import * from FreeCAD import Vector as VEC, Rotation as ROT, Placement as PLC, Matrix as MAT, Base from math import pi, fabs, degrees, asin, sin, cos, tan, atan2, ceil, e, cosh, sinh, tanh, acos, acosh, asin, asinh, atan, atanh, log, sqrt, exp, log10 from importerConstants import MIN_0, MIN_PI, MIN_PI2, MIN_INF, MAX_2PI, MAX_PI, MAX_PI2, MAX_INF, MAX_LEN from importerConstants import CENTER, DIR_X, DIR_Y, DIR_Z, ENCODING_FS and context including class names, function names, and sometimes code from other files: # Path: importerConstants.py # MIN_0 = 0.0 # # MIN_PI = -pi # # MIN_PI2 = -pi / 2 # # MIN_INF = float('-inf') # # MAX_2PI = 2 * pi # # MAX_PI = pi # # MAX_PI2 = pi / 2 # # MAX_INF = float('inf') # # MAX_LEN = 2e+100 # # Path: importerConstants.py # CENTER = VEC(0, 0, 0) # # DIR_X = VEC(1, 0, 0) # # DIR_Y = VEC(0, 1, 0) # # DIR_Z = VEC(0, 0, 1) # # ENCODING_FS = 'utf8' . Output only the next line.
rngU, i = getInterval(chunks, i, MIN_INF, MAX_INF, 1.0)
Continue the code snippet: <|code_start|> if (not chunks[i].tag in [TAG_UTF8_U8, TAG_IDENT, TAG_SUBIDENT]): i += 1 # newer Inventor versions (>2017 p13, i = readBS2Curve(chunks, i) else: raise AssertionError("wrong singularity %s" %(singularity)) t21, i = getValue(chunks, i) s21, i = readSurface(chunks, i) c21, i = readCurve(chunks, i) p21, i = readBS2Curve(chunks, i) v21, i = getVector(chunks, i) p22, i = readBS2Curve(chunks, i) s22, tol21, i = readSplineSurface(chunks, i, True) c1, i = readCurve(chunks, i) a1, i = getFloats(chunks, i, 2) l1, i = getLong(chunks, i) # non_ rU, i = getInterval(chunks, i, MIN_INF, MAX_INF, 1.0) rV, i = getInterval(chunks, i, MIN_INF, MAX_INF, 1.0) a1, i = getFloats(chunks, i, 4)# 1, 0.05, 1e-4, 1 i = self.setSurfaceShape(chunks, i, inventor, 'g2_blend_spl_sur') if (inventor): # Discontinuity-Info di1, i = getFloatArray(chunks, i) di2, i = getFloatArray(chunks, i) di3, i = getFloatArray(chunks, i) return i def setHelixCircle(self, chunks, index, inventor): self.subtype = 'helix_spl_circ' angle, i = getInterval(chunks, index, MIN_PI, MAX_PI, 1.0) <|code_end|> . Use current file imports: import traceback, Part, Draft, os, FreeCAD, re from importerUtils import * from FreeCAD import Vector as VEC, Rotation as ROT, Placement as PLC, Matrix as MAT, Base from math import pi, fabs, degrees, asin, sin, cos, tan, atan2, ceil, e, cosh, sinh, tanh, acos, acosh, asin, asinh, atan, atanh, log, sqrt, exp, log10 from importerConstants import MIN_0, MIN_PI, MIN_PI2, MIN_INF, MAX_2PI, MAX_PI, MAX_PI2, MAX_INF, MAX_LEN from importerConstants import CENTER, DIR_X, DIR_Y, DIR_Z, ENCODING_FS and context (classes, functions, or code) from other files: # Path: importerConstants.py # MIN_0 = 0.0 # # MIN_PI = -pi # # MIN_PI2 = -pi / 2 # # MIN_INF = float('-inf') # # MAX_2PI = 2 * pi # # MAX_PI = pi # # MAX_PI2 = pi / 2 # # MAX_INF = float('inf') # # MAX_LEN = 2e+100 # # Path: importerConstants.py # CENTER = VEC(0, 0, 0) # # DIR_X = VEC(1, 0, 0) # # DIR_Y = VEC(0, 1, 0) # # DIR_Z = VEC(0, 0, 1) # # ENCODING_FS = 'utf8' . Output only the next line.
dime1, i = getInterval(chunks, i, -MAX_LEN, MAX_LEN, getScale())
Continue the code snippet: <|code_start|> logError(traceback.format_exc()) raise Exception("Unknown surface-type '%s'!" % (subtype)) return surface, i #FIXME: this is a dirty hack :( if (chunk.tag == TAG_DOUBLE): a, i = getFloats(chunks, index, 5) return None, i if (chunk.tag in [TAG_POSITION, TAG_VECTOR_3D]): a, i = getFloats(chunks, i, 2) return None, i def getDiscontinuityInfo(chunks, index, inventor): a1, i = getFloatArray(chunks, index) a2, i = getFloatArray(chunks, i) a3, i = getFloatArray(chunks, i) a4, i = getFloatArray(chunks, i) a5, i = getFloatArray(chunks, i) a6, i = getFloatArray(chunks, i) if (inventor): e, i = getBoolean(chunks, i) else: e = False return (a1, a2, a3, a4, a5, a6, e), i def rotateShape(shape, dir): # Setting the axis directly doesn't work for directions other than x-axis! angle = degrees(DIR_Z.getAngle(dir)) if (isEqual1D(angle, 0)): axis = DIR_Z.cross(dir) if angle != 180 else DIR_X <|code_end|> . Use current file imports: import traceback, Part, Draft, os, FreeCAD, re from importerUtils import * from FreeCAD import Vector as VEC, Rotation as ROT, Placement as PLC, Matrix as MAT, Base from math import pi, fabs, degrees, asin, sin, cos, tan, atan2, ceil, e, cosh, sinh, tanh, acos, acosh, asin, asinh, atan, atanh, log, sqrt, exp, log10 from importerConstants import MIN_0, MIN_PI, MIN_PI2, MIN_INF, MAX_2PI, MAX_PI, MAX_PI2, MAX_INF, MAX_LEN from importerConstants import CENTER, DIR_X, DIR_Y, DIR_Z, ENCODING_FS and context (classes, functions, or code) from other files: # Path: importerConstants.py # MIN_0 = 0.0 # # MIN_PI = -pi # # MIN_PI2 = -pi / 2 # # MIN_INF = float('-inf') # # MAX_2PI = 2 * pi # # MAX_PI = pi # # MAX_PI2 = pi / 2 # # MAX_INF = float('inf') # # MAX_LEN = 2e+100 # # Path: importerConstants.py # CENTER = VEC(0, 0, 0) # # DIR_X = VEC(1, 0, 0) # # DIR_Y = VEC(0, 1, 0) # # DIR_Z = VEC(0, 0, 1) # # ENCODING_FS = 'utf8' . Output only the next line.
shape.rotate(PLC(CENTER, axis, angle))
Here is a snippet: <|code_start|> except: logError(traceback.format_exc()) raise Exception("Unknown surface-type '%s'!" % (subtype)) return surface, i #FIXME: this is a dirty hack :( if (chunk.tag == TAG_DOUBLE): a, i = getFloats(chunks, index, 5) return None, i if (chunk.tag in [TAG_POSITION, TAG_VECTOR_3D]): a, i = getFloats(chunks, i, 2) return None, i def getDiscontinuityInfo(chunks, index, inventor): a1, i = getFloatArray(chunks, index) a2, i = getFloatArray(chunks, i) a3, i = getFloatArray(chunks, i) a4, i = getFloatArray(chunks, i) a5, i = getFloatArray(chunks, i) a6, i = getFloatArray(chunks, i) if (inventor): e, i = getBoolean(chunks, i) else: e = False return (a1, a2, a3, a4, a5, a6, e), i def rotateShape(shape, dir): # Setting the axis directly doesn't work for directions other than x-axis! angle = degrees(DIR_Z.getAngle(dir)) if (isEqual1D(angle, 0)): <|code_end|> . Write the next line using the current file imports: import traceback, Part, Draft, os, FreeCAD, re from importerUtils import * from FreeCAD import Vector as VEC, Rotation as ROT, Placement as PLC, Matrix as MAT, Base from math import pi, fabs, degrees, asin, sin, cos, tan, atan2, ceil, e, cosh, sinh, tanh, acos, acosh, asin, asinh, atan, atanh, log, sqrt, exp, log10 from importerConstants import MIN_0, MIN_PI, MIN_PI2, MIN_INF, MAX_2PI, MAX_PI, MAX_PI2, MAX_INF, MAX_LEN from importerConstants import CENTER, DIR_X, DIR_Y, DIR_Z, ENCODING_FS and context from other files: # Path: importerConstants.py # MIN_0 = 0.0 # # MIN_PI = -pi # # MIN_PI2 = -pi / 2 # # MIN_INF = float('-inf') # # MAX_2PI = 2 * pi # # MAX_PI = pi # # MAX_PI2 = pi / 2 # # MAX_INF = float('inf') # # MAX_LEN = 2e+100 # # Path: importerConstants.py # CENTER = VEC(0, 0, 0) # # DIR_X = VEC(1, 0, 0) # # DIR_Y = VEC(0, 1, 0) # # DIR_Z = VEC(0, 0, 1) # # ENCODING_FS = 'utf8' , which may include functions, classes, or code. Output only the next line.
axis = DIR_Z.cross(dir) if angle != 180 else DIR_X
Continue the code snippet: <|code_start|> self.weights = [[]] # sequence of sequence float self.vMults = () # tuple of int, ref. umults self.vKnots = () # tuple of float self.vPeriodic = vPeriodic # boolean self.vDegree = vDegree # int def readPoints3DMap(self, countU, countV, chunks, index): # row definitions self.uKnots, self.uMults, i = readKnotsMults(countU, chunks, index) # column definitions self.vKnots, self.vMults, i = readKnotsMults(countV, chunks, i) us = sum(self.uMults) - (self.uDegree - 1) vs = sum(self.vMults) - (self.vDegree - 1) self.poles = [[None for c in range(0, vs)] for r in range(0, us)] self.weights = [[1 for c in range(0, vs)] for r in range(0, us)] if (self.rational) else None for v in range(0, vs): for u in range(0, us): self.poles[u][v], i = getLocation(chunks, i) if (self.rational): self.weights[u][v], i = getFloat(chunks, i) self.uKnots, self.uMults, self.uPeriodic = adjustMultsKnots(self.uKnots, self.uMults, self.uPeriodic, self.uDegree) self.vKnots, self.vMults, self.vPeriodic = adjustMultsKnots(self.vKnots, self.vMults, self.vPeriodic, self.vDegree) return i class Helix(object): def __init__(self): self.radAngles = Interval(Range('I', 1.0), Range('I', 1.0)) self.posCenter = CENTER self.dirMajor = DIR_X <|code_end|> . Use current file imports: import traceback, Part, Draft, os, FreeCAD, re from importerUtils import * from FreeCAD import Vector as VEC, Rotation as ROT, Placement as PLC, Matrix as MAT, Base from math import pi, fabs, degrees, asin, sin, cos, tan, atan2, ceil, e, cosh, sinh, tanh, acos, acosh, asin, asinh, atan, atanh, log, sqrt, exp, log10 from importerConstants import MIN_0, MIN_PI, MIN_PI2, MIN_INF, MAX_2PI, MAX_PI, MAX_PI2, MAX_INF, MAX_LEN from importerConstants import CENTER, DIR_X, DIR_Y, DIR_Z, ENCODING_FS and context (classes, functions, or code) from other files: # Path: importerConstants.py # MIN_0 = 0.0 # # MIN_PI = -pi # # MIN_PI2 = -pi / 2 # # MIN_INF = float('-inf') # # MAX_2PI = 2 * pi # # MAX_PI = pi # # MAX_PI2 = pi / 2 # # MAX_INF = float('inf') # # MAX_LEN = 2e+100 # # Path: importerConstants.py # CENTER = VEC(0, 0, 0) # # DIR_X = VEC(1, 0, 0) # # DIR_Y = VEC(0, 1, 0) # # DIR_Z = VEC(0, 0, 1) # # ENCODING_FS = 'utf8' . Output only the next line.
self.dirMinor = DIR_Y
Given the code snippet: <|code_start|> if (surface is not None): i = surface.setSubtype(chunks, i) except: logError(traceback.format_exc()) raise Exception("Unknown surface-type '%s'!" % (subtype)) return surface, i #FIXME: this is a dirty hack :( if (chunk.tag == TAG_DOUBLE): a, i = getFloats(chunks, index, 5) return None, i if (chunk.tag in [TAG_POSITION, TAG_VECTOR_3D]): a, i = getFloats(chunks, i, 2) return None, i def getDiscontinuityInfo(chunks, index, inventor): a1, i = getFloatArray(chunks, index) a2, i = getFloatArray(chunks, i) a3, i = getFloatArray(chunks, i) a4, i = getFloatArray(chunks, i) a5, i = getFloatArray(chunks, i) a6, i = getFloatArray(chunks, i) if (inventor): e, i = getBoolean(chunks, i) else: e = False return (a1, a2, a3, a4, a5, a6, e), i def rotateShape(shape, dir): # Setting the axis directly doesn't work for directions other than x-axis! <|code_end|> , generate the next line using the imports in this file: import traceback, Part, Draft, os, FreeCAD, re from importerUtils import * from FreeCAD import Vector as VEC, Rotation as ROT, Placement as PLC, Matrix as MAT, Base from math import pi, fabs, degrees, asin, sin, cos, tan, atan2, ceil, e, cosh, sinh, tanh, acos, acosh, asin, asinh, atan, atanh, log, sqrt, exp, log10 from importerConstants import MIN_0, MIN_PI, MIN_PI2, MIN_INF, MAX_2PI, MAX_PI, MAX_PI2, MAX_INF, MAX_LEN from importerConstants import CENTER, DIR_X, DIR_Y, DIR_Z, ENCODING_FS and context (functions, classes, or occasionally code) from other files: # Path: importerConstants.py # MIN_0 = 0.0 # # MIN_PI = -pi # # MIN_PI2 = -pi / 2 # # MIN_INF = float('-inf') # # MAX_2PI = 2 * pi # # MAX_PI = pi # # MAX_PI2 = pi / 2 # # MAX_INF = float('inf') # # MAX_LEN = 2e+100 # # Path: importerConstants.py # CENTER = VEC(0, 0, 0) # # DIR_X = VEC(1, 0, 0) # # DIR_Y = VEC(0, 1, 0) # # DIR_Z = VEC(0, 0, 1) # # ENCODING_FS = 'utf8' . Output only the next line.
angle = degrees(DIR_Z.getAngle(dir))
Based on the snippet: <|code_start|>TOKEN_TRANSLATIONS = { '0x0a': TAG_TRUE, '0x0A': TAG_TRUE, '0x0b': TAG_FALSE, '0x0B': TAG_FALSE, '{': TAG_SUBTYPE_OPEN, '}': TAG_SUBTYPE_CLOSE, '#': TAG_TERMINATOR } _reader = None _getSLong = getSInt32 _getULong = getUInt32 def getReader(): global _reader return _reader def setReader(reader): global _reader clearEntities() _reader = reader def getDcAttributes(): global _dcIdxAttributes return _dcIdxAttributes def _getStr_(data, offset, end): txt = data[offset: end].decode('cp1252') if (sys.version_info.major < 3): <|code_end|> , predict the immediate next line with the help of imports: import traceback, Part, Draft, os, FreeCAD, re from importerUtils import * from FreeCAD import Vector as VEC, Rotation as ROT, Placement as PLC, Matrix as MAT, Base from math import pi, fabs, degrees, asin, sin, cos, tan, atan2, ceil, e, cosh, sinh, tanh, acos, acosh, asin, asinh, atan, atanh, log, sqrt, exp, log10 from importerConstants import MIN_0, MIN_PI, MIN_PI2, MIN_INF, MAX_2PI, MAX_PI, MAX_PI2, MAX_INF, MAX_LEN from importerConstants import CENTER, DIR_X, DIR_Y, DIR_Z, ENCODING_FS and context (classes, functions, sometimes code) from other files: # Path: importerConstants.py # MIN_0 = 0.0 # # MIN_PI = -pi # # MIN_PI2 = -pi / 2 # # MIN_INF = float('-inf') # # MAX_2PI = 2 * pi # # MAX_PI = pi # # MAX_PI2 = pi / 2 # # MAX_INF = float('inf') # # MAX_LEN = 2e+100 # # Path: importerConstants.py # CENTER = VEC(0, 0, 0) # # DIR_X = VEC(1, 0, 0) # # DIR_Y = VEC(0, 1, 0) # # DIR_Z = VEC(0, 0, 1) # # ENCODING_FS = 'utf8' . Output only the next line.
txt = txt.encode(ENCODING_FS).decode("utf8")
Based on the snippet: <|code_start|>class Table(object): def __init__(self): self._table_entries = dict() def get(self, name, default=KeyError): try: return self._table_entries[name] except KeyError: if default is KeyError: raise else: return default def __getitem__(self, item): return self.get(item) def __contains__(self, name): return name in self._table_entries def __iter__(self): return iter(self._table_entries.values()) def __len__(self): return len(self._table_entries) def names(self): return sorted(self._table_entries.keys()) def entry_tags(self, tags): <|code_end|> , predict the immediate next line with the help of imports: from .tags import TagGroups from .tags import Tags and context (classes, functions, sometimes code) from other files: # Path: dxfgrabber/tags.py # class TagGroups(list): # """ # Group of tags starting with a SplitTag and ending before the next SplitTag. # # A SplitTag is a tag with code == splitcode, like (0, 'SECTION') for splitcode=0. # # """ # def __init__(self, tags, split_code=0): # super(TagGroups, self).__init__() # self._build_groups(tags, split_code) # # def _build_groups(self, tags, splitcode): # def append(tag): # first do nothing, skip tags in front of the first split tag # pass # group = None # for tag in tags: # has to work with iterators/generators # if tag.code == splitcode: # if group is not None: # self.append(group) # group = Tags([tag]) # append = group.append # redefine append: add tags to this group # else: # append(tag) # if group is not None: # self.append(group) # # def get_name(self, index): # return self[index][0].value # # @staticmethod # def from_text(text, split_code=0): # return TagGroups(Tags.from_text(text), split_code) # # Path: dxfgrabber/tags.py # class Tags(list): # """ DXFTag() chunk as flat list. """ # def find_all(self, code): # """ Returns a list of DXFTag(code, ...). """ # return [tag for tag in self if tag.code == code] # # def tag_index(self, code, start=0, end=None): # """Return first index of DXFTag(code, value). # """ # if end is None: # end = len(self) # index = start # while index < end: # if self[index].code == code: # return index # index += 1 # raise ValueError(code) # # def get_value(self, code): # for tag in self: # if tag.code == code: # return tag.value # raise ValueError(code) # # @staticmethod # def from_text(text): # return Tags(string_tagger(text)) # # def get_type(self): # return self.__getitem__(0).value # # def plain_tags(self): # yield no app data and no xdata # is_app_data = False # for tag in self: # if tag.code >= 1000: # skip xdata # continue # if tag.code == APP_DATA_MARKER: # if is_app_data: # tag.value == '}' # is_app_data = False # end of app data # else: # value == '{APPID' # is_app_data = True # start of app data # continue # if not is_app_data: # yield tag # # def xdata(self): # index = 0 # end = len(self) # while index < end: # if self[index].code > 999: # all xdata tag codes are >= 1000 # return self[index:] # xdata is always at the end of the DXF entity # index += 1 # return [] # # def app_data(self): # app_data = {} # app_tags = None # for tag in self: # if tag.code == APP_DATA_MARKER: # if tag.value == '}': # end of app data # app_tags.append(tag) # app_data[app_tags[0].value] = app_tags # app_tags = None # else: # app_tags = [tag] # else: # if app_tags is not None: # collection app data # app_tags.append(tag) # return app_data # # def subclasses(self): # classes = {} # name = 'noname' # tags = [] # for tag in self.plain_tags(): # if tag.code == SUBCLASS_MARKER: # classes[name] = tags # tags = [] # name = tag.value # else: # tags.append(tag) # classes[name] = tags # return classes # # def get_subclass(self, name): # classes = self.subclasses() # return classes.get(name, 'noname') . Output only the next line.
groups = TagGroups(tags)
Predict the next line for this snippet: <|code_start|> def get(self, name, default=KeyError): try: return self._table_entries[name] except KeyError: if default is KeyError: raise else: return default def __getitem__(self, item): return self.get(item) def __contains__(self, name): return name in self._table_entries def __iter__(self): return iter(self._table_entries.values()) def __len__(self): return len(self._table_entries) def names(self): return sorted(self._table_entries.keys()) def entry_tags(self, tags): groups = TagGroups(tags) assert groups.get_name(0) == 'TABLE' assert groups.get_name(-1) == 'ENDTAB' for entrytags in groups[1:-1]: <|code_end|> with the help of current file imports: from .tags import TagGroups from .tags import Tags and context from other files: # Path: dxfgrabber/tags.py # class TagGroups(list): # """ # Group of tags starting with a SplitTag and ending before the next SplitTag. # # A SplitTag is a tag with code == splitcode, like (0, 'SECTION') for splitcode=0. # # """ # def __init__(self, tags, split_code=0): # super(TagGroups, self).__init__() # self._build_groups(tags, split_code) # # def _build_groups(self, tags, splitcode): # def append(tag): # first do nothing, skip tags in front of the first split tag # pass # group = None # for tag in tags: # has to work with iterators/generators # if tag.code == splitcode: # if group is not None: # self.append(group) # group = Tags([tag]) # append = group.append # redefine append: add tags to this group # else: # append(tag) # if group is not None: # self.append(group) # # def get_name(self, index): # return self[index][0].value # # @staticmethod # def from_text(text, split_code=0): # return TagGroups(Tags.from_text(text), split_code) # # Path: dxfgrabber/tags.py # class Tags(list): # """ DXFTag() chunk as flat list. """ # def find_all(self, code): # """ Returns a list of DXFTag(code, ...). """ # return [tag for tag in self if tag.code == code] # # def tag_index(self, code, start=0, end=None): # """Return first index of DXFTag(code, value). # """ # if end is None: # end = len(self) # index = start # while index < end: # if self[index].code == code: # return index # index += 1 # raise ValueError(code) # # def get_value(self, code): # for tag in self: # if tag.code == code: # return tag.value # raise ValueError(code) # # @staticmethod # def from_text(text): # return Tags(string_tagger(text)) # # def get_type(self): # return self.__getitem__(0).value # # def plain_tags(self): # yield no app data and no xdata # is_app_data = False # for tag in self: # if tag.code >= 1000: # skip xdata # continue # if tag.code == APP_DATA_MARKER: # if is_app_data: # tag.value == '}' # is_app_data = False # end of app data # else: # value == '{APPID' # is_app_data = True # start of app data # continue # if not is_app_data: # yield tag # # def xdata(self): # index = 0 # end = len(self) # while index < end: # if self[index].code > 999: # all xdata tag codes are >= 1000 # return self[index:] # xdata is always at the end of the DXF entity # index += 1 # return [] # # def app_data(self): # app_data = {} # app_tags = None # for tag in self: # if tag.code == APP_DATA_MARKER: # if tag.value == '}': # end of app data # app_tags.append(tag) # app_data[app_tags[0].value] = app_tags # app_tags = None # else: # app_tags = [tag] # else: # if app_tags is not None: # collection app data # app_tags.append(tag) # return app_data # # def subclasses(self): # classes = {} # name = 'noname' # tags = [] # for tag in self.plain_tags(): # if tag.code == SUBCLASS_MARKER: # classes[name] = tags # tags = [] # name = tag.value # else: # tags.append(tag) # classes[name] = tags # return classes # # def get_subclass(self, name): # classes = self.subclasses() # return classes.get(name, 'noname') , which may contain function names, class names, or code. Output only the next line.
yield Tags(entrytags)
Given the following code snippet before the placeholder: <|code_start|> __author__ = 'Jens M. Plonka' __copyright__ = 'Copyright 2018, Germany' __url__ = "https://www.github.com/jmplonka/InventorLoader" class Transformation2D(object): def __init__(self): self.a0 = 0x00000000 self.m = [[1,0,0],[0,1,0],[0,0,1]] def read(self, data, offset): self.a0, i = getUInt32(data, offset) # +--- Value for the 3. row to be used for the transformation matrix # |+-- Value for the 2. row to be used for the transformation matrix # ||+- Value for the 1. row to be used for the transformation matrix # ||| # vvv m1 = (self.a0 & 0x00FF0000) >> 16 # +------- Mask for the 3. row of the transformation matrix # |+------ Mask for the 2. row of the transformation matrix # ||+----- Mask for the 1. row of the transformation matrix # ||| # vvv m2 = (self.a0 & 0x000001FF) for row in range(3): for col in range(3): j = col + 3 * row b = (1 << j) if ((m1 & b) == 0): if ((m2 & b) == 0): <|code_end|> , predict the next line using imports from the current file: from importerUtils import getFloat64, getUInt32, getUInt16, FloatArr2Str, logError from FreeCAD import Rotation as ROT, Vector as VEC, Matrix as MAT import math and context including class names, function names, and sometimes code from other files: # Path: importerUtils.py # def getFloat64(data, offset): # ''' # Returns a double precision float value. # Args: # data # A binary string. # offset # The zero based offset of the array. # Returns: # The double precision float value at offset. # The new position in the 'stream'. # ''' # val, = FLOAT64(data, offset) # return val, offset + 8 # # def getUInt32(data, offset): # ''' # Returns a single unsingned 32-Bit value. # Args: # data # A binary string. # offset # The zero based offset of the unsigned 32-Bit value. # Returns: # The unsigned 32-Bit value at offset. # The new position in the 'stream'. # ''' # val, = UINT32(data, offset) # return val, offset + 4 # # def getUInt16(data, offset): # ''' # Returns a single unsingned 16-Bit value. # Args: # data # A binary string. # offset # The zero based offset of the unsigned 16-Bit value. # Returns: # The unsigned 16-Bit value at offset. # The new position in the 'stream'. # ''' # val, = UINT16(data, offset) # return val, offset + 2 # # def FloatArr2Str(arr): # return (', '.join(['%g' %(f) for f in arr])) # # def logError(msg, *args): # if (__prmPrefOW__.GetBool("checkError", True)): _log("logError", Console.PrintError, msg, args) . Output only the next line.
value, i = getFloat64(data, i)
Here is a snippet: <|code_start|># -*- coding: utf-8 -*- ''' importerTransformation.py: Importer for the Document's components Simple approach to read/analyse Autodesk (R) Invetor (R) part file's (IPT) browser view data. The importer can read files from Autodesk (R) Invetor (R) Inventro V2010 on. Older versions will fail! TODO: ''' __author__ = 'Jens M. Plonka' __copyright__ = 'Copyright 2018, Germany' __url__ = "https://www.github.com/jmplonka/InventorLoader" class Transformation2D(object): def __init__(self): self.a0 = 0x00000000 self.m = [[1,0,0],[0,1,0],[0,0,1]] def read(self, data, offset): <|code_end|> . Write the next line using the current file imports: from importerUtils import getFloat64, getUInt32, getUInt16, FloatArr2Str, logError from FreeCAD import Rotation as ROT, Vector as VEC, Matrix as MAT import math and context from other files: # Path: importerUtils.py # def getFloat64(data, offset): # ''' # Returns a double precision float value. # Args: # data # A binary string. # offset # The zero based offset of the array. # Returns: # The double precision float value at offset. # The new position in the 'stream'. # ''' # val, = FLOAT64(data, offset) # return val, offset + 8 # # def getUInt32(data, offset): # ''' # Returns a single unsingned 32-Bit value. # Args: # data # A binary string. # offset # The zero based offset of the unsigned 32-Bit value. # Returns: # The unsigned 32-Bit value at offset. # The new position in the 'stream'. # ''' # val, = UINT32(data, offset) # return val, offset + 4 # # def getUInt16(data, offset): # ''' # Returns a single unsingned 16-Bit value. # Args: # data # A binary string. # offset # The zero based offset of the unsigned 16-Bit value. # Returns: # The unsigned 16-Bit value at offset. # The new position in the 'stream'. # ''' # val, = UINT16(data, offset) # return val, offset + 2 # # def FloatArr2Str(arr): # return (', '.join(['%g' %(f) for f in arr])) # # def logError(msg, *args): # if (__prmPrefOW__.GetBool("checkError", True)): _log("logError", Console.PrintError, msg, args) , which may include functions, classes, or code. Output only the next line.
self.a0, i = getUInt32(data, offset)
Using the snippet: <|code_start|> if (d1 & b): mask += '-' if (d2 & b) else '0' else: mask += '+' if (d2 & b) else 'x' if (((j+1) % 3) == 0): mask += '|' return u' transformation={a0=%s m=%s}' %(mask, m) def __repr__(self): m0 = self.__m2s__(0) m1 = self.__m2s__(1) m2 = self.__m2s__(2) return u"[%s, %s, %s]" %(m0, m1, m2) class Transformation3D(object): def __init__(self): self.a0 = 0x00000000 self.m = [[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]] def read(self, data, offset): n, k = getUInt32(data, offset) if (n == 0x00000203): i = k else: i = offset ''' +---- Value for the 4. row to be used for the transformation matrix |+--- Value for the 3. row to be used for the transformation matrix ||+-- Value for the 2. row to be used for the transformation matrix |||+- Value for the 1. row to be used for the transformation matrix |||| vvvv ''' <|code_end|> , determine the next line of code. You have imports: from importerUtils import getFloat64, getUInt32, getUInt16, FloatArr2Str, logError from FreeCAD import Rotation as ROT, Vector as VEC, Matrix as MAT import math and context (class names, function names, or code) available: # Path: importerUtils.py # def getFloat64(data, offset): # ''' # Returns a double precision float value. # Args: # data # A binary string. # offset # The zero based offset of the array. # Returns: # The double precision float value at offset. # The new position in the 'stream'. # ''' # val, = FLOAT64(data, offset) # return val, offset + 8 # # def getUInt32(data, offset): # ''' # Returns a single unsingned 32-Bit value. # Args: # data # A binary string. # offset # The zero based offset of the unsigned 32-Bit value. # Returns: # The unsigned 32-Bit value at offset. # The new position in the 'stream'. # ''' # val, = UINT32(data, offset) # return val, offset + 4 # # def getUInt16(data, offset): # ''' # Returns a single unsingned 16-Bit value. # Args: # data # A binary string. # offset # The zero based offset of the unsigned 16-Bit value. # Returns: # The unsigned 16-Bit value at offset. # The new position in the 'stream'. # ''' # val, = UINT16(data, offset) # return val, offset + 2 # # def FloatArr2Str(arr): # return (', '.join(['%g' %(f) for f in arr])) # # def logError(msg, *args): # if (__prmPrefOW__.GetBool("checkError", True)): _log("logError", Console.PrintError, msg, args) . Output only the next line.
d1, i = getUInt16(data, i)
Given snippet: <|code_start|> def __init__(self, menuText = None, toolTip = None, pixmap = None, accel=None): self.resources = {} self.addResource('MenuText', menuText) self.addResource('ToolTip', toolTip) self.addResource('Pixmap', pixmap) self.addResource('Accel', accel) def addResource(self, resource, value): if (not value is None): self.resources[resource] = value def GetResources(self): return self.resources def IsActive(self): return not (FreeCAD.ActiveDocument is None) class _CmdAbstract(_CmdNoCommand): def __init__(self, menuText = None, toolTip = None, pixmap = None, accel=None): super(_CmdAbstract, self).__init__(menuText, toolTip, pixmap, accel) def Activated(self): dlg = QMessageBox(QMessageBox.Information, 'FreeCAD: Inventor workbench...', 'Command not ' + self.__class__.__name__ + ' yet implemented!') dlg.setWindowModality(Qt.ApplicationModal) dlg.exec_() def commit(self, name, commands): FreeCAD.ActiveDocument.openTransaction(str(name)) for command in commands: FreeCADGui.doCommand(command) FreeCAD.ActiveDocument.commitTransaction() # Sketch class _CmdSketch2D(_CmdAbstract): def __init__(self): <|code_end|> , continue by predicting the next line. Consider current file imports: import os, sys, FreeCAD, FreeCADGui import InventorViewProviders import imp import importlib import SketcherGui import DraftGui import Part import PartDesign import PartDesign from InventorViewProviders import * from FreeCADGui import Workbench, addCommand from importerUtils import getIconPath from PySide.QtGui import QMessageBox from PySide.QtCore import Qt and context: # Path: importerUtils.py # def getIconPath(fileName): # return os.path.join(os.path.dirname(__file__), "Resources", "icons", fileName) which might include code, classes, or functions. Output only the next line.
super(_CmdSketch2D, self).__init__(menuText="&2D Sketch", toolTip="Creates an 2D sketch", pixmap=getIconPath("Sketch2D.png"), accel="I, 2")
Given the code snippet: <|code_start|>class _ViewProvider(object): def __init__(self, vp): vp.Proxy = self def attach(self, vp): self.ViewObject = vp self.Object = vp.Object def onChanged(self, vp, prop): return def setEdit(self, vp, mode): return False def unsetEdit(self, vp, mode): return def __getstate__(self): return None def __setstate__(self,state): return None def getDisplayModes(self, vp): return ["Shaded", "Wireframe", "Flat Lines"] def getDefaultDisplayMode(self): return "Shaded" def setDisplayMode(self, mode): return mode class _ViewProviderBoundaryPatch(_ViewProvider): def __init__(self, vp): super(_ViewProviderBoundaryPatch, self).__init__(vp) def getIcon(self): <|code_end|> , generate the next line using the imports in this file: import os, re, sys, Part, FreeCAD, FreeCADGui from importerUtils import logInfo, getIconPath, getTableValue, setTableValue, logInfo, logWarning, logError, getCellRef, setTableValue, calcAliasname from FreeCAD import Vector as VEC from importerClasses import ParameterTableModel, VariantTableModel from math import degrees, radians, pi, sqrt, cos, sin, atan from PySide.QtCore import * from PySide.QtGui import * from importerConstants import DIR_X, DIR_Y, DIR_Z and context (functions, classes, or occasionally code) from other files: # Path: importerUtils.py # def logInfo(msg, *args): # if (__prmPrefOW__.GetBool("checkLogging", False)): _log("logInfo", Console.PrintMessage, msg, args) # # def getIconPath(fileName): # return os.path.join(os.path.dirname(__file__), "Resources", "icons", fileName) # # def getTableValue(table, col, row): # try: # return table.get(getCellRef(col, row)) # except: # return None # # def setTableValue(table, col, row, val): # if (type(val) == str): # table.set(getCellRef(col, row), val) # else: # if ((sys.version_info.major <= 2) and (type(val) == unicode)): # table.set(getCellRef(col, row), "%s" %(val.encode("utf8"))) # else: # table.set(getCellRef(col, row), str(val)) # # def logInfo(msg, *args): # if (__prmPrefOW__.GetBool("checkLogging", False)): _log("logInfo", Console.PrintMessage, msg, args) # # def logWarning(msg, *args): # if (__prmPrefOW__.GetBool("checkWarning", False)): _log("logWarning", Console.PrintWarning, msg, args) # # def logError(msg, *args): # if (__prmPrefOW__.GetBool("checkError", True)): _log("logError", Console.PrintError, msg, args) # # def getCellRef(col, row): # if (isString(col)): # return u"%s%d" %(col, row) # return u"%s%d" %(int2col(col), row) # # def setTableValue(table, col, row, val): # if (type(val) == str): # table.set(getCellRef(col, row), val) # else: # if ((sys.version_info.major <= 2) and (type(val) == unicode)): # table.set(getCellRef(col, row), "%s" %(val.encode("utf8"))) # else: # table.set(getCellRef(col, row), str(val)) # # def calcAliasname(name): # alias = name.replace(':', '_') # if (IS_CELL_REF.search(name)): # return '%s_' %(alias) # # 45, 48..57, 65..90, 97..122 # result = '' # for c in alias: # i = ord(c) # if (i == 45) or (i > 47 and i < 58) or (i > 64 and i < 91) or (i > 96 and i < 123): # result += c # else: # result += '_' # if (result[0] == '_'): # return 'd' + result # return result # # Path: importerClasses.py # class ParameterTableModel(TableModel): # def __init__(self, parent, mylist, *args): # TableModel.__init__(self, parent, mylist, ['Variant', 'Source', 'Property', 'Parameter', 'Value', 'Units'], *args) # def flags(self, index): # if (index.column() == 0): # return Qt.ItemIsEnabled | Qt.ItemIsEditable | Qt.ItemIsUserCheckable # if (index.column() in [1, 2, 5]): # make object's name and property and unit column read only! # return Qt.ItemIsEnabled # return Qt.ItemIsEnabled |Qt.ItemIsEditable # # class VariantTableModel(TableModel): # def __init__(self, parent, values, *args): # TableModel.__init__(self, parent, values[1:], values[0], *args) # def flags(self, index): # return Qt.ItemIsEnabled | Qt.ItemIsEditable # # Path: importerConstants.py # DIR_X = VEC(1, 0, 0) # # DIR_Y = VEC(0, 1, 0) # # DIR_Z = VEC(0, 0, 1) . Output only the next line.
return getIconPath('FxBoundaryPatch.xpm')
Based on the snippet: <|code_start|> def __init__(self, vp): super(_ViewProviderSketch3D, self).__init__(vp) def claimChildren(self): return [] def getIcon(self): return getIconPath("Sketch3D.xpm") def makeSketch3D(name = u"Sketch3D"): fp = createPartFeature("Part::FeaturePython", name) sketch3D = _Sketch3D(fp) if (FreeCAD.GuiUp): _ViewProviderSketch3D(fp.ViewObject) FreeCAD.ActiveDocument.recompute() return fp class _PartVariants(_ObjectProxy): def __init__(self, fp): super(_PartVariants, self).__init__(fp) fp.addProperty("App::PropertyPythonObject", "Values") fp.addProperty("App::PropertyPythonObject", "Rows").Rows = {} fp.addProperty("App::PropertyPythonObject", "Mapping").Mapping = {} fp.addProperty("App::PropertyPythonObject", "Proxy").Proxy = self fp.addProperty("App::PropertyLink" , "Parameters") fp.addProperty("App::PropertyEnumeration" , "Variant", "iPart") def _getHeadersByRow_(self, table): headers = {} row = 2 # Skip header row <|code_end|> , predict the immediate next line with the help of imports: import os, re, sys, Part, FreeCAD, FreeCADGui from importerUtils import logInfo, getIconPath, getTableValue, setTableValue, logInfo, logWarning, logError, getCellRef, setTableValue, calcAliasname from FreeCAD import Vector as VEC from importerClasses import ParameterTableModel, VariantTableModel from math import degrees, radians, pi, sqrt, cos, sin, atan from PySide.QtCore import * from PySide.QtGui import * from importerConstants import DIR_X, DIR_Y, DIR_Z and context (classes, functions, sometimes code) from other files: # Path: importerUtils.py # def logInfo(msg, *args): # if (__prmPrefOW__.GetBool("checkLogging", False)): _log("logInfo", Console.PrintMessage, msg, args) # # def getIconPath(fileName): # return os.path.join(os.path.dirname(__file__), "Resources", "icons", fileName) # # def getTableValue(table, col, row): # try: # return table.get(getCellRef(col, row)) # except: # return None # # def setTableValue(table, col, row, val): # if (type(val) == str): # table.set(getCellRef(col, row), val) # else: # if ((sys.version_info.major <= 2) and (type(val) == unicode)): # table.set(getCellRef(col, row), "%s" %(val.encode("utf8"))) # else: # table.set(getCellRef(col, row), str(val)) # # def logInfo(msg, *args): # if (__prmPrefOW__.GetBool("checkLogging", False)): _log("logInfo", Console.PrintMessage, msg, args) # # def logWarning(msg, *args): # if (__prmPrefOW__.GetBool("checkWarning", False)): _log("logWarning", Console.PrintWarning, msg, args) # # def logError(msg, *args): # if (__prmPrefOW__.GetBool("checkError", True)): _log("logError", Console.PrintError, msg, args) # # def getCellRef(col, row): # if (isString(col)): # return u"%s%d" %(col, row) # return u"%s%d" %(int2col(col), row) # # def setTableValue(table, col, row, val): # if (type(val) == str): # table.set(getCellRef(col, row), val) # else: # if ((sys.version_info.major <= 2) and (type(val) == unicode)): # table.set(getCellRef(col, row), "%s" %(val.encode("utf8"))) # else: # table.set(getCellRef(col, row), str(val)) # # def calcAliasname(name): # alias = name.replace(':', '_') # if (IS_CELL_REF.search(name)): # return '%s_' %(alias) # # 45, 48..57, 65..90, 97..122 # result = '' # for c in alias: # i = ord(c) # if (i == 45) or (i > 47 and i < 58) or (i > 64 and i < 91) or (i > 96 and i < 123): # result += c # else: # result += '_' # if (result[0] == '_'): # return 'd' + result # return result # # Path: importerClasses.py # class ParameterTableModel(TableModel): # def __init__(self, parent, mylist, *args): # TableModel.__init__(self, parent, mylist, ['Variant', 'Source', 'Property', 'Parameter', 'Value', 'Units'], *args) # def flags(self, index): # if (index.column() == 0): # return Qt.ItemIsEnabled | Qt.ItemIsEditable | Qt.ItemIsUserCheckable # if (index.column() in [1, 2, 5]): # make object's name and property and unit column read only! # return Qt.ItemIsEnabled # return Qt.ItemIsEnabled |Qt.ItemIsEditable # # class VariantTableModel(TableModel): # def __init__(self, parent, values, *args): # TableModel.__init__(self, parent, values[1:], values[0], *args) # def flags(self, index): # return Qt.ItemIsEnabled | Qt.ItemIsEditable # # Path: importerConstants.py # DIR_X = VEC(1, 0, 0) # # DIR_Y = VEC(0, 1, 0) # # DIR_Z = VEC(0, 0, 1) . Output only the next line.
header = getTableValue(table, 'A', row)
Predict the next line after this snippet: <|code_start|> row += 1 header = getTableValue(table, 'A', row) return headers def _updateMapping_(self, fp): if (fp.Values is None): return False if (fp.Parameters is None): return False fp.Mapping.clear() FreeCAD.ActiveDocument.recompute() parameter = self._getHeadersByRow_(fp.Parameters) for col in range(1, len(fp.Values[0])): hdr = fp.Values[0][col] cell = parameter[hdr] fp.Mapping[col] = cell return True def _updateVariant_(self, fp): try: if (not self._updateMapping_(fp)): return False r = fp.Rows[fp.Variant] FreeCAD.Console.PrintMessage("Set parameters according to variant '%s' (row %d):\n" %(fp.Variant, r)) for col in fp.Mapping: prm = fp.Values[0][col] val = fp.Values[r][col] if (hasattr(val, 'Value')): val = val.Value <|code_end|> using the current file's imports: import os, re, sys, Part, FreeCAD, FreeCADGui from importerUtils import logInfo, getIconPath, getTableValue, setTableValue, logInfo, logWarning, logError, getCellRef, setTableValue, calcAliasname from FreeCAD import Vector as VEC from importerClasses import ParameterTableModel, VariantTableModel from math import degrees, radians, pi, sqrt, cos, sin, atan from PySide.QtCore import * from PySide.QtGui import * from importerConstants import DIR_X, DIR_Y, DIR_Z and any relevant context from other files: # Path: importerUtils.py # def logInfo(msg, *args): # if (__prmPrefOW__.GetBool("checkLogging", False)): _log("logInfo", Console.PrintMessage, msg, args) # # def getIconPath(fileName): # return os.path.join(os.path.dirname(__file__), "Resources", "icons", fileName) # # def getTableValue(table, col, row): # try: # return table.get(getCellRef(col, row)) # except: # return None # # def setTableValue(table, col, row, val): # if (type(val) == str): # table.set(getCellRef(col, row), val) # else: # if ((sys.version_info.major <= 2) and (type(val) == unicode)): # table.set(getCellRef(col, row), "%s" %(val.encode("utf8"))) # else: # table.set(getCellRef(col, row), str(val)) # # def logInfo(msg, *args): # if (__prmPrefOW__.GetBool("checkLogging", False)): _log("logInfo", Console.PrintMessage, msg, args) # # def logWarning(msg, *args): # if (__prmPrefOW__.GetBool("checkWarning", False)): _log("logWarning", Console.PrintWarning, msg, args) # # def logError(msg, *args): # if (__prmPrefOW__.GetBool("checkError", True)): _log("logError", Console.PrintError, msg, args) # # def getCellRef(col, row): # if (isString(col)): # return u"%s%d" %(col, row) # return u"%s%d" %(int2col(col), row) # # def setTableValue(table, col, row, val): # if (type(val) == str): # table.set(getCellRef(col, row), val) # else: # if ((sys.version_info.major <= 2) and (type(val) == unicode)): # table.set(getCellRef(col, row), "%s" %(val.encode("utf8"))) # else: # table.set(getCellRef(col, row), str(val)) # # def calcAliasname(name): # alias = name.replace(':', '_') # if (IS_CELL_REF.search(name)): # return '%s_' %(alias) # # 45, 48..57, 65..90, 97..122 # result = '' # for c in alias: # i = ord(c) # if (i == 45) or (i > 47 and i < 58) or (i > 64 and i < 91) or (i > 96 and i < 123): # result += c # else: # result += '_' # if (result[0] == '_'): # return 'd' + result # return result # # Path: importerClasses.py # class ParameterTableModel(TableModel): # def __init__(self, parent, mylist, *args): # TableModel.__init__(self, parent, mylist, ['Variant', 'Source', 'Property', 'Parameter', 'Value', 'Units'], *args) # def flags(self, index): # if (index.column() == 0): # return Qt.ItemIsEnabled | Qt.ItemIsEditable | Qt.ItemIsUserCheckable # if (index.column() in [1, 2, 5]): # make object's name and property and unit column read only! # return Qt.ItemIsEnabled # return Qt.ItemIsEnabled |Qt.ItemIsEditable # # class VariantTableModel(TableModel): # def __init__(self, parent, values, *args): # TableModel.__init__(self, parent, values[1:], values[0], *args) # def flags(self, index): # return Qt.ItemIsEnabled | Qt.ItemIsEditable # # Path: importerConstants.py # DIR_X = VEC(1, 0, 0) # # DIR_Y = VEC(0, 1, 0) # # DIR_Z = VEC(0, 0, 1) . Output only the next line.
setTableValue(fp.Parameters, 'B', fp.Mapping[col], val)
Given snippet: <|code_start|> if (obj.TypeId == 'Sketcher::SketchObject'): for c, constraint in enumerate(obj.Constraints): if (constraint.Type in DIM_CONSTRAINTS): prp = 'Constraints[%d]' %(c) value = getExpression(obj, prp) if (value is None): value = constraint.Value if (constraint.Type == 'Angle'): value = degrees(value) values.append([False, obj.Name, prp, 'd_%d' %(len(values)), str(value), DIM_CONSTRAINTS[constraint.Type]]) else: for prp in obj.PropertiesList: if (obj.getTypeIdOfProperty(prp) in XPR_PROPERTIES): value = getExpression(obj, prp) if (value is None): value = getattr(obj, prp) if (hasattr(value, 'Value')): value = value.Value values.append([False, obj.Name, prp, 'd_%d' %(len(values)), str(value), XPR_PROPERTIES[obj.getTypeIdOfProperty(prp)]]) return values def getParametersValues(doc): table = None for t in doc.getObjectsByLabel('Parameters'): if (t.TypeId == 'Spreadsheet::Sheet'): table = t break if (table is None): return None, None, True if ((table.get('A1') != 'Parameter') or (table.get('B1') != 'Value')): <|code_end|> , continue by predicting the next line. Consider current file imports: import os, re, sys, Part, FreeCAD, FreeCADGui from importerUtils import logInfo, getIconPath, getTableValue, setTableValue, logInfo, logWarning, logError, getCellRef, setTableValue, calcAliasname from FreeCAD import Vector as VEC from importerClasses import ParameterTableModel, VariantTableModel from math import degrees, radians, pi, sqrt, cos, sin, atan from PySide.QtCore import * from PySide.QtGui import * from importerConstants import DIR_X, DIR_Y, DIR_Z and context: # Path: importerUtils.py # def logInfo(msg, *args): # if (__prmPrefOW__.GetBool("checkLogging", False)): _log("logInfo", Console.PrintMessage, msg, args) # # def getIconPath(fileName): # return os.path.join(os.path.dirname(__file__), "Resources", "icons", fileName) # # def getTableValue(table, col, row): # try: # return table.get(getCellRef(col, row)) # except: # return None # # def setTableValue(table, col, row, val): # if (type(val) == str): # table.set(getCellRef(col, row), val) # else: # if ((sys.version_info.major <= 2) and (type(val) == unicode)): # table.set(getCellRef(col, row), "%s" %(val.encode("utf8"))) # else: # table.set(getCellRef(col, row), str(val)) # # def logInfo(msg, *args): # if (__prmPrefOW__.GetBool("checkLogging", False)): _log("logInfo", Console.PrintMessage, msg, args) # # def logWarning(msg, *args): # if (__prmPrefOW__.GetBool("checkWarning", False)): _log("logWarning", Console.PrintWarning, msg, args) # # def logError(msg, *args): # if (__prmPrefOW__.GetBool("checkError", True)): _log("logError", Console.PrintError, msg, args) # # def getCellRef(col, row): # if (isString(col)): # return u"%s%d" %(col, row) # return u"%s%d" %(int2col(col), row) # # def setTableValue(table, col, row, val): # if (type(val) == str): # table.set(getCellRef(col, row), val) # else: # if ((sys.version_info.major <= 2) and (type(val) == unicode)): # table.set(getCellRef(col, row), "%s" %(val.encode("utf8"))) # else: # table.set(getCellRef(col, row), str(val)) # # def calcAliasname(name): # alias = name.replace(':', '_') # if (IS_CELL_REF.search(name)): # return '%s_' %(alias) # # 45, 48..57, 65..90, 97..122 # result = '' # for c in alias: # i = ord(c) # if (i == 45) or (i > 47 and i < 58) or (i > 64 and i < 91) or (i > 96 and i < 123): # result += c # else: # result += '_' # if (result[0] == '_'): # return 'd' + result # return result # # Path: importerClasses.py # class ParameterTableModel(TableModel): # def __init__(self, parent, mylist, *args): # TableModel.__init__(self, parent, mylist, ['Variant', 'Source', 'Property', 'Parameter', 'Value', 'Units'], *args) # def flags(self, index): # if (index.column() == 0): # return Qt.ItemIsEnabled | Qt.ItemIsEditable | Qt.ItemIsUserCheckable # if (index.column() in [1, 2, 5]): # make object's name and property and unit column read only! # return Qt.ItemIsEnabled # return Qt.ItemIsEnabled |Qt.ItemIsEditable # # class VariantTableModel(TableModel): # def __init__(self, parent, values, *args): # TableModel.__init__(self, parent, values[1:], values[0], *args) # def flags(self, index): # return Qt.ItemIsEnabled | Qt.ItemIsEditable # # Path: importerConstants.py # DIR_X = VEC(1, 0, 0) # # DIR_Y = VEC(0, 1, 0) # # DIR_Z = VEC(0, 0, 1) which might include code, classes, or functions. Output only the next line.
logWarning("Spreadsheet 'Parameters' doesn't meet layout constraints to serve as parameters table!")
Based on the snippet: <|code_start|> QObject.connect(self.form.btnParamAdd, SIGNAL("clicked()"), self.addParam) QObject.connect(self.form.btnParamDel, SIGNAL("clicked()"), self.delParam) VariantTableModel(table, fp.Values) self.fp = fp def getParameters(self): parameters = [] table = self.fp.Parameters row = 2 parameter = getTableValue(table, 'A', row) while (parameter): parameters.append(parameter) row += 1 parameter = getTableValue(table, 'A', row) return parameters def addPart(self): table = self.form.tableView model = table.model() rows = model.rowCount(table) index = table.currentIndex() if (index.isValid()): row = index.row() + 1 else: row = rows if (model.insertRow(row)): index = model.index(row, 0) model.setData(index, 'Part-%02d' %(rows+1), Qt.EditRole) FreeCAD.ActiveDocument.recompute() else: <|code_end|> , predict the immediate next line with the help of imports: import os, re, sys, Part, FreeCAD, FreeCADGui from importerUtils import logInfo, getIconPath, getTableValue, setTableValue, logInfo, logWarning, logError, getCellRef, setTableValue, calcAliasname from FreeCAD import Vector as VEC from importerClasses import ParameterTableModel, VariantTableModel from math import degrees, radians, pi, sqrt, cos, sin, atan from PySide.QtCore import * from PySide.QtGui import * from importerConstants import DIR_X, DIR_Y, DIR_Z and context (classes, functions, sometimes code) from other files: # Path: importerUtils.py # def logInfo(msg, *args): # if (__prmPrefOW__.GetBool("checkLogging", False)): _log("logInfo", Console.PrintMessage, msg, args) # # def getIconPath(fileName): # return os.path.join(os.path.dirname(__file__), "Resources", "icons", fileName) # # def getTableValue(table, col, row): # try: # return table.get(getCellRef(col, row)) # except: # return None # # def setTableValue(table, col, row, val): # if (type(val) == str): # table.set(getCellRef(col, row), val) # else: # if ((sys.version_info.major <= 2) and (type(val) == unicode)): # table.set(getCellRef(col, row), "%s" %(val.encode("utf8"))) # else: # table.set(getCellRef(col, row), str(val)) # # def logInfo(msg, *args): # if (__prmPrefOW__.GetBool("checkLogging", False)): _log("logInfo", Console.PrintMessage, msg, args) # # def logWarning(msg, *args): # if (__prmPrefOW__.GetBool("checkWarning", False)): _log("logWarning", Console.PrintWarning, msg, args) # # def logError(msg, *args): # if (__prmPrefOW__.GetBool("checkError", True)): _log("logError", Console.PrintError, msg, args) # # def getCellRef(col, row): # if (isString(col)): # return u"%s%d" %(col, row) # return u"%s%d" %(int2col(col), row) # # def setTableValue(table, col, row, val): # if (type(val) == str): # table.set(getCellRef(col, row), val) # else: # if ((sys.version_info.major <= 2) and (type(val) == unicode)): # table.set(getCellRef(col, row), "%s" %(val.encode("utf8"))) # else: # table.set(getCellRef(col, row), str(val)) # # def calcAliasname(name): # alias = name.replace(':', '_') # if (IS_CELL_REF.search(name)): # return '%s_' %(alias) # # 45, 48..57, 65..90, 97..122 # result = '' # for c in alias: # i = ord(c) # if (i == 45) or (i > 47 and i < 58) or (i > 64 and i < 91) or (i > 96 and i < 123): # result += c # else: # result += '_' # if (result[0] == '_'): # return 'd' + result # return result # # Path: importerClasses.py # class ParameterTableModel(TableModel): # def __init__(self, parent, mylist, *args): # TableModel.__init__(self, parent, mylist, ['Variant', 'Source', 'Property', 'Parameter', 'Value', 'Units'], *args) # def flags(self, index): # if (index.column() == 0): # return Qt.ItemIsEnabled | Qt.ItemIsEditable | Qt.ItemIsUserCheckable # if (index.column() in [1, 2, 5]): # make object's name and property and unit column read only! # return Qt.ItemIsEnabled # return Qt.ItemIsEnabled |Qt.ItemIsEditable # # class VariantTableModel(TableModel): # def __init__(self, parent, values, *args): # TableModel.__init__(self, parent, values[1:], values[0], *args) # def flags(self, index): # return Qt.ItemIsEnabled | Qt.ItemIsEditable # # Path: importerConstants.py # DIR_X = VEC(1, 0, 0) # # DIR_Y = VEC(0, 1, 0) # # DIR_Z = VEC(0, 0, 1) . Output only the next line.
logError("Failed to insert row %d", row)
Continue the code snippet: <|code_start|> value = value.Value values.append([False, obj.Name, prp, 'd_%d' %(len(values)), str(value), XPR_PROPERTIES[obj.getTypeIdOfProperty(prp)]]) return values def getParametersValues(doc): table = None for t in doc.getObjectsByLabel('Parameters'): if (t.TypeId == 'Spreadsheet::Sheet'): table = t break if (table is None): return None, None, True if ((table.get('A1') != 'Parameter') or (table.get('B1') != 'Value')): logWarning("Spreadsheet 'Parameters' doesn't meet layout constraints to serve as parameters table!") logWarning("First row must be 'Parameter', 'Value', 'Unit', 'Source' - creating new one.") return None, None, True hasUnit = (table.get('C1') == 'Unit') hasSource = (table.get('D1') == 'Source') hasProperty = (table.get('E1') == 'Property') row = 2 values = [] while (True): name = getTableValue(table, 'A', row) if (name is None): break value = getTableValue(table, 'B', row) unit = None if (hasUnit): unit = getTableValue(table, 'C', row) else: <|code_end|> . Use current file imports: import os, re, sys, Part, FreeCAD, FreeCADGui from importerUtils import logInfo, getIconPath, getTableValue, setTableValue, logInfo, logWarning, logError, getCellRef, setTableValue, calcAliasname from FreeCAD import Vector as VEC from importerClasses import ParameterTableModel, VariantTableModel from math import degrees, radians, pi, sqrt, cos, sin, atan from PySide.QtCore import * from PySide.QtGui import * from importerConstants import DIR_X, DIR_Y, DIR_Z and context (classes, functions, or code) from other files: # Path: importerUtils.py # def logInfo(msg, *args): # if (__prmPrefOW__.GetBool("checkLogging", False)): _log("logInfo", Console.PrintMessage, msg, args) # # def getIconPath(fileName): # return os.path.join(os.path.dirname(__file__), "Resources", "icons", fileName) # # def getTableValue(table, col, row): # try: # return table.get(getCellRef(col, row)) # except: # return None # # def setTableValue(table, col, row, val): # if (type(val) == str): # table.set(getCellRef(col, row), val) # else: # if ((sys.version_info.major <= 2) and (type(val) == unicode)): # table.set(getCellRef(col, row), "%s" %(val.encode("utf8"))) # else: # table.set(getCellRef(col, row), str(val)) # # def logInfo(msg, *args): # if (__prmPrefOW__.GetBool("checkLogging", False)): _log("logInfo", Console.PrintMessage, msg, args) # # def logWarning(msg, *args): # if (__prmPrefOW__.GetBool("checkWarning", False)): _log("logWarning", Console.PrintWarning, msg, args) # # def logError(msg, *args): # if (__prmPrefOW__.GetBool("checkError", True)): _log("logError", Console.PrintError, msg, args) # # def getCellRef(col, row): # if (isString(col)): # return u"%s%d" %(col, row) # return u"%s%d" %(int2col(col), row) # # def setTableValue(table, col, row, val): # if (type(val) == str): # table.set(getCellRef(col, row), val) # else: # if ((sys.version_info.major <= 2) and (type(val) == unicode)): # table.set(getCellRef(col, row), "%s" %(val.encode("utf8"))) # else: # table.set(getCellRef(col, row), str(val)) # # def calcAliasname(name): # alias = name.replace(':', '_') # if (IS_CELL_REF.search(name)): # return '%s_' %(alias) # # 45, 48..57, 65..90, 97..122 # result = '' # for c in alias: # i = ord(c) # if (i == 45) or (i > 47 and i < 58) or (i > 64 and i < 91) or (i > 96 and i < 123): # result += c # else: # result += '_' # if (result[0] == '_'): # return 'd' + result # return result # # Path: importerClasses.py # class ParameterTableModel(TableModel): # def __init__(self, parent, mylist, *args): # TableModel.__init__(self, parent, mylist, ['Variant', 'Source', 'Property', 'Parameter', 'Value', 'Units'], *args) # def flags(self, index): # if (index.column() == 0): # return Qt.ItemIsEnabled | Qt.ItemIsEditable | Qt.ItemIsUserCheckable # if (index.column() in [1, 2, 5]): # make object's name and property and unit column read only! # return Qt.ItemIsEnabled # return Qt.ItemIsEnabled |Qt.ItemIsEditable # # class VariantTableModel(TableModel): # def __init__(self, parent, values, *args): # TableModel.__init__(self, parent, values[1:], values[0], *args) # def flags(self, index): # return Qt.ItemIsEnabled | Qt.ItemIsEditable # # Path: importerConstants.py # DIR_X = VEC(1, 0, 0) # # DIR_Y = VEC(0, 1, 0) # # DIR_Z = VEC(0, 0, 1) . Output only the next line.
unit = table.get(getCellRef('B', row))
Using the snippet: <|code_start|> else: unit = None source = None if (hasSource): source = getTableValue(table, 'D', row) property = None if (hasProperty): property = getTableValue(table, 'E', row) values.append([False, source, property, name, value, unit]) row += 1 return table, values, False def createIPartParameters(doc, values): table = doc.addObject('Spreadsheet::Sheet', 'Parameters') table.set('A1', 'Parameter') table.set('B1', 'Value') table.set('C1', 'Unit') table.set('D1', 'Source') table.set('E1', 'Property') for row, data in enumerate(values, 2): (add, source, property, name, value, unit) = data setTableValue(table, 'A', row, name) try: setTableValue(table, 'B', row, float(value)) except: setTableValue(table, 'B', row, '=%s' %(value)) setTableValue(table, 'C', row, unit) setTableValue(table, 'D', row, source) setTableValue(table, 'E', row, property) # replace value by expression <|code_end|> , determine the next line of code. You have imports: import os, re, sys, Part, FreeCAD, FreeCADGui from importerUtils import logInfo, getIconPath, getTableValue, setTableValue, logInfo, logWarning, logError, getCellRef, setTableValue, calcAliasname from FreeCAD import Vector as VEC from importerClasses import ParameterTableModel, VariantTableModel from math import degrees, radians, pi, sqrt, cos, sin, atan from PySide.QtCore import * from PySide.QtGui import * from importerConstants import DIR_X, DIR_Y, DIR_Z and context (class names, function names, or code) available: # Path: importerUtils.py # def logInfo(msg, *args): # if (__prmPrefOW__.GetBool("checkLogging", False)): _log("logInfo", Console.PrintMessage, msg, args) # # def getIconPath(fileName): # return os.path.join(os.path.dirname(__file__), "Resources", "icons", fileName) # # def getTableValue(table, col, row): # try: # return table.get(getCellRef(col, row)) # except: # return None # # def setTableValue(table, col, row, val): # if (type(val) == str): # table.set(getCellRef(col, row), val) # else: # if ((sys.version_info.major <= 2) and (type(val) == unicode)): # table.set(getCellRef(col, row), "%s" %(val.encode("utf8"))) # else: # table.set(getCellRef(col, row), str(val)) # # def logInfo(msg, *args): # if (__prmPrefOW__.GetBool("checkLogging", False)): _log("logInfo", Console.PrintMessage, msg, args) # # def logWarning(msg, *args): # if (__prmPrefOW__.GetBool("checkWarning", False)): _log("logWarning", Console.PrintWarning, msg, args) # # def logError(msg, *args): # if (__prmPrefOW__.GetBool("checkError", True)): _log("logError", Console.PrintError, msg, args) # # def getCellRef(col, row): # if (isString(col)): # return u"%s%d" %(col, row) # return u"%s%d" %(int2col(col), row) # # def setTableValue(table, col, row, val): # if (type(val) == str): # table.set(getCellRef(col, row), val) # else: # if ((sys.version_info.major <= 2) and (type(val) == unicode)): # table.set(getCellRef(col, row), "%s" %(val.encode("utf8"))) # else: # table.set(getCellRef(col, row), str(val)) # # def calcAliasname(name): # alias = name.replace(':', '_') # if (IS_CELL_REF.search(name)): # return '%s_' %(alias) # # 45, 48..57, 65..90, 97..122 # result = '' # for c in alias: # i = ord(c) # if (i == 45) or (i > 47 and i < 58) or (i > 64 and i < 91) or (i > 96 and i < 123): # result += c # else: # result += '_' # if (result[0] == '_'): # return 'd' + result # return result # # Path: importerClasses.py # class ParameterTableModel(TableModel): # def __init__(self, parent, mylist, *args): # TableModel.__init__(self, parent, mylist, ['Variant', 'Source', 'Property', 'Parameter', 'Value', 'Units'], *args) # def flags(self, index): # if (index.column() == 0): # return Qt.ItemIsEnabled | Qt.ItemIsEditable | Qt.ItemIsUserCheckable # if (index.column() in [1, 2, 5]): # make object's name and property and unit column read only! # return Qt.ItemIsEnabled # return Qt.ItemIsEnabled |Qt.ItemIsEditable # # class VariantTableModel(TableModel): # def __init__(self, parent, values, *args): # TableModel.__init__(self, parent, values[1:], values[0], *args) # def flags(self, index): # return Qt.ItemIsEnabled | Qt.ItemIsEditable # # Path: importerConstants.py # DIR_X = VEC(1, 0, 0) # # DIR_Y = VEC(0, 1, 0) # # DIR_Z = VEC(0, 0, 1) . Output only the next line.
table.setAlias(u"B%d" %(row), calcAliasname(name))
Given snippet: <|code_start|> def createIPartParameters(doc, values): table = doc.addObject('Spreadsheet::Sheet', 'Parameters') table.set('A1', 'Parameter') table.set('B1', 'Value') table.set('C1', 'Unit') table.set('D1', 'Source') table.set('E1', 'Property') for row, data in enumerate(values, 2): (add, source, property, name, value, unit) = data setTableValue(table, 'A', row, name) try: setTableValue(table, 'B', row, float(value)) except: setTableValue(table, 'B', row, '=%s' %(value)) setTableValue(table, 'C', row, unit) setTableValue(table, 'D', row, source) setTableValue(table, 'E', row, property) # replace value by expression table.setAlias(u"B%d" %(row), calcAliasname(name)) doc.recompute() return table def createIPart(): doc = FreeCAD.ActiveDocument table, values, create = getParametersValues(doc) if (values is None): values = searchDocParameters(doc) form = FreeCADGui.PySideUic.loadUi(os.path.join(os.path.dirname(os.path.abspath(__file__)), "Resources", "ui", "iPartParameters.ui")) <|code_end|> , continue by predicting the next line. Consider current file imports: import os, re, sys, Part, FreeCAD, FreeCADGui from importerUtils import logInfo, getIconPath, getTableValue, setTableValue, logInfo, logWarning, logError, getCellRef, setTableValue, calcAliasname from FreeCAD import Vector as VEC from importerClasses import ParameterTableModel, VariantTableModel from math import degrees, radians, pi, sqrt, cos, sin, atan from PySide.QtCore import * from PySide.QtGui import * from importerConstants import DIR_X, DIR_Y, DIR_Z and context: # Path: importerUtils.py # def logInfo(msg, *args): # if (__prmPrefOW__.GetBool("checkLogging", False)): _log("logInfo", Console.PrintMessage, msg, args) # # def getIconPath(fileName): # return os.path.join(os.path.dirname(__file__), "Resources", "icons", fileName) # # def getTableValue(table, col, row): # try: # return table.get(getCellRef(col, row)) # except: # return None # # def setTableValue(table, col, row, val): # if (type(val) == str): # table.set(getCellRef(col, row), val) # else: # if ((sys.version_info.major <= 2) and (type(val) == unicode)): # table.set(getCellRef(col, row), "%s" %(val.encode("utf8"))) # else: # table.set(getCellRef(col, row), str(val)) # # def logInfo(msg, *args): # if (__prmPrefOW__.GetBool("checkLogging", False)): _log("logInfo", Console.PrintMessage, msg, args) # # def logWarning(msg, *args): # if (__prmPrefOW__.GetBool("checkWarning", False)): _log("logWarning", Console.PrintWarning, msg, args) # # def logError(msg, *args): # if (__prmPrefOW__.GetBool("checkError", True)): _log("logError", Console.PrintError, msg, args) # # def getCellRef(col, row): # if (isString(col)): # return u"%s%d" %(col, row) # return u"%s%d" %(int2col(col), row) # # def setTableValue(table, col, row, val): # if (type(val) == str): # table.set(getCellRef(col, row), val) # else: # if ((sys.version_info.major <= 2) and (type(val) == unicode)): # table.set(getCellRef(col, row), "%s" %(val.encode("utf8"))) # else: # table.set(getCellRef(col, row), str(val)) # # def calcAliasname(name): # alias = name.replace(':', '_') # if (IS_CELL_REF.search(name)): # return '%s_' %(alias) # # 45, 48..57, 65..90, 97..122 # result = '' # for c in alias: # i = ord(c) # if (i == 45) or (i > 47 and i < 58) or (i > 64 and i < 91) or (i > 96 and i < 123): # result += c # else: # result += '_' # if (result[0] == '_'): # return 'd' + result # return result # # Path: importerClasses.py # class ParameterTableModel(TableModel): # def __init__(self, parent, mylist, *args): # TableModel.__init__(self, parent, mylist, ['Variant', 'Source', 'Property', 'Parameter', 'Value', 'Units'], *args) # def flags(self, index): # if (index.column() == 0): # return Qt.ItemIsEnabled | Qt.ItemIsEditable | Qt.ItemIsUserCheckable # if (index.column() in [1, 2, 5]): # make object's name and property and unit column read only! # return Qt.ItemIsEnabled # return Qt.ItemIsEnabled |Qt.ItemIsEditable # # class VariantTableModel(TableModel): # def __init__(self, parent, values, *args): # TableModel.__init__(self, parent, values[1:], values[0], *args) # def flags(self, index): # return Qt.ItemIsEnabled | Qt.ItemIsEditable # # Path: importerConstants.py # DIR_X = VEC(1, 0, 0) # # DIR_Y = VEC(0, 1, 0) # # DIR_Z = VEC(0, 0, 1) which might include code, classes, or functions. Output only the next line.
ParameterTableModel(form.tableView, values)
Predict the next line after this snippet: <|code_start|> def __init__(self, vp): super(_ViewProviderTrim, self).__init__(vp) def claimChildren(self): return self.Object.Patches def getIcon(self): return getIconPath('FxBoundaryPatch.xpm') def makeTrim(name = u"Trim", faces = None): if (faces == None): selection = FreeCADGui.Selection.getSelectionEx(FreeCAD.ActiveDocument.Name) faces = [] for selObj in selection: obj = selObj.Object if ((hasattr(obj.ViewObject, "Proxy")) and (obj.ViewObject.Proxy.__class__.__name__ == '_ViewProviderBoundaryPatch')): obj.ViewObject.Visibility = False faces.append(obj) fp = createPartFeature("Part::FeaturePython", name) _Trim(fp, faces) if FreeCAD.GuiUp: _ViewProviderTrim(fp.ViewObject) FreeCAD.ActiveDocument.recompute() return fp class _Coil(_ObjectProxy): def __init__(self, fp, patches): super(_Coil, self).__init__(fp) fp.addProperty("App::PropertyLink" , "Profile" , "Base", "The profile for the coil").Profile = None <|code_end|> using the current file's imports: import os, re, sys, Part, FreeCAD, FreeCADGui from importerUtils import logInfo, getIconPath, getTableValue, setTableValue, logInfo, logWarning, logError, getCellRef, setTableValue, calcAliasname from FreeCAD import Vector as VEC from importerClasses import ParameterTableModel, VariantTableModel from math import degrees, radians, pi, sqrt, cos, sin, atan from PySide.QtCore import * from PySide.QtGui import * from importerConstants import DIR_X, DIR_Y, DIR_Z and any relevant context from other files: # Path: importerUtils.py # def logInfo(msg, *args): # if (__prmPrefOW__.GetBool("checkLogging", False)): _log("logInfo", Console.PrintMessage, msg, args) # # def getIconPath(fileName): # return os.path.join(os.path.dirname(__file__), "Resources", "icons", fileName) # # def getTableValue(table, col, row): # try: # return table.get(getCellRef(col, row)) # except: # return None # # def setTableValue(table, col, row, val): # if (type(val) == str): # table.set(getCellRef(col, row), val) # else: # if ((sys.version_info.major <= 2) and (type(val) == unicode)): # table.set(getCellRef(col, row), "%s" %(val.encode("utf8"))) # else: # table.set(getCellRef(col, row), str(val)) # # def logInfo(msg, *args): # if (__prmPrefOW__.GetBool("checkLogging", False)): _log("logInfo", Console.PrintMessage, msg, args) # # def logWarning(msg, *args): # if (__prmPrefOW__.GetBool("checkWarning", False)): _log("logWarning", Console.PrintWarning, msg, args) # # def logError(msg, *args): # if (__prmPrefOW__.GetBool("checkError", True)): _log("logError", Console.PrintError, msg, args) # # def getCellRef(col, row): # if (isString(col)): # return u"%s%d" %(col, row) # return u"%s%d" %(int2col(col), row) # # def setTableValue(table, col, row, val): # if (type(val) == str): # table.set(getCellRef(col, row), val) # else: # if ((sys.version_info.major <= 2) and (type(val) == unicode)): # table.set(getCellRef(col, row), "%s" %(val.encode("utf8"))) # else: # table.set(getCellRef(col, row), str(val)) # # def calcAliasname(name): # alias = name.replace(':', '_') # if (IS_CELL_REF.search(name)): # return '%s_' %(alias) # # 45, 48..57, 65..90, 97..122 # result = '' # for c in alias: # i = ord(c) # if (i == 45) or (i > 47 and i < 58) or (i > 64 and i < 91) or (i > 96 and i < 123): # result += c # else: # result += '_' # if (result[0] == '_'): # return 'd' + result # return result # # Path: importerClasses.py # class ParameterTableModel(TableModel): # def __init__(self, parent, mylist, *args): # TableModel.__init__(self, parent, mylist, ['Variant', 'Source', 'Property', 'Parameter', 'Value', 'Units'], *args) # def flags(self, index): # if (index.column() == 0): # return Qt.ItemIsEnabled | Qt.ItemIsEditable | Qt.ItemIsUserCheckable # if (index.column() in [1, 2, 5]): # make object's name and property and unit column read only! # return Qt.ItemIsEnabled # return Qt.ItemIsEnabled |Qt.ItemIsEditable # # class VariantTableModel(TableModel): # def __init__(self, parent, values, *args): # TableModel.__init__(self, parent, values[1:], values[0], *args) # def flags(self, index): # return Qt.ItemIsEnabled | Qt.ItemIsEditable # # Path: importerConstants.py # DIR_X = VEC(1, 0, 0) # # DIR_Y = VEC(0, 1, 0) # # DIR_Z = VEC(0, 0, 1) . Output only the next line.
fp.addProperty("App::PropertyVector" , "Axis" , "Coil", "The direction of the coil's axis").Axis = DIR_Z
Given the code snippet: <|code_start|> section = cls() self._sections[section.name] = section def _setup_sections(self, tagreader, drawing): def name(section): return section[1].value for section in iterchunks(tagreader, stoptag='EOF', endofchunk='ENDSEC'): if name(section) == 'HEADER': new_section = HeaderSection.from_tags(section) drawing.dxfversion = new_section.get('$ACADVER', 'AC1009') codepage = new_section.get('$DWGCODEPAGE', 'ANSI_1252') drawing.encoding = toencoding(codepage) else: section_name = name(section) if section_name in SECTIONMAP: section_class = get_section_class(section_name) new_section = section_class.from_tags(section, drawing) else: new_section = None if new_section is not None: self._sections[new_section.name] = new_section def __getattr__(self, key): try: return self._sections[key] except KeyError: raise AttributeError(key) SECTIONMAP = { <|code_end|> , generate the next line using the imports in this file: from .codepage import toencoding from .defaultchunk import DefaultChunk, iterchunks from .headersection import HeaderSection from .tablessection import TablesSection from .entitysection import EntitySection, ObjectsSection from .blockssection import BlocksSection from .acdsdata import AcDsDataSection and context (functions, classes, or occasionally code) from other files: # Path: dxfgrabber/tablessection.py # class TablesSection(object): # name = 'tables' # # def __init__(self): # self._tables = dict() # self._create_default_tables() # # def _create_default_tables(self): # for cls in TABLESMAP.values(): # table = cls() # self._tables[table.name] = table # # @staticmethod # def from_tags(tags, drawing): # tables_section = TablesSection() # tables_section._setup_tables(tags) # return tables_section # # def _setup_tables(self, tags): # def name(table): # return table[1].value # # def skiptags(tags, count): # for i in range(count): # next(tags) # return tags # # itertags = skiptags(iter(tags), 2) # (0, 'SECTION'), (2, 'TABLES') # for table in iterchunks(itertags, stoptag='ENDSEC', endofchunk='ENDTAB'): # table_class = table_factory(name(table)) # if table_class is not None: # new_table = table_class.from_tags(table) # self._tables[new_table.name] = new_table # # def __getattr__(self, key): # try: # return self._tables[key] # except KeyError: # raise AttributeError(key) # # Path: dxfgrabber/entitysection.py # class EntitySection(object): # name = 'entities' # # def __init__(self): # self._entities = list() # # @classmethod # def from_tags(cls, tags, drawing): # entity_section = cls() # entity_section._build(tags) # return entity_section # # def get_entities(self): # return self._entities # # def __len__(self): # return len(self._entities) # # def __iter__(self): # return iter(self._entities) # # def __getitem__(self, index): # return self._entities[index] # # def _build(self, tags): # if len(tags) == 3: # empty entities section # return # groups = TagGroups(islice(tags, 2, len(tags)-1)) # self._entities = build_entities(groups) # # class ObjectsSection(EntitySection): # name = 'objects' # # Path: dxfgrabber/blockssection.py # class BlocksSection(object): # name = 'blocks' # # def __init__(self): # self._blocks = dict() # # @staticmethod # def from_tags(tags, drawing): # blocks_section = BlocksSection() # if drawing.grab_blocks: # blocks_section._build(tags) # return blocks_section # # def _build(self, tags): # if len(tags) == 3: # empty block section # return # groups = list() # for group in TagGroups(islice(tags, 2, len(tags)-1)): # groups.append(group) # if group[0].value == 'ENDBLK': # entities = build_entities(groups) # block = entities[0] # block.set_entities(entities[1:-1]) # self._add(block) # groups = list() # # def _add(self, block): # self._blocks[block.name] = block # # # start of public interface # def __len__(self): # return len(self._blocks) # # def __iter__(self): # return iter(self._blocks.values()) # # def __contains__(self, name): # return name in self._blocks # # def __getitem__(self, name): # return self._blocks[name] # # def get(self, name, default=None): # return self._blocks.get(name, default) . Output only the next line.
'TABLES' : TablesSection,
Here is a snippet: <|code_start|> self._sections[section.name] = section def _setup_sections(self, tagreader, drawing): def name(section): return section[1].value for section in iterchunks(tagreader, stoptag='EOF', endofchunk='ENDSEC'): if name(section) == 'HEADER': new_section = HeaderSection.from_tags(section) drawing.dxfversion = new_section.get('$ACADVER', 'AC1009') codepage = new_section.get('$DWGCODEPAGE', 'ANSI_1252') drawing.encoding = toencoding(codepage) else: section_name = name(section) if section_name in SECTIONMAP: section_class = get_section_class(section_name) new_section = section_class.from_tags(section, drawing) else: new_section = None if new_section is not None: self._sections[new_section.name] = new_section def __getattr__(self, key): try: return self._sections[key] except KeyError: raise AttributeError(key) SECTIONMAP = { 'TABLES' : TablesSection, <|code_end|> . Write the next line using the current file imports: from .codepage import toencoding from .defaultchunk import DefaultChunk, iterchunks from .headersection import HeaderSection from .tablessection import TablesSection from .entitysection import EntitySection, ObjectsSection from .blockssection import BlocksSection from .acdsdata import AcDsDataSection and context from other files: # Path: dxfgrabber/tablessection.py # class TablesSection(object): # name = 'tables' # # def __init__(self): # self._tables = dict() # self._create_default_tables() # # def _create_default_tables(self): # for cls in TABLESMAP.values(): # table = cls() # self._tables[table.name] = table # # @staticmethod # def from_tags(tags, drawing): # tables_section = TablesSection() # tables_section._setup_tables(tags) # return tables_section # # def _setup_tables(self, tags): # def name(table): # return table[1].value # # def skiptags(tags, count): # for i in range(count): # next(tags) # return tags # # itertags = skiptags(iter(tags), 2) # (0, 'SECTION'), (2, 'TABLES') # for table in iterchunks(itertags, stoptag='ENDSEC', endofchunk='ENDTAB'): # table_class = table_factory(name(table)) # if table_class is not None: # new_table = table_class.from_tags(table) # self._tables[new_table.name] = new_table # # def __getattr__(self, key): # try: # return self._tables[key] # except KeyError: # raise AttributeError(key) # # Path: dxfgrabber/entitysection.py # class EntitySection(object): # name = 'entities' # # def __init__(self): # self._entities = list() # # @classmethod # def from_tags(cls, tags, drawing): # entity_section = cls() # entity_section._build(tags) # return entity_section # # def get_entities(self): # return self._entities # # def __len__(self): # return len(self._entities) # # def __iter__(self): # return iter(self._entities) # # def __getitem__(self, index): # return self._entities[index] # # def _build(self, tags): # if len(tags) == 3: # empty entities section # return # groups = TagGroups(islice(tags, 2, len(tags)-1)) # self._entities = build_entities(groups) # # class ObjectsSection(EntitySection): # name = 'objects' # # Path: dxfgrabber/blockssection.py # class BlocksSection(object): # name = 'blocks' # # def __init__(self): # self._blocks = dict() # # @staticmethod # def from_tags(tags, drawing): # blocks_section = BlocksSection() # if drawing.grab_blocks: # blocks_section._build(tags) # return blocks_section # # def _build(self, tags): # if len(tags) == 3: # empty block section # return # groups = list() # for group in TagGroups(islice(tags, 2, len(tags)-1)): # groups.append(group) # if group[0].value == 'ENDBLK': # entities = build_entities(groups) # block = entities[0] # block.set_entities(entities[1:-1]) # self._add(block) # groups = list() # # def _add(self, block): # self._blocks[block.name] = block # # # start of public interface # def __len__(self): # return len(self._blocks) # # def __iter__(self): # return iter(self._blocks.values()) # # def __contains__(self, name): # return name in self._blocks # # def __getitem__(self, name): # return self._blocks[name] # # def get(self, name, default=None): # return self._blocks.get(name, default) , which may include functions, classes, or code. Output only the next line.
'ENTITIES': EntitySection,
Here is a snippet: <|code_start|> def _setup_sections(self, tagreader, drawing): def name(section): return section[1].value for section in iterchunks(tagreader, stoptag='EOF', endofchunk='ENDSEC'): if name(section) == 'HEADER': new_section = HeaderSection.from_tags(section) drawing.dxfversion = new_section.get('$ACADVER', 'AC1009') codepage = new_section.get('$DWGCODEPAGE', 'ANSI_1252') drawing.encoding = toencoding(codepage) else: section_name = name(section) if section_name in SECTIONMAP: section_class = get_section_class(section_name) new_section = section_class.from_tags(section, drawing) else: new_section = None if new_section is not None: self._sections[new_section.name] = new_section def __getattr__(self, key): try: return self._sections[key] except KeyError: raise AttributeError(key) SECTIONMAP = { 'TABLES' : TablesSection, 'ENTITIES': EntitySection, <|code_end|> . Write the next line using the current file imports: from .codepage import toencoding from .defaultchunk import DefaultChunk, iterchunks from .headersection import HeaderSection from .tablessection import TablesSection from .entitysection import EntitySection, ObjectsSection from .blockssection import BlocksSection from .acdsdata import AcDsDataSection and context from other files: # Path: dxfgrabber/tablessection.py # class TablesSection(object): # name = 'tables' # # def __init__(self): # self._tables = dict() # self._create_default_tables() # # def _create_default_tables(self): # for cls in TABLESMAP.values(): # table = cls() # self._tables[table.name] = table # # @staticmethod # def from_tags(tags, drawing): # tables_section = TablesSection() # tables_section._setup_tables(tags) # return tables_section # # def _setup_tables(self, tags): # def name(table): # return table[1].value # # def skiptags(tags, count): # for i in range(count): # next(tags) # return tags # # itertags = skiptags(iter(tags), 2) # (0, 'SECTION'), (2, 'TABLES') # for table in iterchunks(itertags, stoptag='ENDSEC', endofchunk='ENDTAB'): # table_class = table_factory(name(table)) # if table_class is not None: # new_table = table_class.from_tags(table) # self._tables[new_table.name] = new_table # # def __getattr__(self, key): # try: # return self._tables[key] # except KeyError: # raise AttributeError(key) # # Path: dxfgrabber/entitysection.py # class EntitySection(object): # name = 'entities' # # def __init__(self): # self._entities = list() # # @classmethod # def from_tags(cls, tags, drawing): # entity_section = cls() # entity_section._build(tags) # return entity_section # # def get_entities(self): # return self._entities # # def __len__(self): # return len(self._entities) # # def __iter__(self): # return iter(self._entities) # # def __getitem__(self, index): # return self._entities[index] # # def _build(self, tags): # if len(tags) == 3: # empty entities section # return # groups = TagGroups(islice(tags, 2, len(tags)-1)) # self._entities = build_entities(groups) # # class ObjectsSection(EntitySection): # name = 'objects' # # Path: dxfgrabber/blockssection.py # class BlocksSection(object): # name = 'blocks' # # def __init__(self): # self._blocks = dict() # # @staticmethod # def from_tags(tags, drawing): # blocks_section = BlocksSection() # if drawing.grab_blocks: # blocks_section._build(tags) # return blocks_section # # def _build(self, tags): # if len(tags) == 3: # empty block section # return # groups = list() # for group in TagGroups(islice(tags, 2, len(tags)-1)): # groups.append(group) # if group[0].value == 'ENDBLK': # entities = build_entities(groups) # block = entities[0] # block.set_entities(entities[1:-1]) # self._add(block) # groups = list() # # def _add(self, block): # self._blocks[block.name] = block # # # start of public interface # def __len__(self): # return len(self._blocks) # # def __iter__(self): # return iter(self._blocks.values()) # # def __contains__(self, name): # return name in self._blocks # # def __getitem__(self, name): # return self._blocks[name] # # def get(self, name, default=None): # return self._blocks.get(name, default) , which may include functions, classes, or code. Output only the next line.
'OBJECTS' : ObjectsSection,
Predict the next line for this snippet: <|code_start|> def _setup_sections(self, tagreader, drawing): def name(section): return section[1].value for section in iterchunks(tagreader, stoptag='EOF', endofchunk='ENDSEC'): if name(section) == 'HEADER': new_section = HeaderSection.from_tags(section) drawing.dxfversion = new_section.get('$ACADVER', 'AC1009') codepage = new_section.get('$DWGCODEPAGE', 'ANSI_1252') drawing.encoding = toencoding(codepage) else: section_name = name(section) if section_name in SECTIONMAP: section_class = get_section_class(section_name) new_section = section_class.from_tags(section, drawing) else: new_section = None if new_section is not None: self._sections[new_section.name] = new_section def __getattr__(self, key): try: return self._sections[key] except KeyError: raise AttributeError(key) SECTIONMAP = { 'TABLES' : TablesSection, 'ENTITIES': EntitySection, 'OBJECTS' : ObjectsSection, <|code_end|> with the help of current file imports: from .codepage import toencoding from .defaultchunk import DefaultChunk, iterchunks from .headersection import HeaderSection from .tablessection import TablesSection from .entitysection import EntitySection, ObjectsSection from .blockssection import BlocksSection from .acdsdata import AcDsDataSection and context from other files: # Path: dxfgrabber/tablessection.py # class TablesSection(object): # name = 'tables' # # def __init__(self): # self._tables = dict() # self._create_default_tables() # # def _create_default_tables(self): # for cls in TABLESMAP.values(): # table = cls() # self._tables[table.name] = table # # @staticmethod # def from_tags(tags, drawing): # tables_section = TablesSection() # tables_section._setup_tables(tags) # return tables_section # # def _setup_tables(self, tags): # def name(table): # return table[1].value # # def skiptags(tags, count): # for i in range(count): # next(tags) # return tags # # itertags = skiptags(iter(tags), 2) # (0, 'SECTION'), (2, 'TABLES') # for table in iterchunks(itertags, stoptag='ENDSEC', endofchunk='ENDTAB'): # table_class = table_factory(name(table)) # if table_class is not None: # new_table = table_class.from_tags(table) # self._tables[new_table.name] = new_table # # def __getattr__(self, key): # try: # return self._tables[key] # except KeyError: # raise AttributeError(key) # # Path: dxfgrabber/entitysection.py # class EntitySection(object): # name = 'entities' # # def __init__(self): # self._entities = list() # # @classmethod # def from_tags(cls, tags, drawing): # entity_section = cls() # entity_section._build(tags) # return entity_section # # def get_entities(self): # return self._entities # # def __len__(self): # return len(self._entities) # # def __iter__(self): # return iter(self._entities) # # def __getitem__(self, index): # return self._entities[index] # # def _build(self, tags): # if len(tags) == 3: # empty entities section # return # groups = TagGroups(islice(tags, 2, len(tags)-1)) # self._entities = build_entities(groups) # # class ObjectsSection(EntitySection): # name = 'objects' # # Path: dxfgrabber/blockssection.py # class BlocksSection(object): # name = 'blocks' # # def __init__(self): # self._blocks = dict() # # @staticmethod # def from_tags(tags, drawing): # blocks_section = BlocksSection() # if drawing.grab_blocks: # blocks_section._build(tags) # return blocks_section # # def _build(self, tags): # if len(tags) == 3: # empty block section # return # groups = list() # for group in TagGroups(islice(tags, 2, len(tags)-1)): # groups.append(group) # if group[0].value == 'ENDBLK': # entities = build_entities(groups) # block = entities[0] # block.set_entities(entities[1:-1]) # self._add(block) # groups = list() # # def _add(self, block): # self._blocks[block.name] = block # # # start of public interface # def __len__(self): # return len(self._blocks) # # def __iter__(self): # return iter(self._blocks.values()) # # def __contains__(self, name): # return name in self._blocks # # def __getitem__(self, name): # return self._blocks[name] # # def get(self, name, default=None): # return self._blocks.get(name, default) , which may contain function names, class names, or code. Output only the next line.
'BLOCKS' : BlocksSection,
Here is a snippet: <|code_start|>"""unset a default setting unset config unset target """ #------------------------------------------------------------------------------- def run(fips_dir, proj_dir, args) : """run the 'unset' verb""" if len(args) > 0 : noun = args[0] settings.unset(proj_dir, noun) else : <|code_end|> . Write the next line using the current file imports: from mod import log, settings and context from other files: # Path: mod/log.py # RED = '\033[1;31m' # GREEN = '\033[1;32m' # YELLOW = '\033[1;33m' # BLUE = '\033[1;36m' # DEF = '\033[0;0m' # def error(msg, fatal=True) : # def warn(msg) : # def ok(item, status) : # def failed(item, status) : # def optional(item, status) : # def info(msg) : # def colored(color, msg) : # # Path: mod/settings.py # def load(proj_dir) : # def save(proj_dir, settings) : # def get_default(key) : # def get(proj_dir, key) : # def set(proj_dir, key, value) : # def unset(proj_dir, key) : # def get_all_settings(proj_dir): , which may include functions, classes, or code. Output only the next line.
log.error("expected noun: {}".format(', '.join(valid_nouns)))
Using the snippet: <|code_start|>"""unset a default setting unset config unset target """ #------------------------------------------------------------------------------- def run(fips_dir, proj_dir, args) : """run the 'unset' verb""" if len(args) > 0 : noun = args[0] <|code_end|> , determine the next line of code. You have imports: from mod import log, settings and context (class names, function names, or code) available: # Path: mod/log.py # RED = '\033[1;31m' # GREEN = '\033[1;32m' # YELLOW = '\033[1;33m' # BLUE = '\033[1;36m' # DEF = '\033[0;0m' # def error(msg, fatal=True) : # def warn(msg) : # def ok(item, status) : # def failed(item, status) : # def optional(item, status) : # def info(msg) : # def colored(color, msg) : # # Path: mod/settings.py # def load(proj_dir) : # def save(proj_dir, settings) : # def get_default(key) : # def get(proj_dir, key) : # def set(proj_dir, key, value) : # def unset(proj_dir, key) : # def get_all_settings(proj_dir): . Output only the next line.
settings.unset(proj_dir, noun)
Given the following code snippet before the placeholder: <|code_start|>""" wasi-sdk installation and maintenance """ def run(fips_dir, proj_dir, args): if len(args) > 0: cmd = args[0] if cmd == 'install': wasisdk.install(fips_dir) elif cmd == 'uninstall': wasisdk.uninstall(fips_dir) else: <|code_end|> , predict the next line using imports from the current file: from mod import log, wasisdk and context including class names, function names, and sometimes code from other files: # Path: mod/log.py # RED = '\033[1;31m' # GREEN = '\033[1;32m' # YELLOW = '\033[1;33m' # BLUE = '\033[1;36m' # DEF = '\033[0;0m' # def error(msg, fatal=True) : # def warn(msg) : # def ok(item, status) : # def failed(item, status) : # def optional(item, status) : # def info(msg) : # def colored(color, msg) : # # Path: mod/wasisdk.py # def get_sdk_dir(fips_dir): # def check_exists(fips_dir): # def get_url(): # def get_archive_path(fips_dir): # def get_wasisdk_root(fips_dir): # def sdk_dir_exists(fips_dir): # def ensure_sdk_dirs(fips_dir) : # def install(fips_dir): # def uninstall(fips_dir): . Output only the next line.
log.error("unknown subcommand '{}' (run './fips help wasisdk')".format(cmd))
Given the following code snippet before the placeholder: <|code_start|>""" wasi-sdk installation and maintenance """ def run(fips_dir, proj_dir, args): if len(args) > 0: cmd = args[0] if cmd == 'install': <|code_end|> , predict the next line using imports from the current file: from mod import log, wasisdk and context including class names, function names, and sometimes code from other files: # Path: mod/log.py # RED = '\033[1;31m' # GREEN = '\033[1;32m' # YELLOW = '\033[1;33m' # BLUE = '\033[1;36m' # DEF = '\033[0;0m' # def error(msg, fatal=True) : # def warn(msg) : # def ok(item, status) : # def failed(item, status) : # def optional(item, status) : # def info(msg) : # def colored(color, msg) : # # Path: mod/wasisdk.py # def get_sdk_dir(fips_dir): # def check_exists(fips_dir): # def get_url(): # def get_archive_path(fips_dir): # def get_wasisdk_root(fips_dir): # def sdk_dir_exists(fips_dir): # def ensure_sdk_dirs(fips_dir) : # def install(fips_dir): # def uninstall(fips_dir): . Output only the next line.
wasisdk.install(fips_dir)
Using the snippet: <|code_start|> return util.get_workspace_dir(fips_dir) + '/fips-sdks/android' #------------------------------------------------------------------------------- def check_exists(fips_dir) : """check if the android sdk has been installed""" return os.path.isdir(get_sdk_dir(fips_dir)) #------------------------------------------------------------------------------- def get_adb_path(fips_dir): return get_sdk_dir(fips_dir) + '/platform-tools/adb' #------------------------------------------------------------------------------- def get_tools_url() : return tools_urls[util.get_host_platform()] #------------------------------------------------------------------------------- def get_tools_archive_path(fips_dir): return get_sdk_dir(fips_dir) + '/' + tools_archives[util.get_host_platform()] #------------------------------------------------------------------------------- # convert a cmake target into a valid Android package name, # some characters are invalid for package names and must be replaced # NOTE: the same rules must be applied in the android-create-apk.py # helper script which is run as a build job! # def target_to_package_name(target): return 'org.fips.'+target.replace('-','_') #------------------------------------------------------------------------------- def install_package(fips_dir, pkg): <|code_end|> , determine the next line of code. You have imports: import os import sys import zipfile import subprocess import hashlib from urllib.request import urlretrieve from urllib import urlretrieve from mod import log, util from mod.tools import java, javac and context (class names, function names, or code) available: # Path: mod/log.py # RED = '\033[1;31m' # GREEN = '\033[1;32m' # YELLOW = '\033[1;33m' # BLUE = '\033[1;36m' # DEF = '\033[0;0m' # def error(msg, fatal=True) : # def warn(msg) : # def ok(item, status) : # def failed(item, status) : # def optional(item, status) : # def info(msg) : # def colored(color, msg) : # # Path: mod/util.py # def fix_path(path) : # def get_workspace_dir(fips_dir) : # def get_project_dir(fips_dir, proj_name) : # def get_build_root_dir(fips_dir, proj_name): # def get_deploy_root_dir(fips_dir, proj_name): # def get_build_dir(fips_dir, proj_name, cfg) : # def get_deploy_dir(fips_dir, proj_name, cfg) : # def get_fips_dir(proj_dir, name): # def get_configs_dir(proj_dir): # def get_verbs_dir(proj_dir): # def get_generators_dir(proj_dir): # def get_toolchains_dir(proj_dir): # def get_giturl_from_url(url) : # def get_gitbranch_from_url(url) : # def get_project_name_from_url(url) : # def get_project_name_from_dir(proj_dir) : # def load_fips_yml(proj_dir) : # def lookup_target_cwd(proj_dir, target) : # def is_valid_project_dir(proj_dir) : # def ensure_valid_project_dir(proj_dir) : # def is_git_url(url) : # def confirm(question) : # def url_download_hook(count, block_size, total_size) : # def get_host_platform() : # def get_cfg_target_list(fips_dir, proj_dir, cfg): # def get_cfg_headersdirs_by_target(fips_dir, proj_dir, cfg): # def get_cfg_defines_by_target(fips_dir, proj_dir, cfg): # def get_num_cpucores(): # # Path: mod/tools/java.py # def check_exists(fips_dir) : # # Path: mod/tools/javac.py # def check_exists(fips_dir) : . Output only the next line.
log.colored(log.BLUE, '>>> install Android SDK package: {}'.format(pkg))
Given snippet: <|code_start|>"""Android SDK support""" if sys.version_info[0] >= 3: else: tools_urls = { 'win': 'https://dl.google.com/android/repository/sdk-tools-windows-3859397.zip', 'osx': 'https://dl.google.com/android/repository/sdk-tools-darwin-3859397.zip', 'linux': 'https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip' } tools_archives = { 'win': 'sdk-tools-windows-3859397.zip', 'osx': 'sdk-tools-darwin-3859397.zip', 'linux': 'sdk-tools-linux-3859397.zip' } #------------------------------------------------------------------------------- def get_sdk_dir(fips_dir) : <|code_end|> , continue by predicting the next line. Consider current file imports: import os import sys import zipfile import subprocess import hashlib from urllib.request import urlretrieve from urllib import urlretrieve from mod import log, util from mod.tools import java, javac and context: # Path: mod/log.py # RED = '\033[1;31m' # GREEN = '\033[1;32m' # YELLOW = '\033[1;33m' # BLUE = '\033[1;36m' # DEF = '\033[0;0m' # def error(msg, fatal=True) : # def warn(msg) : # def ok(item, status) : # def failed(item, status) : # def optional(item, status) : # def info(msg) : # def colored(color, msg) : # # Path: mod/util.py # def fix_path(path) : # def get_workspace_dir(fips_dir) : # def get_project_dir(fips_dir, proj_name) : # def get_build_root_dir(fips_dir, proj_name): # def get_deploy_root_dir(fips_dir, proj_name): # def get_build_dir(fips_dir, proj_name, cfg) : # def get_deploy_dir(fips_dir, proj_name, cfg) : # def get_fips_dir(proj_dir, name): # def get_configs_dir(proj_dir): # def get_verbs_dir(proj_dir): # def get_generators_dir(proj_dir): # def get_toolchains_dir(proj_dir): # def get_giturl_from_url(url) : # def get_gitbranch_from_url(url) : # def get_project_name_from_url(url) : # def get_project_name_from_dir(proj_dir) : # def load_fips_yml(proj_dir) : # def lookup_target_cwd(proj_dir, target) : # def is_valid_project_dir(proj_dir) : # def ensure_valid_project_dir(proj_dir) : # def is_git_url(url) : # def confirm(question) : # def url_download_hook(count, block_size, total_size) : # def get_host_platform() : # def get_cfg_target_list(fips_dir, proj_dir, cfg): # def get_cfg_headersdirs_by_target(fips_dir, proj_dir, cfg): # def get_cfg_defines_by_target(fips_dir, proj_dir, cfg): # def get_num_cpucores(): # # Path: mod/tools/java.py # def check_exists(fips_dir) : # # Path: mod/tools/javac.py # def check_exists(fips_dir) : which might include code, classes, or functions. Output only the next line.
return util.get_workspace_dir(fips_dir) + '/fips-sdks/android'
Next line prediction: <|code_start|> subprocess.call('unzip {}'.format(path), cwd=get_sdk_dir(fips_dir), shell=True) else: with zipfile.ZipFile(path, 'r') as archive: archive.extractall(get_sdk_dir(fips_dir)) #------------------------------------------------------------------------------- def compute_sha256(path, converter=lambda x: x, chunk_size=65536) : if not os.path.isfile(path) : return None result = hashlib.sha256() with open(path, 'rb') as file : chunk = file.read(chunk_size) while chunk : result.update(converter(chunk)) chunk = file.read(chunk_size) return result.hexdigest() #------------------------------------------------------------------------------- def strip_whitespace(bin_str) : for ws in [b' ', b'\t', b'\n', b'\r', b'\x0b', b'\x0c']: bin_str = bin_str.replace(ws, b'') return bin_str #------------------------------------------------------------------------------- def setup(fips_dir) : """setup the Android SDK and NDK""" log.colored(log.YELLOW, '=== setup Android SDK/NDK :') # first make sure that java is present, otherwise the Android # SDK setup will finish without errors, but is not actually usable <|code_end|> . Use current file imports: (import os import sys import zipfile import subprocess import hashlib from urllib.request import urlretrieve from urllib import urlretrieve from mod import log, util from mod.tools import java, javac) and context including class names, function names, or small code snippets from other files: # Path: mod/log.py # RED = '\033[1;31m' # GREEN = '\033[1;32m' # YELLOW = '\033[1;33m' # BLUE = '\033[1;36m' # DEF = '\033[0;0m' # def error(msg, fatal=True) : # def warn(msg) : # def ok(item, status) : # def failed(item, status) : # def optional(item, status) : # def info(msg) : # def colored(color, msg) : # # Path: mod/util.py # def fix_path(path) : # def get_workspace_dir(fips_dir) : # def get_project_dir(fips_dir, proj_name) : # def get_build_root_dir(fips_dir, proj_name): # def get_deploy_root_dir(fips_dir, proj_name): # def get_build_dir(fips_dir, proj_name, cfg) : # def get_deploy_dir(fips_dir, proj_name, cfg) : # def get_fips_dir(proj_dir, name): # def get_configs_dir(proj_dir): # def get_verbs_dir(proj_dir): # def get_generators_dir(proj_dir): # def get_toolchains_dir(proj_dir): # def get_giturl_from_url(url) : # def get_gitbranch_from_url(url) : # def get_project_name_from_url(url) : # def get_project_name_from_dir(proj_dir) : # def load_fips_yml(proj_dir) : # def lookup_target_cwd(proj_dir, target) : # def is_valid_project_dir(proj_dir) : # def ensure_valid_project_dir(proj_dir) : # def is_git_url(url) : # def confirm(question) : # def url_download_hook(count, block_size, total_size) : # def get_host_platform() : # def get_cfg_target_list(fips_dir, proj_dir, cfg): # def get_cfg_headersdirs_by_target(fips_dir, proj_dir, cfg): # def get_cfg_defines_by_target(fips_dir, proj_dir, cfg): # def get_num_cpucores(): # # Path: mod/tools/java.py # def check_exists(fips_dir) : # # Path: mod/tools/javac.py # def check_exists(fips_dir) : . Output only the next line.
if not java.check_exists(fips_dir) or not javac.check_exists(fips_dir) :
Given the following code snippet before the placeholder: <|code_start|> subprocess.call('unzip {}'.format(path), cwd=get_sdk_dir(fips_dir), shell=True) else: with zipfile.ZipFile(path, 'r') as archive: archive.extractall(get_sdk_dir(fips_dir)) #------------------------------------------------------------------------------- def compute_sha256(path, converter=lambda x: x, chunk_size=65536) : if not os.path.isfile(path) : return None result = hashlib.sha256() with open(path, 'rb') as file : chunk = file.read(chunk_size) while chunk : result.update(converter(chunk)) chunk = file.read(chunk_size) return result.hexdigest() #------------------------------------------------------------------------------- def strip_whitespace(bin_str) : for ws in [b' ', b'\t', b'\n', b'\r', b'\x0b', b'\x0c']: bin_str = bin_str.replace(ws, b'') return bin_str #------------------------------------------------------------------------------- def setup(fips_dir) : """setup the Android SDK and NDK""" log.colored(log.YELLOW, '=== setup Android SDK/NDK :') # first make sure that java is present, otherwise the Android # SDK setup will finish without errors, but is not actually usable <|code_end|> , predict the next line using imports from the current file: import os import sys import zipfile import subprocess import hashlib from urllib.request import urlretrieve from urllib import urlretrieve from mod import log, util from mod.tools import java, javac and context including class names, function names, and sometimes code from other files: # Path: mod/log.py # RED = '\033[1;31m' # GREEN = '\033[1;32m' # YELLOW = '\033[1;33m' # BLUE = '\033[1;36m' # DEF = '\033[0;0m' # def error(msg, fatal=True) : # def warn(msg) : # def ok(item, status) : # def failed(item, status) : # def optional(item, status) : # def info(msg) : # def colored(color, msg) : # # Path: mod/util.py # def fix_path(path) : # def get_workspace_dir(fips_dir) : # def get_project_dir(fips_dir, proj_name) : # def get_build_root_dir(fips_dir, proj_name): # def get_deploy_root_dir(fips_dir, proj_name): # def get_build_dir(fips_dir, proj_name, cfg) : # def get_deploy_dir(fips_dir, proj_name, cfg) : # def get_fips_dir(proj_dir, name): # def get_configs_dir(proj_dir): # def get_verbs_dir(proj_dir): # def get_generators_dir(proj_dir): # def get_toolchains_dir(proj_dir): # def get_giturl_from_url(url) : # def get_gitbranch_from_url(url) : # def get_project_name_from_url(url) : # def get_project_name_from_dir(proj_dir) : # def load_fips_yml(proj_dir) : # def lookup_target_cwd(proj_dir, target) : # def is_valid_project_dir(proj_dir) : # def ensure_valid_project_dir(proj_dir) : # def is_git_url(url) : # def confirm(question) : # def url_download_hook(count, block_size, total_size) : # def get_host_platform() : # def get_cfg_target_list(fips_dir, proj_dir, cfg): # def get_cfg_headersdirs_by_target(fips_dir, proj_dir, cfg): # def get_cfg_defines_by_target(fips_dir, proj_dir, cfg): # def get_num_cpucores(): # # Path: mod/tools/java.py # def check_exists(fips_dir) : # # Path: mod/tools/javac.py # def check_exists(fips_dir) : . Output only the next line.
if not java.check_exists(fips_dir) or not javac.check_exists(fips_dir) :
Using the snippet: <|code_start|>"""helper verb for VSCode support vscode clean -- removes all .vscode directories in all dependencies """ #------------------------------------------------------------------------------- def run(fips_dir, proj_dir, args) : if not util.is_valid_project_dir(proj_dir) : <|code_end|> , determine the next line of code. You have imports: from mod import log, util from mod.tools import vscode and context (class names, function names, or code) available: # Path: mod/log.py # RED = '\033[1;31m' # GREEN = '\033[1;32m' # YELLOW = '\033[1;33m' # BLUE = '\033[1;36m' # DEF = '\033[0;0m' # def error(msg, fatal=True) : # def warn(msg) : # def ok(item, status) : # def failed(item, status) : # def optional(item, status) : # def info(msg) : # def colored(color, msg) : # # Path: mod/util.py # def fix_path(path) : # def get_workspace_dir(fips_dir) : # def get_project_dir(fips_dir, proj_name) : # def get_build_root_dir(fips_dir, proj_name): # def get_deploy_root_dir(fips_dir, proj_name): # def get_build_dir(fips_dir, proj_name, cfg) : # def get_deploy_dir(fips_dir, proj_name, cfg) : # def get_fips_dir(proj_dir, name): # def get_configs_dir(proj_dir): # def get_verbs_dir(proj_dir): # def get_generators_dir(proj_dir): # def get_toolchains_dir(proj_dir): # def get_giturl_from_url(url) : # def get_gitbranch_from_url(url) : # def get_project_name_from_url(url) : # def get_project_name_from_dir(proj_dir) : # def load_fips_yml(proj_dir) : # def lookup_target_cwd(proj_dir, target) : # def is_valid_project_dir(proj_dir) : # def ensure_valid_project_dir(proj_dir) : # def is_git_url(url) : # def confirm(question) : # def url_download_hook(count, block_size, total_size) : # def get_host_platform() : # def get_cfg_target_list(fips_dir, proj_dir, cfg): # def get_cfg_headersdirs_by_target(fips_dir, proj_dir, cfg): # def get_cfg_defines_by_target(fips_dir, proj_dir, cfg): # def get_num_cpucores(): # # Path: mod/tools/vscode.py # def try_exists(exe_name): # def exe_name(): # def check_exists(fips_dir) : # def match(build_tool): # def run(proj_dir): # def read_cmake_targets(fips_dir, proj_dir, cfg, types): # def read_cmake_headerdirs(fips_dir, proj_dir, cfg): # def read_cmake_defines(fips_dir, proj_dir, cfg): # def problem_matcher(): # def get_cc_header_paths(): # def get_vs_header_paths(fips_dir, proj_dir, cfg): # def list_extensions() : # def write_tasks_json(fips_dir, proj_dir, vscode_dir, cfg): # def write_launch_json(fips_dir, proj_dir, vscode_dir, cfg, proj_settings): # def write_c_cpp_properties_json(fips_dir, proj_dir, impex, cfg): # def write_cmake_tools_settings(fips_dir, proj_dir, vscode_dir, cfg): # def write_code_workspace_file(fips_dir, proj_dir, impex, cfg): # def remove_vscode_tasks_launch_files(fips_dir, proj_dir, impex, cfg): # def write_workspace_settings(fips_dir, proj_dir, cfg, proj_settings): # def cleanup(fips_dir, proj_dir): . Output only the next line.
log.error('must be run in a project directory')
Given the code snippet: <|code_start|>"""helper verb for VSCode support vscode clean -- removes all .vscode directories in all dependencies """ #------------------------------------------------------------------------------- def run(fips_dir, proj_dir, args) : if not util.is_valid_project_dir(proj_dir) : log.error('must be run in a project directory') if len(args) > 0: if args[0] == 'clean': <|code_end|> , generate the next line using the imports in this file: from mod import log, util from mod.tools import vscode and context (functions, classes, or occasionally code) from other files: # Path: mod/log.py # RED = '\033[1;31m' # GREEN = '\033[1;32m' # YELLOW = '\033[1;33m' # BLUE = '\033[1;36m' # DEF = '\033[0;0m' # def error(msg, fatal=True) : # def warn(msg) : # def ok(item, status) : # def failed(item, status) : # def optional(item, status) : # def info(msg) : # def colored(color, msg) : # # Path: mod/util.py # def fix_path(path) : # def get_workspace_dir(fips_dir) : # def get_project_dir(fips_dir, proj_name) : # def get_build_root_dir(fips_dir, proj_name): # def get_deploy_root_dir(fips_dir, proj_name): # def get_build_dir(fips_dir, proj_name, cfg) : # def get_deploy_dir(fips_dir, proj_name, cfg) : # def get_fips_dir(proj_dir, name): # def get_configs_dir(proj_dir): # def get_verbs_dir(proj_dir): # def get_generators_dir(proj_dir): # def get_toolchains_dir(proj_dir): # def get_giturl_from_url(url) : # def get_gitbranch_from_url(url) : # def get_project_name_from_url(url) : # def get_project_name_from_dir(proj_dir) : # def load_fips_yml(proj_dir) : # def lookup_target_cwd(proj_dir, target) : # def is_valid_project_dir(proj_dir) : # def ensure_valid_project_dir(proj_dir) : # def is_git_url(url) : # def confirm(question) : # def url_download_hook(count, block_size, total_size) : # def get_host_platform() : # def get_cfg_target_list(fips_dir, proj_dir, cfg): # def get_cfg_headersdirs_by_target(fips_dir, proj_dir, cfg): # def get_cfg_defines_by_target(fips_dir, proj_dir, cfg): # def get_num_cpucores(): # # Path: mod/tools/vscode.py # def try_exists(exe_name): # def exe_name(): # def check_exists(fips_dir) : # def match(build_tool): # def run(proj_dir): # def read_cmake_targets(fips_dir, proj_dir, cfg, types): # def read_cmake_headerdirs(fips_dir, proj_dir, cfg): # def read_cmake_defines(fips_dir, proj_dir, cfg): # def problem_matcher(): # def get_cc_header_paths(): # def get_vs_header_paths(fips_dir, proj_dir, cfg): # def list_extensions() : # def write_tasks_json(fips_dir, proj_dir, vscode_dir, cfg): # def write_launch_json(fips_dir, proj_dir, vscode_dir, cfg, proj_settings): # def write_c_cpp_properties_json(fips_dir, proj_dir, impex, cfg): # def write_cmake_tools_settings(fips_dir, proj_dir, vscode_dir, cfg): # def write_code_workspace_file(fips_dir, proj_dir, impex, cfg): # def remove_vscode_tasks_launch_files(fips_dir, proj_dir, impex, cfg): # def write_workspace_settings(fips_dir, proj_dir, cfg, proj_settings): # def cleanup(fips_dir, proj_dir): . Output only the next line.
vscode.cleanup(fips_dir, proj_dir)
Given the following code snippet before the placeholder: <|code_start|>"""update dependencies (only if no local changes) update -- update all dependencies update [proj] -- update a specific dependency update fips -- update fips itself """ #------------------------------------------------------------------------------- def run(fips_dir, proj_dir, args) : if len(args) > 0 and args[0] == 'fips' : if git.has_local_changes(fips_dir) : <|code_end|> , predict the next line using imports from the current file: from mod import log, util, dep from mod.tools import git and context including class names, function names, and sometimes code from other files: # Path: mod/log.py # RED = '\033[1;31m' # GREEN = '\033[1;32m' # YELLOW = '\033[1;33m' # BLUE = '\033[1;36m' # DEF = '\033[0;0m' # def error(msg, fatal=True) : # def warn(msg) : # def ok(item, status) : # def failed(item, status) : # def optional(item, status) : # def info(msg) : # def colored(color, msg) : # # Path: mod/util.py # def fix_path(path) : # def get_workspace_dir(fips_dir) : # def get_project_dir(fips_dir, proj_name) : # def get_build_root_dir(fips_dir, proj_name): # def get_deploy_root_dir(fips_dir, proj_name): # def get_build_dir(fips_dir, proj_name, cfg) : # def get_deploy_dir(fips_dir, proj_name, cfg) : # def get_fips_dir(proj_dir, name): # def get_configs_dir(proj_dir): # def get_verbs_dir(proj_dir): # def get_generators_dir(proj_dir): # def get_toolchains_dir(proj_dir): # def get_giturl_from_url(url) : # def get_gitbranch_from_url(url) : # def get_project_name_from_url(url) : # def get_project_name_from_dir(proj_dir) : # def load_fips_yml(proj_dir) : # def lookup_target_cwd(proj_dir, target) : # def is_valid_project_dir(proj_dir) : # def ensure_valid_project_dir(proj_dir) : # def is_git_url(url) : # def confirm(question) : # def url_download_hook(count, block_size, total_size) : # def get_host_platform() : # def get_cfg_target_list(fips_dir, proj_dir, cfg): # def get_cfg_headersdirs_by_target(fips_dir, proj_dir, cfg): # def get_cfg_defines_by_target(fips_dir, proj_dir, cfg): # def get_num_cpucores(): # # Path: mod/dep.py # def get_imports(fips_dir, proj_dir) : # def get_exports(proj_dir) : # def get_policy(proj_dir, policy) : # def _rec_get_all_imports_exports(fips_dir, proj_dir, result) : # def get_all_imports_exports(fips_dir, proj_dir) : # def _rec_fetch_imports(fips_dir, proj_dir, handled) : # def fetch_imports(fips_dir, proj_dir) : # def gather_imports(fips_dir, proj_dir) : # def write_imports(fips_dir, proj_dir, cfg_name, imported) : # def gather_and_write_imports(fips_dir, proj_dir, cfg_name) : # def check_imports(fips_dir, proj_dir) : # def check_local_changes(fips_dir, proj_dir) : # def _rec_update_imports(fips_dir, proj_dir, handled) : # def update_imports(fips_dir, proj_dir): # # Path: mod/tools/git.py # def check_exists(fips_dir=None) : # def check_exists_with_error(): # def clone(url, branch, depth, name, cwd) : # def add(proj_dir, update=False): # def commit(proj_dir, msg): # def commit_allow_empty(proj_dir, msg): # def push(proj_dir): # def has_local_changes(proj_dir): # def update_submodule(proj_dir): # def update(proj_dir): # def update_force_and_ignore_local_changes(proj_dir): # def get_branches(proj_dir) : # def checkout(proj_dir, revision) : # def has_uncommitted_files(proj_dir) : # def get_remote_rev(proj_dir, remote_branch) : # def get_local_rev(proj_dir, local_branch) : # def check_out_of_sync(proj_dir) : # def check_branch_out_of_sync(proj_dir, branch) : . Output only the next line.
log.warn(" '{}' has local changes, skipping...".format(fips_dir))
Using the snippet: <|code_start|>"""update dependencies (only if no local changes) update -- update all dependencies update [proj] -- update a specific dependency update fips -- update fips itself """ #------------------------------------------------------------------------------- def run(fips_dir, proj_dir, args) : if len(args) > 0 and args[0] == 'fips' : if git.has_local_changes(fips_dir) : log.warn(" '{}' has local changes, skipping...".format(fips_dir)) else : log.colored(log.BLUE, " updating '{}'...".format(fips_dir)) git.update(fips_dir) else : if len(args) > 0 : proj_name = args[0] <|code_end|> , determine the next line of code. You have imports: from mod import log, util, dep from mod.tools import git and context (class names, function names, or code) available: # Path: mod/log.py # RED = '\033[1;31m' # GREEN = '\033[1;32m' # YELLOW = '\033[1;33m' # BLUE = '\033[1;36m' # DEF = '\033[0;0m' # def error(msg, fatal=True) : # def warn(msg) : # def ok(item, status) : # def failed(item, status) : # def optional(item, status) : # def info(msg) : # def colored(color, msg) : # # Path: mod/util.py # def fix_path(path) : # def get_workspace_dir(fips_dir) : # def get_project_dir(fips_dir, proj_name) : # def get_build_root_dir(fips_dir, proj_name): # def get_deploy_root_dir(fips_dir, proj_name): # def get_build_dir(fips_dir, proj_name, cfg) : # def get_deploy_dir(fips_dir, proj_name, cfg) : # def get_fips_dir(proj_dir, name): # def get_configs_dir(proj_dir): # def get_verbs_dir(proj_dir): # def get_generators_dir(proj_dir): # def get_toolchains_dir(proj_dir): # def get_giturl_from_url(url) : # def get_gitbranch_from_url(url) : # def get_project_name_from_url(url) : # def get_project_name_from_dir(proj_dir) : # def load_fips_yml(proj_dir) : # def lookup_target_cwd(proj_dir, target) : # def is_valid_project_dir(proj_dir) : # def ensure_valid_project_dir(proj_dir) : # def is_git_url(url) : # def confirm(question) : # def url_download_hook(count, block_size, total_size) : # def get_host_platform() : # def get_cfg_target_list(fips_dir, proj_dir, cfg): # def get_cfg_headersdirs_by_target(fips_dir, proj_dir, cfg): # def get_cfg_defines_by_target(fips_dir, proj_dir, cfg): # def get_num_cpucores(): # # Path: mod/dep.py # def get_imports(fips_dir, proj_dir) : # def get_exports(proj_dir) : # def get_policy(proj_dir, policy) : # def _rec_get_all_imports_exports(fips_dir, proj_dir, result) : # def get_all_imports_exports(fips_dir, proj_dir) : # def _rec_fetch_imports(fips_dir, proj_dir, handled) : # def fetch_imports(fips_dir, proj_dir) : # def gather_imports(fips_dir, proj_dir) : # def write_imports(fips_dir, proj_dir, cfg_name, imported) : # def gather_and_write_imports(fips_dir, proj_dir, cfg_name) : # def check_imports(fips_dir, proj_dir) : # def check_local_changes(fips_dir, proj_dir) : # def _rec_update_imports(fips_dir, proj_dir, handled) : # def update_imports(fips_dir, proj_dir): # # Path: mod/tools/git.py # def check_exists(fips_dir=None) : # def check_exists_with_error(): # def clone(url, branch, depth, name, cwd) : # def add(proj_dir, update=False): # def commit(proj_dir, msg): # def commit_allow_empty(proj_dir, msg): # def push(proj_dir): # def has_local_changes(proj_dir): # def update_submodule(proj_dir): # def update(proj_dir): # def update_force_and_ignore_local_changes(proj_dir): # def get_branches(proj_dir) : # def checkout(proj_dir, revision) : # def has_uncommitted_files(proj_dir) : # def get_remote_rev(proj_dir, remote_branch) : # def get_local_rev(proj_dir, local_branch) : # def check_out_of_sync(proj_dir) : # def check_branch_out_of_sync(proj_dir, branch) : . Output only the next line.
proj_dir = util.get_project_dir(fips_dir, proj_name)
Based on the snippet: <|code_start|>"""update dependencies (only if no local changes) update -- update all dependencies update [proj] -- update a specific dependency update fips -- update fips itself """ #------------------------------------------------------------------------------- def run(fips_dir, proj_dir, args) : if len(args) > 0 and args[0] == 'fips' : if git.has_local_changes(fips_dir) : log.warn(" '{}' has local changes, skipping...".format(fips_dir)) else : log.colored(log.BLUE, " updating '{}'...".format(fips_dir)) git.update(fips_dir) else : if len(args) > 0 : proj_name = args[0] proj_dir = util.get_project_dir(fips_dir, proj_name) <|code_end|> , predict the immediate next line with the help of imports: from mod import log, util, dep from mod.tools import git and context (classes, functions, sometimes code) from other files: # Path: mod/log.py # RED = '\033[1;31m' # GREEN = '\033[1;32m' # YELLOW = '\033[1;33m' # BLUE = '\033[1;36m' # DEF = '\033[0;0m' # def error(msg, fatal=True) : # def warn(msg) : # def ok(item, status) : # def failed(item, status) : # def optional(item, status) : # def info(msg) : # def colored(color, msg) : # # Path: mod/util.py # def fix_path(path) : # def get_workspace_dir(fips_dir) : # def get_project_dir(fips_dir, proj_name) : # def get_build_root_dir(fips_dir, proj_name): # def get_deploy_root_dir(fips_dir, proj_name): # def get_build_dir(fips_dir, proj_name, cfg) : # def get_deploy_dir(fips_dir, proj_name, cfg) : # def get_fips_dir(proj_dir, name): # def get_configs_dir(proj_dir): # def get_verbs_dir(proj_dir): # def get_generators_dir(proj_dir): # def get_toolchains_dir(proj_dir): # def get_giturl_from_url(url) : # def get_gitbranch_from_url(url) : # def get_project_name_from_url(url) : # def get_project_name_from_dir(proj_dir) : # def load_fips_yml(proj_dir) : # def lookup_target_cwd(proj_dir, target) : # def is_valid_project_dir(proj_dir) : # def ensure_valid_project_dir(proj_dir) : # def is_git_url(url) : # def confirm(question) : # def url_download_hook(count, block_size, total_size) : # def get_host_platform() : # def get_cfg_target_list(fips_dir, proj_dir, cfg): # def get_cfg_headersdirs_by_target(fips_dir, proj_dir, cfg): # def get_cfg_defines_by_target(fips_dir, proj_dir, cfg): # def get_num_cpucores(): # # Path: mod/dep.py # def get_imports(fips_dir, proj_dir) : # def get_exports(proj_dir) : # def get_policy(proj_dir, policy) : # def _rec_get_all_imports_exports(fips_dir, proj_dir, result) : # def get_all_imports_exports(fips_dir, proj_dir) : # def _rec_fetch_imports(fips_dir, proj_dir, handled) : # def fetch_imports(fips_dir, proj_dir) : # def gather_imports(fips_dir, proj_dir) : # def write_imports(fips_dir, proj_dir, cfg_name, imported) : # def gather_and_write_imports(fips_dir, proj_dir, cfg_name) : # def check_imports(fips_dir, proj_dir) : # def check_local_changes(fips_dir, proj_dir) : # def _rec_update_imports(fips_dir, proj_dir, handled) : # def update_imports(fips_dir, proj_dir): # # Path: mod/tools/git.py # def check_exists(fips_dir=None) : # def check_exists_with_error(): # def clone(url, branch, depth, name, cwd) : # def add(proj_dir, update=False): # def commit(proj_dir, msg): # def commit_allow_empty(proj_dir, msg): # def push(proj_dir): # def has_local_changes(proj_dir): # def update_submodule(proj_dir): # def update(proj_dir): # def update_force_and_ignore_local_changes(proj_dir): # def get_branches(proj_dir) : # def checkout(proj_dir, revision) : # def has_uncommitted_files(proj_dir) : # def get_remote_rev(proj_dir, remote_branch) : # def get_local_rev(proj_dir, local_branch) : # def check_out_of_sync(proj_dir) : # def check_branch_out_of_sync(proj_dir, branch) : . Output only the next line.
dep.update_imports(fips_dir, proj_dir)
Using the snippet: <|code_start|>"""update dependencies (only if no local changes) update -- update all dependencies update [proj] -- update a specific dependency update fips -- update fips itself """ #------------------------------------------------------------------------------- def run(fips_dir, proj_dir, args) : if len(args) > 0 and args[0] == 'fips' : <|code_end|> , determine the next line of code. You have imports: from mod import log, util, dep from mod.tools import git and context (class names, function names, or code) available: # Path: mod/log.py # RED = '\033[1;31m' # GREEN = '\033[1;32m' # YELLOW = '\033[1;33m' # BLUE = '\033[1;36m' # DEF = '\033[0;0m' # def error(msg, fatal=True) : # def warn(msg) : # def ok(item, status) : # def failed(item, status) : # def optional(item, status) : # def info(msg) : # def colored(color, msg) : # # Path: mod/util.py # def fix_path(path) : # def get_workspace_dir(fips_dir) : # def get_project_dir(fips_dir, proj_name) : # def get_build_root_dir(fips_dir, proj_name): # def get_deploy_root_dir(fips_dir, proj_name): # def get_build_dir(fips_dir, proj_name, cfg) : # def get_deploy_dir(fips_dir, proj_name, cfg) : # def get_fips_dir(proj_dir, name): # def get_configs_dir(proj_dir): # def get_verbs_dir(proj_dir): # def get_generators_dir(proj_dir): # def get_toolchains_dir(proj_dir): # def get_giturl_from_url(url) : # def get_gitbranch_from_url(url) : # def get_project_name_from_url(url) : # def get_project_name_from_dir(proj_dir) : # def load_fips_yml(proj_dir) : # def lookup_target_cwd(proj_dir, target) : # def is_valid_project_dir(proj_dir) : # def ensure_valid_project_dir(proj_dir) : # def is_git_url(url) : # def confirm(question) : # def url_download_hook(count, block_size, total_size) : # def get_host_platform() : # def get_cfg_target_list(fips_dir, proj_dir, cfg): # def get_cfg_headersdirs_by_target(fips_dir, proj_dir, cfg): # def get_cfg_defines_by_target(fips_dir, proj_dir, cfg): # def get_num_cpucores(): # # Path: mod/dep.py # def get_imports(fips_dir, proj_dir) : # def get_exports(proj_dir) : # def get_policy(proj_dir, policy) : # def _rec_get_all_imports_exports(fips_dir, proj_dir, result) : # def get_all_imports_exports(fips_dir, proj_dir) : # def _rec_fetch_imports(fips_dir, proj_dir, handled) : # def fetch_imports(fips_dir, proj_dir) : # def gather_imports(fips_dir, proj_dir) : # def write_imports(fips_dir, proj_dir, cfg_name, imported) : # def gather_and_write_imports(fips_dir, proj_dir, cfg_name) : # def check_imports(fips_dir, proj_dir) : # def check_local_changes(fips_dir, proj_dir) : # def _rec_update_imports(fips_dir, proj_dir, handled) : # def update_imports(fips_dir, proj_dir): # # Path: mod/tools/git.py # def check_exists(fips_dir=None) : # def check_exists_with_error(): # def clone(url, branch, depth, name, cwd) : # def add(proj_dir, update=False): # def commit(proj_dir, msg): # def commit_allow_empty(proj_dir, msg): # def push(proj_dir): # def has_local_changes(proj_dir): # def update_submodule(proj_dir): # def update(proj_dir): # def update_force_and_ignore_local_changes(proj_dir): # def get_branches(proj_dir) : # def checkout(proj_dir, revision) : # def has_uncommitted_files(proj_dir) : # def get_remote_rev(proj_dir, remote_branch) : # def get_local_rev(proj_dir, local_branch) : # def check_out_of_sync(proj_dir) : # def check_branch_out_of_sync(proj_dir, branch) : . Output only the next line.
if git.has_local_changes(fips_dir) :
Given the following code snippet before the placeholder: <|code_start|>""" emscripten SDK installation and maintenance """ #------------------------------------------------------------------------------- def run(fips_dir, proj_dir, args): if len(args) > 0: cmd = args[0] if cmd == 'install': emsdk_version = None if len(args) > 1: emsdk_version = args[1] emsdk.install(fips_dir, emsdk_version) elif cmd == 'list': emsdk.list(fips_dir) elif cmd == 'activate': if len(args) > 1: emsdk_version = args[1] emsdk.activate(fips_dir, emsdk_version) else: <|code_end|> , predict the next line using imports from the current file: from mod import log, emsdk and context including class names, function names, and sometimes code from other files: # Path: mod/log.py # RED = '\033[1;31m' # GREEN = '\033[1;32m' # YELLOW = '\033[1;33m' # BLUE = '\033[1;36m' # DEF = '\033[0;0m' # def error(msg, fatal=True) : # def warn(msg) : # def ok(item, status) : # def failed(item, status) : # def optional(item, status) : # def info(msg) : # def colored(color, msg) : # # Path: mod/emsdk.py # EMSDK_URL = "https://github.com/emscripten-core/emsdk.git" # EMSDK_DEFAULT_VERSION = 'latest' # def remove_readonly(func, path, _): # def get_sdkroot_dir(fips_dir): # def sdkroot_exists(fips_dir): # def make_dirs(fips_dir): # def get_emsdk_dir(fips_dir): # def emsdk_dir_exists(fips_dir): # def get_emsdk_path(fips_dir): # def check_exists(fips_dir): # def get_em_config(fips_dir): # def run(fips_dir, cmdline): # def clone_or_update_emsdk(fips_dir): # def list(fips_dir): # def activate(fips_dir, emsdk_version): # def install(fips_dir, emsdk_version): # def remove_old_sdks(fips_dir): # def uninstall(fips_dir): # def parse_config(fips_dir): # def show_config(fips_dir): # def get_emscripten_root(fips_dir): . Output only the next line.
log.error("emscripten SDK version expected (run './fips emsdk list')")
Next line prediction: <|code_start|>""" emscripten SDK installation and maintenance """ #------------------------------------------------------------------------------- def run(fips_dir, proj_dir, args): if len(args) > 0: cmd = args[0] if cmd == 'install': emsdk_version = None if len(args) > 1: emsdk_version = args[1] <|code_end|> . Use current file imports: (from mod import log, emsdk) and context including class names, function names, or small code snippets from other files: # Path: mod/log.py # RED = '\033[1;31m' # GREEN = '\033[1;32m' # YELLOW = '\033[1;33m' # BLUE = '\033[1;36m' # DEF = '\033[0;0m' # def error(msg, fatal=True) : # def warn(msg) : # def ok(item, status) : # def failed(item, status) : # def optional(item, status) : # def info(msg) : # def colored(color, msg) : # # Path: mod/emsdk.py # EMSDK_URL = "https://github.com/emscripten-core/emsdk.git" # EMSDK_DEFAULT_VERSION = 'latest' # def remove_readonly(func, path, _): # def get_sdkroot_dir(fips_dir): # def sdkroot_exists(fips_dir): # def make_dirs(fips_dir): # def get_emsdk_dir(fips_dir): # def emsdk_dir_exists(fips_dir): # def get_emsdk_path(fips_dir): # def check_exists(fips_dir): # def get_em_config(fips_dir): # def run(fips_dir, cmdline): # def clone_or_update_emsdk(fips_dir): # def list(fips_dir): # def activate(fips_dir, emsdk_version): # def install(fips_dir, emsdk_version): # def remove_old_sdks(fips_dir): # def uninstall(fips_dir): # def parse_config(fips_dir): # def show_config(fips_dir): # def get_emscripten_root(fips_dir): . Output only the next line.
emsdk.install(fips_dir, emsdk_version)
Predict the next line after this snippet: <|code_start|>"""'setup' verb to setup platform SDKs setup emscripten setup android """ #------------------------------------------------------------------------------- def run(fips_dir, proj_dir, args) : """run the 'setup' verb""" sdk_name = None if len(args) > 0 : sdk_name = args[0] if sdk_name == 'emscripten' : emsdk.install(fips_dir, None) elif sdk_name == 'android' : android.setup(fips_dir) elif sdk_name == 'wasisdk': wasisdk.setup(fips_dir) else : <|code_end|> using the current file's imports: from mod import log, emsdk, android, wasisdk and any relevant context from other files: # Path: mod/log.py # RED = '\033[1;31m' # GREEN = '\033[1;32m' # YELLOW = '\033[1;33m' # BLUE = '\033[1;36m' # DEF = '\033[0;0m' # def error(msg, fatal=True) : # def warn(msg) : # def ok(item, status) : # def failed(item, status) : # def optional(item, status) : # def info(msg) : # def colored(color, msg) : # # Path: mod/emsdk.py # EMSDK_URL = "https://github.com/emscripten-core/emsdk.git" # EMSDK_DEFAULT_VERSION = 'latest' # def remove_readonly(func, path, _): # def get_sdkroot_dir(fips_dir): # def sdkroot_exists(fips_dir): # def make_dirs(fips_dir): # def get_emsdk_dir(fips_dir): # def emsdk_dir_exists(fips_dir): # def get_emsdk_path(fips_dir): # def check_exists(fips_dir): # def get_em_config(fips_dir): # def run(fips_dir, cmdline): # def clone_or_update_emsdk(fips_dir): # def list(fips_dir): # def activate(fips_dir, emsdk_version): # def install(fips_dir, emsdk_version): # def remove_old_sdks(fips_dir): # def uninstall(fips_dir): # def parse_config(fips_dir): # def show_config(fips_dir): # def get_emscripten_root(fips_dir): # # Path: mod/android.py # def get_sdk_dir(fips_dir) : # def check_exists(fips_dir) : # def get_adb_path(fips_dir): # def get_tools_url() : # def get_tools_archive_path(fips_dir): # def target_to_package_name(target): # def install_package(fips_dir, pkg): # def ensure_sdk_dirs(fips_dir) : # def uncompress(fips_dir, path) : # def compute_sha256(path, converter=lambda x: x, chunk_size=65536) : # def strip_whitespace(bin_str) : # def setup(fips_dir) : # # Path: mod/wasisdk.py # def get_sdk_dir(fips_dir): # def check_exists(fips_dir): # def get_url(): # def get_archive_path(fips_dir): # def get_wasisdk_root(fips_dir): # def sdk_dir_exists(fips_dir): # def ensure_sdk_dirs(fips_dir) : # def install(fips_dir): # def uninstall(fips_dir): . Output only the next line.
log.error("invalid SDK name (must be 'emscripten' or 'android')")
Predict the next line after this snippet: <|code_start|>"""'setup' verb to setup platform SDKs setup emscripten setup android """ #------------------------------------------------------------------------------- def run(fips_dir, proj_dir, args) : """run the 'setup' verb""" sdk_name = None if len(args) > 0 : sdk_name = args[0] if sdk_name == 'emscripten' : <|code_end|> using the current file's imports: from mod import log, emsdk, android, wasisdk and any relevant context from other files: # Path: mod/log.py # RED = '\033[1;31m' # GREEN = '\033[1;32m' # YELLOW = '\033[1;33m' # BLUE = '\033[1;36m' # DEF = '\033[0;0m' # def error(msg, fatal=True) : # def warn(msg) : # def ok(item, status) : # def failed(item, status) : # def optional(item, status) : # def info(msg) : # def colored(color, msg) : # # Path: mod/emsdk.py # EMSDK_URL = "https://github.com/emscripten-core/emsdk.git" # EMSDK_DEFAULT_VERSION = 'latest' # def remove_readonly(func, path, _): # def get_sdkroot_dir(fips_dir): # def sdkroot_exists(fips_dir): # def make_dirs(fips_dir): # def get_emsdk_dir(fips_dir): # def emsdk_dir_exists(fips_dir): # def get_emsdk_path(fips_dir): # def check_exists(fips_dir): # def get_em_config(fips_dir): # def run(fips_dir, cmdline): # def clone_or_update_emsdk(fips_dir): # def list(fips_dir): # def activate(fips_dir, emsdk_version): # def install(fips_dir, emsdk_version): # def remove_old_sdks(fips_dir): # def uninstall(fips_dir): # def parse_config(fips_dir): # def show_config(fips_dir): # def get_emscripten_root(fips_dir): # # Path: mod/android.py # def get_sdk_dir(fips_dir) : # def check_exists(fips_dir) : # def get_adb_path(fips_dir): # def get_tools_url() : # def get_tools_archive_path(fips_dir): # def target_to_package_name(target): # def install_package(fips_dir, pkg): # def ensure_sdk_dirs(fips_dir) : # def uncompress(fips_dir, path) : # def compute_sha256(path, converter=lambda x: x, chunk_size=65536) : # def strip_whitespace(bin_str) : # def setup(fips_dir) : # # Path: mod/wasisdk.py # def get_sdk_dir(fips_dir): # def check_exists(fips_dir): # def get_url(): # def get_archive_path(fips_dir): # def get_wasisdk_root(fips_dir): # def sdk_dir_exists(fips_dir): # def ensure_sdk_dirs(fips_dir) : # def install(fips_dir): # def uninstall(fips_dir): . Output only the next line.
emsdk.install(fips_dir, None)
Next line prediction: <|code_start|>"""'setup' verb to setup platform SDKs setup emscripten setup android """ #------------------------------------------------------------------------------- def run(fips_dir, proj_dir, args) : """run the 'setup' verb""" sdk_name = None if len(args) > 0 : sdk_name = args[0] if sdk_name == 'emscripten' : emsdk.install(fips_dir, None) elif sdk_name == 'android' : <|code_end|> . Use current file imports: (from mod import log, emsdk, android, wasisdk) and context including class names, function names, or small code snippets from other files: # Path: mod/log.py # RED = '\033[1;31m' # GREEN = '\033[1;32m' # YELLOW = '\033[1;33m' # BLUE = '\033[1;36m' # DEF = '\033[0;0m' # def error(msg, fatal=True) : # def warn(msg) : # def ok(item, status) : # def failed(item, status) : # def optional(item, status) : # def info(msg) : # def colored(color, msg) : # # Path: mod/emsdk.py # EMSDK_URL = "https://github.com/emscripten-core/emsdk.git" # EMSDK_DEFAULT_VERSION = 'latest' # def remove_readonly(func, path, _): # def get_sdkroot_dir(fips_dir): # def sdkroot_exists(fips_dir): # def make_dirs(fips_dir): # def get_emsdk_dir(fips_dir): # def emsdk_dir_exists(fips_dir): # def get_emsdk_path(fips_dir): # def check_exists(fips_dir): # def get_em_config(fips_dir): # def run(fips_dir, cmdline): # def clone_or_update_emsdk(fips_dir): # def list(fips_dir): # def activate(fips_dir, emsdk_version): # def install(fips_dir, emsdk_version): # def remove_old_sdks(fips_dir): # def uninstall(fips_dir): # def parse_config(fips_dir): # def show_config(fips_dir): # def get_emscripten_root(fips_dir): # # Path: mod/android.py # def get_sdk_dir(fips_dir) : # def check_exists(fips_dir) : # def get_adb_path(fips_dir): # def get_tools_url() : # def get_tools_archive_path(fips_dir): # def target_to_package_name(target): # def install_package(fips_dir, pkg): # def ensure_sdk_dirs(fips_dir) : # def uncompress(fips_dir, path) : # def compute_sha256(path, converter=lambda x: x, chunk_size=65536) : # def strip_whitespace(bin_str) : # def setup(fips_dir) : # # Path: mod/wasisdk.py # def get_sdk_dir(fips_dir): # def check_exists(fips_dir): # def get_url(): # def get_archive_path(fips_dir): # def get_wasisdk_root(fips_dir): # def sdk_dir_exists(fips_dir): # def ensure_sdk_dirs(fips_dir) : # def install(fips_dir): # def uninstall(fips_dir): . Output only the next line.
android.setup(fips_dir)
Predict the next line for this snippet: <|code_start|>"""'setup' verb to setup platform SDKs setup emscripten setup android """ #------------------------------------------------------------------------------- def run(fips_dir, proj_dir, args) : """run the 'setup' verb""" sdk_name = None if len(args) > 0 : sdk_name = args[0] if sdk_name == 'emscripten' : emsdk.install(fips_dir, None) elif sdk_name == 'android' : android.setup(fips_dir) elif sdk_name == 'wasisdk': <|code_end|> with the help of current file imports: from mod import log, emsdk, android, wasisdk and context from other files: # Path: mod/log.py # RED = '\033[1;31m' # GREEN = '\033[1;32m' # YELLOW = '\033[1;33m' # BLUE = '\033[1;36m' # DEF = '\033[0;0m' # def error(msg, fatal=True) : # def warn(msg) : # def ok(item, status) : # def failed(item, status) : # def optional(item, status) : # def info(msg) : # def colored(color, msg) : # # Path: mod/emsdk.py # EMSDK_URL = "https://github.com/emscripten-core/emsdk.git" # EMSDK_DEFAULT_VERSION = 'latest' # def remove_readonly(func, path, _): # def get_sdkroot_dir(fips_dir): # def sdkroot_exists(fips_dir): # def make_dirs(fips_dir): # def get_emsdk_dir(fips_dir): # def emsdk_dir_exists(fips_dir): # def get_emsdk_path(fips_dir): # def check_exists(fips_dir): # def get_em_config(fips_dir): # def run(fips_dir, cmdline): # def clone_or_update_emsdk(fips_dir): # def list(fips_dir): # def activate(fips_dir, emsdk_version): # def install(fips_dir, emsdk_version): # def remove_old_sdks(fips_dir): # def uninstall(fips_dir): # def parse_config(fips_dir): # def show_config(fips_dir): # def get_emscripten_root(fips_dir): # # Path: mod/android.py # def get_sdk_dir(fips_dir) : # def check_exists(fips_dir) : # def get_adb_path(fips_dir): # def get_tools_url() : # def get_tools_archive_path(fips_dir): # def target_to_package_name(target): # def install_package(fips_dir, pkg): # def ensure_sdk_dirs(fips_dir) : # def uncompress(fips_dir, path) : # def compute_sha256(path, converter=lambda x: x, chunk_size=65536) : # def strip_whitespace(bin_str) : # def setup(fips_dir) : # # Path: mod/wasisdk.py # def get_sdk_dir(fips_dir): # def check_exists(fips_dir): # def get_url(): # def get_archive_path(fips_dir): # def get_wasisdk_root(fips_dir): # def sdk_dir_exists(fips_dir): # def ensure_sdk_dirs(fips_dir) : # def install(fips_dir): # def uninstall(fips_dir): , which may contain function names, class names, or code. Output only the next line.
wasisdk.setup(fips_dir)
Given the code snippet: <|code_start|>"""run built exes run [target] run [target] [config] """ #------------------------------------------------------------------------------- def run(fips_dir, proj_dir, args) : """run fips project build targets""" if not util.is_valid_project_dir(proj_dir) : <|code_end|> , generate the next line using the imports in this file: import sys from mod import log, util, config, project, settings and context (functions, classes, or occasionally code) from other files: # Path: mod/log.py # RED = '\033[1;31m' # GREEN = '\033[1;32m' # YELLOW = '\033[1;33m' # BLUE = '\033[1;36m' # DEF = '\033[0;0m' # def error(msg, fatal=True) : # def warn(msg) : # def ok(item, status) : # def failed(item, status) : # def optional(item, status) : # def info(msg) : # def colored(color, msg) : # # Path: mod/util.py # def fix_path(path) : # def get_workspace_dir(fips_dir) : # def get_project_dir(fips_dir, proj_name) : # def get_build_root_dir(fips_dir, proj_name): # def get_deploy_root_dir(fips_dir, proj_name): # def get_build_dir(fips_dir, proj_name, cfg) : # def get_deploy_dir(fips_dir, proj_name, cfg) : # def get_fips_dir(proj_dir, name): # def get_configs_dir(proj_dir): # def get_verbs_dir(proj_dir): # def get_generators_dir(proj_dir): # def get_toolchains_dir(proj_dir): # def get_giturl_from_url(url) : # def get_gitbranch_from_url(url) : # def get_project_name_from_url(url) : # def get_project_name_from_dir(proj_dir) : # def load_fips_yml(proj_dir) : # def lookup_target_cwd(proj_dir, target) : # def is_valid_project_dir(proj_dir) : # def ensure_valid_project_dir(proj_dir) : # def is_git_url(url) : # def confirm(question) : # def url_download_hook(count, block_size, total_size) : # def get_host_platform() : # def get_cfg_target_list(fips_dir, proj_dir, cfg): # def get_cfg_headersdirs_by_target(fips_dir, proj_dir, cfg): # def get_cfg_defines_by_target(fips_dir, proj_dir, cfg): # def get_num_cpucores(): # # Path: mod/config.py # def valid_build_tool(name) : # def get_default_config() : # def get_toolchain(fips_dir, proj_dir, cfg) : # def exists(pattern, proj_dirs) : # def get_config_dirs(fips_dir, proj_dir) : # def list(fips_dir, proj_dir, pattern) : # def load(fips_dir, proj_dir, pattern) : # def missing_build_tools(fips_dir, tool_name) : # def check_sdk(fips_dir, platform_name) : # def check_config_valid(fips_dir, proj_dir, cfg, print_errors=False) : # # Path: mod/project.py # def init(fips_dir, proj_name) : # def clone(fips_dir, url) : # def gen_project(fips_dir, proj_dir, cfg, force) : # def gen(fips_dir, proj_dir, cfg_name) : # def configure(fips_dir, proj_dir, cfg_name) : # def make_clean(fips_dir, proj_dir, cfg_name) : # def build(fips_dir, proj_dir, cfg_name, target=None, build_tool_args=None) : # def run(fips_dir, proj_dir, cfg_name, target_name, target_args, target_cwd) : # def clean(fips_dir, proj_dir, cfg_name) : # def get_target_list(fips_dir, proj_dir, cfg_name) : # # Path: mod/settings.py # def load(proj_dir) : # def save(proj_dir, settings) : # def get_default(key) : # def get(proj_dir, key) : # def set(proj_dir, key, value) : # def unset(proj_dir, key) : # def get_all_settings(proj_dir): . Output only the next line.
log.error('must be run in a project directory')
Given snippet: <|code_start|>"""run built exes run [target] run [target] [config] """ #------------------------------------------------------------------------------- def run(fips_dir, proj_dir, args) : """run fips project build targets""" <|code_end|> , continue by predicting the next line. Consider current file imports: import sys from mod import log, util, config, project, settings and context: # Path: mod/log.py # RED = '\033[1;31m' # GREEN = '\033[1;32m' # YELLOW = '\033[1;33m' # BLUE = '\033[1;36m' # DEF = '\033[0;0m' # def error(msg, fatal=True) : # def warn(msg) : # def ok(item, status) : # def failed(item, status) : # def optional(item, status) : # def info(msg) : # def colored(color, msg) : # # Path: mod/util.py # def fix_path(path) : # def get_workspace_dir(fips_dir) : # def get_project_dir(fips_dir, proj_name) : # def get_build_root_dir(fips_dir, proj_name): # def get_deploy_root_dir(fips_dir, proj_name): # def get_build_dir(fips_dir, proj_name, cfg) : # def get_deploy_dir(fips_dir, proj_name, cfg) : # def get_fips_dir(proj_dir, name): # def get_configs_dir(proj_dir): # def get_verbs_dir(proj_dir): # def get_generators_dir(proj_dir): # def get_toolchains_dir(proj_dir): # def get_giturl_from_url(url) : # def get_gitbranch_from_url(url) : # def get_project_name_from_url(url) : # def get_project_name_from_dir(proj_dir) : # def load_fips_yml(proj_dir) : # def lookup_target_cwd(proj_dir, target) : # def is_valid_project_dir(proj_dir) : # def ensure_valid_project_dir(proj_dir) : # def is_git_url(url) : # def confirm(question) : # def url_download_hook(count, block_size, total_size) : # def get_host_platform() : # def get_cfg_target_list(fips_dir, proj_dir, cfg): # def get_cfg_headersdirs_by_target(fips_dir, proj_dir, cfg): # def get_cfg_defines_by_target(fips_dir, proj_dir, cfg): # def get_num_cpucores(): # # Path: mod/config.py # def valid_build_tool(name) : # def get_default_config() : # def get_toolchain(fips_dir, proj_dir, cfg) : # def exists(pattern, proj_dirs) : # def get_config_dirs(fips_dir, proj_dir) : # def list(fips_dir, proj_dir, pattern) : # def load(fips_dir, proj_dir, pattern) : # def missing_build_tools(fips_dir, tool_name) : # def check_sdk(fips_dir, platform_name) : # def check_config_valid(fips_dir, proj_dir, cfg, print_errors=False) : # # Path: mod/project.py # def init(fips_dir, proj_name) : # def clone(fips_dir, url) : # def gen_project(fips_dir, proj_dir, cfg, force) : # def gen(fips_dir, proj_dir, cfg_name) : # def configure(fips_dir, proj_dir, cfg_name) : # def make_clean(fips_dir, proj_dir, cfg_name) : # def build(fips_dir, proj_dir, cfg_name, target=None, build_tool_args=None) : # def run(fips_dir, proj_dir, cfg_name, target_name, target_args, target_cwd) : # def clean(fips_dir, proj_dir, cfg_name) : # def get_target_list(fips_dir, proj_dir, cfg_name) : # # Path: mod/settings.py # def load(proj_dir) : # def save(proj_dir, settings) : # def get_default(key) : # def get(proj_dir, key) : # def set(proj_dir, key, value) : # def unset(proj_dir, key) : # def get_all_settings(proj_dir): which might include code, classes, or functions. Output only the next line.
if not util.is_valid_project_dir(proj_dir) :
Given the code snippet: <|code_start|>"""run built exes run [target] run [target] [config] """ #------------------------------------------------------------------------------- def run(fips_dir, proj_dir, args) : """run fips project build targets""" if not util.is_valid_project_dir(proj_dir) : log.error('must be run in a project directory') cfg_name = settings.get(proj_dir, 'config') target_name = settings.get(proj_dir, 'target') target_args = [] if '--' in args : idx = args.index('--') target_args = args[(idx + 1):] args = args[:idx] if len(args) > 0 : target_name = args[0] if len(args) > 1 : cfg_name = args[1] if target_name : target_cwd = util.lookup_target_cwd(proj_dir, target_name) <|code_end|> , generate the next line using the imports in this file: import sys from mod import log, util, config, project, settings and context (functions, classes, or occasionally code) from other files: # Path: mod/log.py # RED = '\033[1;31m' # GREEN = '\033[1;32m' # YELLOW = '\033[1;33m' # BLUE = '\033[1;36m' # DEF = '\033[0;0m' # def error(msg, fatal=True) : # def warn(msg) : # def ok(item, status) : # def failed(item, status) : # def optional(item, status) : # def info(msg) : # def colored(color, msg) : # # Path: mod/util.py # def fix_path(path) : # def get_workspace_dir(fips_dir) : # def get_project_dir(fips_dir, proj_name) : # def get_build_root_dir(fips_dir, proj_name): # def get_deploy_root_dir(fips_dir, proj_name): # def get_build_dir(fips_dir, proj_name, cfg) : # def get_deploy_dir(fips_dir, proj_name, cfg) : # def get_fips_dir(proj_dir, name): # def get_configs_dir(proj_dir): # def get_verbs_dir(proj_dir): # def get_generators_dir(proj_dir): # def get_toolchains_dir(proj_dir): # def get_giturl_from_url(url) : # def get_gitbranch_from_url(url) : # def get_project_name_from_url(url) : # def get_project_name_from_dir(proj_dir) : # def load_fips_yml(proj_dir) : # def lookup_target_cwd(proj_dir, target) : # def is_valid_project_dir(proj_dir) : # def ensure_valid_project_dir(proj_dir) : # def is_git_url(url) : # def confirm(question) : # def url_download_hook(count, block_size, total_size) : # def get_host_platform() : # def get_cfg_target_list(fips_dir, proj_dir, cfg): # def get_cfg_headersdirs_by_target(fips_dir, proj_dir, cfg): # def get_cfg_defines_by_target(fips_dir, proj_dir, cfg): # def get_num_cpucores(): # # Path: mod/config.py # def valid_build_tool(name) : # def get_default_config() : # def get_toolchain(fips_dir, proj_dir, cfg) : # def exists(pattern, proj_dirs) : # def get_config_dirs(fips_dir, proj_dir) : # def list(fips_dir, proj_dir, pattern) : # def load(fips_dir, proj_dir, pattern) : # def missing_build_tools(fips_dir, tool_name) : # def check_sdk(fips_dir, platform_name) : # def check_config_valid(fips_dir, proj_dir, cfg, print_errors=False) : # # Path: mod/project.py # def init(fips_dir, proj_name) : # def clone(fips_dir, url) : # def gen_project(fips_dir, proj_dir, cfg, force) : # def gen(fips_dir, proj_dir, cfg_name) : # def configure(fips_dir, proj_dir, cfg_name) : # def make_clean(fips_dir, proj_dir, cfg_name) : # def build(fips_dir, proj_dir, cfg_name, target=None, build_tool_args=None) : # def run(fips_dir, proj_dir, cfg_name, target_name, target_args, target_cwd) : # def clean(fips_dir, proj_dir, cfg_name) : # def get_target_list(fips_dir, proj_dir, cfg_name) : # # Path: mod/settings.py # def load(proj_dir) : # def save(proj_dir, settings) : # def get_default(key) : # def get(proj_dir, key) : # def set(proj_dir, key, value) : # def unset(proj_dir, key) : # def get_all_settings(proj_dir): . Output only the next line.
retcode = project.run(fips_dir, proj_dir, cfg_name, target_name, target_args, target_cwd)
Using the snippet: <|code_start|>"""run built exes run [target] run [target] [config] """ #------------------------------------------------------------------------------- def run(fips_dir, proj_dir, args) : """run fips project build targets""" if not util.is_valid_project_dir(proj_dir) : log.error('must be run in a project directory') <|code_end|> , determine the next line of code. You have imports: import sys from mod import log, util, config, project, settings and context (class names, function names, or code) available: # Path: mod/log.py # RED = '\033[1;31m' # GREEN = '\033[1;32m' # YELLOW = '\033[1;33m' # BLUE = '\033[1;36m' # DEF = '\033[0;0m' # def error(msg, fatal=True) : # def warn(msg) : # def ok(item, status) : # def failed(item, status) : # def optional(item, status) : # def info(msg) : # def colored(color, msg) : # # Path: mod/util.py # def fix_path(path) : # def get_workspace_dir(fips_dir) : # def get_project_dir(fips_dir, proj_name) : # def get_build_root_dir(fips_dir, proj_name): # def get_deploy_root_dir(fips_dir, proj_name): # def get_build_dir(fips_dir, proj_name, cfg) : # def get_deploy_dir(fips_dir, proj_name, cfg) : # def get_fips_dir(proj_dir, name): # def get_configs_dir(proj_dir): # def get_verbs_dir(proj_dir): # def get_generators_dir(proj_dir): # def get_toolchains_dir(proj_dir): # def get_giturl_from_url(url) : # def get_gitbranch_from_url(url) : # def get_project_name_from_url(url) : # def get_project_name_from_dir(proj_dir) : # def load_fips_yml(proj_dir) : # def lookup_target_cwd(proj_dir, target) : # def is_valid_project_dir(proj_dir) : # def ensure_valid_project_dir(proj_dir) : # def is_git_url(url) : # def confirm(question) : # def url_download_hook(count, block_size, total_size) : # def get_host_platform() : # def get_cfg_target_list(fips_dir, proj_dir, cfg): # def get_cfg_headersdirs_by_target(fips_dir, proj_dir, cfg): # def get_cfg_defines_by_target(fips_dir, proj_dir, cfg): # def get_num_cpucores(): # # Path: mod/config.py # def valid_build_tool(name) : # def get_default_config() : # def get_toolchain(fips_dir, proj_dir, cfg) : # def exists(pattern, proj_dirs) : # def get_config_dirs(fips_dir, proj_dir) : # def list(fips_dir, proj_dir, pattern) : # def load(fips_dir, proj_dir, pattern) : # def missing_build_tools(fips_dir, tool_name) : # def check_sdk(fips_dir, platform_name) : # def check_config_valid(fips_dir, proj_dir, cfg, print_errors=False) : # # Path: mod/project.py # def init(fips_dir, proj_name) : # def clone(fips_dir, url) : # def gen_project(fips_dir, proj_dir, cfg, force) : # def gen(fips_dir, proj_dir, cfg_name) : # def configure(fips_dir, proj_dir, cfg_name) : # def make_clean(fips_dir, proj_dir, cfg_name) : # def build(fips_dir, proj_dir, cfg_name, target=None, build_tool_args=None) : # def run(fips_dir, proj_dir, cfg_name, target_name, target_args, target_cwd) : # def clean(fips_dir, proj_dir, cfg_name) : # def get_target_list(fips_dir, proj_dir, cfg_name) : # # Path: mod/settings.py # def load(proj_dir) : # def save(proj_dir, settings) : # def get_default(key) : # def get(proj_dir, key) : # def set(proj_dir, key, value) : # def unset(proj_dir, key) : # def get_all_settings(proj_dir): . Output only the next line.
cfg_name = settings.get(proj_dir, 'config')
Predict the next line for this snippet: <|code_start|>"""implement the 'open' verb open open [config] """ #------------------------------------------------------------------------------- def run(fips_dir, proj_dir, args) : """run the 'open' verb (opens project in IDE)""" if not util.is_valid_project_dir(proj_dir) : <|code_end|> with the help of current file imports: import os import glob import subprocess from mod import log, util, settings, config, project from mod.tools import vscode, clion and context from other files: # Path: mod/log.py # RED = '\033[1;31m' # GREEN = '\033[1;32m' # YELLOW = '\033[1;33m' # BLUE = '\033[1;36m' # DEF = '\033[0;0m' # def error(msg, fatal=True) : # def warn(msg) : # def ok(item, status) : # def failed(item, status) : # def optional(item, status) : # def info(msg) : # def colored(color, msg) : # # Path: mod/util.py # def fix_path(path) : # def get_workspace_dir(fips_dir) : # def get_project_dir(fips_dir, proj_name) : # def get_build_root_dir(fips_dir, proj_name): # def get_deploy_root_dir(fips_dir, proj_name): # def get_build_dir(fips_dir, proj_name, cfg) : # def get_deploy_dir(fips_dir, proj_name, cfg) : # def get_fips_dir(proj_dir, name): # def get_configs_dir(proj_dir): # def get_verbs_dir(proj_dir): # def get_generators_dir(proj_dir): # def get_toolchains_dir(proj_dir): # def get_giturl_from_url(url) : # def get_gitbranch_from_url(url) : # def get_project_name_from_url(url) : # def get_project_name_from_dir(proj_dir) : # def load_fips_yml(proj_dir) : # def lookup_target_cwd(proj_dir, target) : # def is_valid_project_dir(proj_dir) : # def ensure_valid_project_dir(proj_dir) : # def is_git_url(url) : # def confirm(question) : # def url_download_hook(count, block_size, total_size) : # def get_host_platform() : # def get_cfg_target_list(fips_dir, proj_dir, cfg): # def get_cfg_headersdirs_by_target(fips_dir, proj_dir, cfg): # def get_cfg_defines_by_target(fips_dir, proj_dir, cfg): # def get_num_cpucores(): # # Path: mod/settings.py # def load(proj_dir) : # def save(proj_dir, settings) : # def get_default(key) : # def get(proj_dir, key) : # def set(proj_dir, key, value) : # def unset(proj_dir, key) : # def get_all_settings(proj_dir): # # Path: mod/config.py # def valid_build_tool(name) : # def get_default_config() : # def get_toolchain(fips_dir, proj_dir, cfg) : # def exists(pattern, proj_dirs) : # def get_config_dirs(fips_dir, proj_dir) : # def list(fips_dir, proj_dir, pattern) : # def load(fips_dir, proj_dir, pattern) : # def missing_build_tools(fips_dir, tool_name) : # def check_sdk(fips_dir, platform_name) : # def check_config_valid(fips_dir, proj_dir, cfg, print_errors=False) : # # Path: mod/project.py # def init(fips_dir, proj_name) : # def clone(fips_dir, url) : # def gen_project(fips_dir, proj_dir, cfg, force) : # def gen(fips_dir, proj_dir, cfg_name) : # def configure(fips_dir, proj_dir, cfg_name) : # def make_clean(fips_dir, proj_dir, cfg_name) : # def build(fips_dir, proj_dir, cfg_name, target=None, build_tool_args=None) : # def run(fips_dir, proj_dir, cfg_name, target_name, target_args, target_cwd) : # def clean(fips_dir, proj_dir, cfg_name) : # def get_target_list(fips_dir, proj_dir, cfg_name) : # # Path: mod/tools/vscode.py # def try_exists(exe_name): # def exe_name(): # def check_exists(fips_dir) : # def match(build_tool): # def run(proj_dir): # def read_cmake_targets(fips_dir, proj_dir, cfg, types): # def read_cmake_headerdirs(fips_dir, proj_dir, cfg): # def read_cmake_defines(fips_dir, proj_dir, cfg): # def problem_matcher(): # def get_cc_header_paths(): # def get_vs_header_paths(fips_dir, proj_dir, cfg): # def list_extensions() : # def write_tasks_json(fips_dir, proj_dir, vscode_dir, cfg): # def write_launch_json(fips_dir, proj_dir, vscode_dir, cfg, proj_settings): # def write_c_cpp_properties_json(fips_dir, proj_dir, impex, cfg): # def write_cmake_tools_settings(fips_dir, proj_dir, vscode_dir, cfg): # def write_code_workspace_file(fips_dir, proj_dir, impex, cfg): # def remove_vscode_tasks_launch_files(fips_dir, proj_dir, impex, cfg): # def write_workspace_settings(fips_dir, proj_dir, cfg, proj_settings): # def cleanup(fips_dir, proj_dir): # # Path: mod/tools/clion.py # def check_exists(fips_dir) : # def match(build_tool): # def run(proj_dir): # def write_clion_module_files(fips_dir, proj_dir, cfg): # def write_clion_workspace_file(fips_dir, proj_dir, cfg): # def write_workspace_settings(fips_dir, proj_dir, cfg): # def cleanup(fips_dir, proj_dir): , which may contain function names, class names, or code. Output only the next line.
log.error('must be run in a project directory')
Next line prediction: <|code_start|>"""implement the 'open' verb open open [config] """ #------------------------------------------------------------------------------- def run(fips_dir, proj_dir, args) : """run the 'open' verb (opens project in IDE)""" <|code_end|> . Use current file imports: (import os import glob import subprocess from mod import log, util, settings, config, project from mod.tools import vscode, clion) and context including class names, function names, or small code snippets from other files: # Path: mod/log.py # RED = '\033[1;31m' # GREEN = '\033[1;32m' # YELLOW = '\033[1;33m' # BLUE = '\033[1;36m' # DEF = '\033[0;0m' # def error(msg, fatal=True) : # def warn(msg) : # def ok(item, status) : # def failed(item, status) : # def optional(item, status) : # def info(msg) : # def colored(color, msg) : # # Path: mod/util.py # def fix_path(path) : # def get_workspace_dir(fips_dir) : # def get_project_dir(fips_dir, proj_name) : # def get_build_root_dir(fips_dir, proj_name): # def get_deploy_root_dir(fips_dir, proj_name): # def get_build_dir(fips_dir, proj_name, cfg) : # def get_deploy_dir(fips_dir, proj_name, cfg) : # def get_fips_dir(proj_dir, name): # def get_configs_dir(proj_dir): # def get_verbs_dir(proj_dir): # def get_generators_dir(proj_dir): # def get_toolchains_dir(proj_dir): # def get_giturl_from_url(url) : # def get_gitbranch_from_url(url) : # def get_project_name_from_url(url) : # def get_project_name_from_dir(proj_dir) : # def load_fips_yml(proj_dir) : # def lookup_target_cwd(proj_dir, target) : # def is_valid_project_dir(proj_dir) : # def ensure_valid_project_dir(proj_dir) : # def is_git_url(url) : # def confirm(question) : # def url_download_hook(count, block_size, total_size) : # def get_host_platform() : # def get_cfg_target_list(fips_dir, proj_dir, cfg): # def get_cfg_headersdirs_by_target(fips_dir, proj_dir, cfg): # def get_cfg_defines_by_target(fips_dir, proj_dir, cfg): # def get_num_cpucores(): # # Path: mod/settings.py # def load(proj_dir) : # def save(proj_dir, settings) : # def get_default(key) : # def get(proj_dir, key) : # def set(proj_dir, key, value) : # def unset(proj_dir, key) : # def get_all_settings(proj_dir): # # Path: mod/config.py # def valid_build_tool(name) : # def get_default_config() : # def get_toolchain(fips_dir, proj_dir, cfg) : # def exists(pattern, proj_dirs) : # def get_config_dirs(fips_dir, proj_dir) : # def list(fips_dir, proj_dir, pattern) : # def load(fips_dir, proj_dir, pattern) : # def missing_build_tools(fips_dir, tool_name) : # def check_sdk(fips_dir, platform_name) : # def check_config_valid(fips_dir, proj_dir, cfg, print_errors=False) : # # Path: mod/project.py # def init(fips_dir, proj_name) : # def clone(fips_dir, url) : # def gen_project(fips_dir, proj_dir, cfg, force) : # def gen(fips_dir, proj_dir, cfg_name) : # def configure(fips_dir, proj_dir, cfg_name) : # def make_clean(fips_dir, proj_dir, cfg_name) : # def build(fips_dir, proj_dir, cfg_name, target=None, build_tool_args=None) : # def run(fips_dir, proj_dir, cfg_name, target_name, target_args, target_cwd) : # def clean(fips_dir, proj_dir, cfg_name) : # def get_target_list(fips_dir, proj_dir, cfg_name) : # # Path: mod/tools/vscode.py # def try_exists(exe_name): # def exe_name(): # def check_exists(fips_dir) : # def match(build_tool): # def run(proj_dir): # def read_cmake_targets(fips_dir, proj_dir, cfg, types): # def read_cmake_headerdirs(fips_dir, proj_dir, cfg): # def read_cmake_defines(fips_dir, proj_dir, cfg): # def problem_matcher(): # def get_cc_header_paths(): # def get_vs_header_paths(fips_dir, proj_dir, cfg): # def list_extensions() : # def write_tasks_json(fips_dir, proj_dir, vscode_dir, cfg): # def write_launch_json(fips_dir, proj_dir, vscode_dir, cfg, proj_settings): # def write_c_cpp_properties_json(fips_dir, proj_dir, impex, cfg): # def write_cmake_tools_settings(fips_dir, proj_dir, vscode_dir, cfg): # def write_code_workspace_file(fips_dir, proj_dir, impex, cfg): # def remove_vscode_tasks_launch_files(fips_dir, proj_dir, impex, cfg): # def write_workspace_settings(fips_dir, proj_dir, cfg, proj_settings): # def cleanup(fips_dir, proj_dir): # # Path: mod/tools/clion.py # def check_exists(fips_dir) : # def match(build_tool): # def run(proj_dir): # def write_clion_module_files(fips_dir, proj_dir, cfg): # def write_clion_workspace_file(fips_dir, proj_dir, cfg): # def write_workspace_settings(fips_dir, proj_dir, cfg): # def cleanup(fips_dir, proj_dir): . Output only the next line.
if not util.is_valid_project_dir(proj_dir) :
Given the code snippet: <|code_start|>"""build fips project build build [config] """ #------------------------------------------------------------------------------- def run(fips_dir, proj_dir, args) : """build fips project""" if not util.is_valid_project_dir(proj_dir) : <|code_end|> , generate the next line using the imports in this file: from mod import log, util, project, settings and context (functions, classes, or occasionally code) from other files: # Path: mod/log.py # RED = '\033[1;31m' # GREEN = '\033[1;32m' # YELLOW = '\033[1;33m' # BLUE = '\033[1;36m' # DEF = '\033[0;0m' # def error(msg, fatal=True) : # def warn(msg) : # def ok(item, status) : # def failed(item, status) : # def optional(item, status) : # def info(msg) : # def colored(color, msg) : # # Path: mod/util.py # def fix_path(path) : # def get_workspace_dir(fips_dir) : # def get_project_dir(fips_dir, proj_name) : # def get_build_root_dir(fips_dir, proj_name): # def get_deploy_root_dir(fips_dir, proj_name): # def get_build_dir(fips_dir, proj_name, cfg) : # def get_deploy_dir(fips_dir, proj_name, cfg) : # def get_fips_dir(proj_dir, name): # def get_configs_dir(proj_dir): # def get_verbs_dir(proj_dir): # def get_generators_dir(proj_dir): # def get_toolchains_dir(proj_dir): # def get_giturl_from_url(url) : # def get_gitbranch_from_url(url) : # def get_project_name_from_url(url) : # def get_project_name_from_dir(proj_dir) : # def load_fips_yml(proj_dir) : # def lookup_target_cwd(proj_dir, target) : # def is_valid_project_dir(proj_dir) : # def ensure_valid_project_dir(proj_dir) : # def is_git_url(url) : # def confirm(question) : # def url_download_hook(count, block_size, total_size) : # def get_host_platform() : # def get_cfg_target_list(fips_dir, proj_dir, cfg): # def get_cfg_headersdirs_by_target(fips_dir, proj_dir, cfg): # def get_cfg_defines_by_target(fips_dir, proj_dir, cfg): # def get_num_cpucores(): # # Path: mod/project.py # def init(fips_dir, proj_name) : # def clone(fips_dir, url) : # def gen_project(fips_dir, proj_dir, cfg, force) : # def gen(fips_dir, proj_dir, cfg_name) : # def configure(fips_dir, proj_dir, cfg_name) : # def make_clean(fips_dir, proj_dir, cfg_name) : # def build(fips_dir, proj_dir, cfg_name, target=None, build_tool_args=None) : # def run(fips_dir, proj_dir, cfg_name, target_name, target_args, target_cwd) : # def clean(fips_dir, proj_dir, cfg_name) : # def get_target_list(fips_dir, proj_dir, cfg_name) : # # Path: mod/settings.py # def load(proj_dir) : # def save(proj_dir, settings) : # def get_default(key) : # def get(proj_dir, key) : # def set(proj_dir, key, value) : # def unset(proj_dir, key) : # def get_all_settings(proj_dir): . Output only the next line.
log.error('must be run in a project directory')
Predict the next line for this snippet: <|code_start|>"""build fips project build build [config] """ #------------------------------------------------------------------------------- def run(fips_dir, proj_dir, args) : """build fips project""" <|code_end|> with the help of current file imports: from mod import log, util, project, settings and context from other files: # Path: mod/log.py # RED = '\033[1;31m' # GREEN = '\033[1;32m' # YELLOW = '\033[1;33m' # BLUE = '\033[1;36m' # DEF = '\033[0;0m' # def error(msg, fatal=True) : # def warn(msg) : # def ok(item, status) : # def failed(item, status) : # def optional(item, status) : # def info(msg) : # def colored(color, msg) : # # Path: mod/util.py # def fix_path(path) : # def get_workspace_dir(fips_dir) : # def get_project_dir(fips_dir, proj_name) : # def get_build_root_dir(fips_dir, proj_name): # def get_deploy_root_dir(fips_dir, proj_name): # def get_build_dir(fips_dir, proj_name, cfg) : # def get_deploy_dir(fips_dir, proj_name, cfg) : # def get_fips_dir(proj_dir, name): # def get_configs_dir(proj_dir): # def get_verbs_dir(proj_dir): # def get_generators_dir(proj_dir): # def get_toolchains_dir(proj_dir): # def get_giturl_from_url(url) : # def get_gitbranch_from_url(url) : # def get_project_name_from_url(url) : # def get_project_name_from_dir(proj_dir) : # def load_fips_yml(proj_dir) : # def lookup_target_cwd(proj_dir, target) : # def is_valid_project_dir(proj_dir) : # def ensure_valid_project_dir(proj_dir) : # def is_git_url(url) : # def confirm(question) : # def url_download_hook(count, block_size, total_size) : # def get_host_platform() : # def get_cfg_target_list(fips_dir, proj_dir, cfg): # def get_cfg_headersdirs_by_target(fips_dir, proj_dir, cfg): # def get_cfg_defines_by_target(fips_dir, proj_dir, cfg): # def get_num_cpucores(): # # Path: mod/project.py # def init(fips_dir, proj_name) : # def clone(fips_dir, url) : # def gen_project(fips_dir, proj_dir, cfg, force) : # def gen(fips_dir, proj_dir, cfg_name) : # def configure(fips_dir, proj_dir, cfg_name) : # def make_clean(fips_dir, proj_dir, cfg_name) : # def build(fips_dir, proj_dir, cfg_name, target=None, build_tool_args=None) : # def run(fips_dir, proj_dir, cfg_name, target_name, target_args, target_cwd) : # def clean(fips_dir, proj_dir, cfg_name) : # def get_target_list(fips_dir, proj_dir, cfg_name) : # # Path: mod/settings.py # def load(proj_dir) : # def save(proj_dir, settings) : # def get_default(key) : # def get(proj_dir, key) : # def set(proj_dir, key, value) : # def unset(proj_dir, key) : # def get_all_settings(proj_dir): , which may contain function names, class names, or code. Output only the next line.
if not util.is_valid_project_dir(proj_dir) :
Here is a snippet: <|code_start|>"""build fips project build build [config] """ #------------------------------------------------------------------------------- def run(fips_dir, proj_dir, args) : """build fips project""" if not util.is_valid_project_dir(proj_dir) : log.error('must be run in a project directory') cfg_name = None build_tool_args = None if '--' in args: idx = args.index('--') build_tool_args = args[(idx + 1):] args = args[:idx] if len(args) > 0 : cfg_name = args[0] if not cfg_name : cfg_name = settings.get(proj_dir, 'config') <|code_end|> . Write the next line using the current file imports: from mod import log, util, project, settings and context from other files: # Path: mod/log.py # RED = '\033[1;31m' # GREEN = '\033[1;32m' # YELLOW = '\033[1;33m' # BLUE = '\033[1;36m' # DEF = '\033[0;0m' # def error(msg, fatal=True) : # def warn(msg) : # def ok(item, status) : # def failed(item, status) : # def optional(item, status) : # def info(msg) : # def colored(color, msg) : # # Path: mod/util.py # def fix_path(path) : # def get_workspace_dir(fips_dir) : # def get_project_dir(fips_dir, proj_name) : # def get_build_root_dir(fips_dir, proj_name): # def get_deploy_root_dir(fips_dir, proj_name): # def get_build_dir(fips_dir, proj_name, cfg) : # def get_deploy_dir(fips_dir, proj_name, cfg) : # def get_fips_dir(proj_dir, name): # def get_configs_dir(proj_dir): # def get_verbs_dir(proj_dir): # def get_generators_dir(proj_dir): # def get_toolchains_dir(proj_dir): # def get_giturl_from_url(url) : # def get_gitbranch_from_url(url) : # def get_project_name_from_url(url) : # def get_project_name_from_dir(proj_dir) : # def load_fips_yml(proj_dir) : # def lookup_target_cwd(proj_dir, target) : # def is_valid_project_dir(proj_dir) : # def ensure_valid_project_dir(proj_dir) : # def is_git_url(url) : # def confirm(question) : # def url_download_hook(count, block_size, total_size) : # def get_host_platform() : # def get_cfg_target_list(fips_dir, proj_dir, cfg): # def get_cfg_headersdirs_by_target(fips_dir, proj_dir, cfg): # def get_cfg_defines_by_target(fips_dir, proj_dir, cfg): # def get_num_cpucores(): # # Path: mod/project.py # def init(fips_dir, proj_name) : # def clone(fips_dir, url) : # def gen_project(fips_dir, proj_dir, cfg, force) : # def gen(fips_dir, proj_dir, cfg_name) : # def configure(fips_dir, proj_dir, cfg_name) : # def make_clean(fips_dir, proj_dir, cfg_name) : # def build(fips_dir, proj_dir, cfg_name, target=None, build_tool_args=None) : # def run(fips_dir, proj_dir, cfg_name, target_name, target_args, target_cwd) : # def clean(fips_dir, proj_dir, cfg_name) : # def get_target_list(fips_dir, proj_dir, cfg_name) : # # Path: mod/settings.py # def load(proj_dir) : # def save(proj_dir, settings) : # def get_default(key) : # def get(proj_dir, key) : # def set(proj_dir, key, value) : # def unset(proj_dir, key) : # def get_all_settings(proj_dir): , which may include functions, classes, or code. Output only the next line.
project.build(fips_dir, proj_dir, cfg_name, None, build_tool_args)
Next line prediction: <|code_start|>"""build fips project build build [config] """ #------------------------------------------------------------------------------- def run(fips_dir, proj_dir, args) : """build fips project""" if not util.is_valid_project_dir(proj_dir) : log.error('must be run in a project directory') cfg_name = None build_tool_args = None if '--' in args: idx = args.index('--') build_tool_args = args[(idx + 1):] args = args[:idx] if len(args) > 0 : cfg_name = args[0] if not cfg_name : <|code_end|> . Use current file imports: (from mod import log, util, project, settings) and context including class names, function names, or small code snippets from other files: # Path: mod/log.py # RED = '\033[1;31m' # GREEN = '\033[1;32m' # YELLOW = '\033[1;33m' # BLUE = '\033[1;36m' # DEF = '\033[0;0m' # def error(msg, fatal=True) : # def warn(msg) : # def ok(item, status) : # def failed(item, status) : # def optional(item, status) : # def info(msg) : # def colored(color, msg) : # # Path: mod/util.py # def fix_path(path) : # def get_workspace_dir(fips_dir) : # def get_project_dir(fips_dir, proj_name) : # def get_build_root_dir(fips_dir, proj_name): # def get_deploy_root_dir(fips_dir, proj_name): # def get_build_dir(fips_dir, proj_name, cfg) : # def get_deploy_dir(fips_dir, proj_name, cfg) : # def get_fips_dir(proj_dir, name): # def get_configs_dir(proj_dir): # def get_verbs_dir(proj_dir): # def get_generators_dir(proj_dir): # def get_toolchains_dir(proj_dir): # def get_giturl_from_url(url) : # def get_gitbranch_from_url(url) : # def get_project_name_from_url(url) : # def get_project_name_from_dir(proj_dir) : # def load_fips_yml(proj_dir) : # def lookup_target_cwd(proj_dir, target) : # def is_valid_project_dir(proj_dir) : # def ensure_valid_project_dir(proj_dir) : # def is_git_url(url) : # def confirm(question) : # def url_download_hook(count, block_size, total_size) : # def get_host_platform() : # def get_cfg_target_list(fips_dir, proj_dir, cfg): # def get_cfg_headersdirs_by_target(fips_dir, proj_dir, cfg): # def get_cfg_defines_by_target(fips_dir, proj_dir, cfg): # def get_num_cpucores(): # # Path: mod/project.py # def init(fips_dir, proj_name) : # def clone(fips_dir, url) : # def gen_project(fips_dir, proj_dir, cfg, force) : # def gen(fips_dir, proj_dir, cfg_name) : # def configure(fips_dir, proj_dir, cfg_name) : # def make_clean(fips_dir, proj_dir, cfg_name) : # def build(fips_dir, proj_dir, cfg_name, target=None, build_tool_args=None) : # def run(fips_dir, proj_dir, cfg_name, target_name, target_args, target_cwd) : # def clean(fips_dir, proj_dir, cfg_name) : # def get_target_list(fips_dir, proj_dir, cfg_name) : # # Path: mod/settings.py # def load(proj_dir) : # def save(proj_dir, settings) : # def get_default(key) : # def get(proj_dir, key) : # def set(proj_dir, key, value) : # def unset(proj_dir, key) : # def get_all_settings(proj_dir): . Output only the next line.
cfg_name = settings.get(proj_dir, 'config')
Based on the snippet: <|code_start|>"""wrapper for cmake tool""" name = 'cmake' platforms = ['linux', 'osx', 'win'] optional = False not_found = 'please install cmake 2.8 or newer' #------------------------------------------------------------------------------ def check_exists(fips_dir, major=2, minor=8) : """test if cmake is in the path and has the required version :returns: True if cmake found and is the required version """ try: out = subprocess.check_output(['cmake', '--version']).decode("utf-8") ver = out.split()[2].split('.') if int(ver[0]) > major or (int(ver[0]) == major and int(ver[1]) >= minor): return True else : <|code_end|> , predict the immediate next line with the help of imports: import subprocess from mod import log and context (classes, functions, sometimes code) from other files: # Path: mod/log.py # RED = '\033[1;31m' # GREEN = '\033[1;32m' # YELLOW = '\033[1;33m' # BLUE = '\033[1;36m' # DEF = '\033[0;0m' # def error(msg, fatal=True) : # def warn(msg) : # def ok(item, status) : # def failed(item, status) : # def optional(item, status) : # def info(msg) : # def colored(color, msg) : . Output only the next line.
log.info('{}NOTE{}: cmake must be at least version {}.{} (found: {}.{}.{})'.format(
Given the code snippet: <|code_start|>"""set a default config or target set config [config-name] set target [target-name] """ #------------------------------------------------------------------------------- def run(fips_dir, proj_dir, args) : """run the 'set' verb""" # FIXME: thos shouldn't be as hardwired as it is, see help() function if len(args) > 0 : noun = args[0] if noun == 'config' : if len(args) > 1 : cfg_name = args[1] settings.set(proj_dir, 'config', cfg_name) else : <|code_end|> , generate the next line using the imports in this file: from mod import log, util, settings and context (functions, classes, or occasionally code) from other files: # Path: mod/log.py # RED = '\033[1;31m' # GREEN = '\033[1;32m' # YELLOW = '\033[1;33m' # BLUE = '\033[1;36m' # DEF = '\033[0;0m' # def error(msg, fatal=True) : # def warn(msg) : # def ok(item, status) : # def failed(item, status) : # def optional(item, status) : # def info(msg) : # def colored(color, msg) : # # Path: mod/util.py # def fix_path(path) : # def get_workspace_dir(fips_dir) : # def get_project_dir(fips_dir, proj_name) : # def get_build_root_dir(fips_dir, proj_name): # def get_deploy_root_dir(fips_dir, proj_name): # def get_build_dir(fips_dir, proj_name, cfg) : # def get_deploy_dir(fips_dir, proj_name, cfg) : # def get_fips_dir(proj_dir, name): # def get_configs_dir(proj_dir): # def get_verbs_dir(proj_dir): # def get_generators_dir(proj_dir): # def get_toolchains_dir(proj_dir): # def get_giturl_from_url(url) : # def get_gitbranch_from_url(url) : # def get_project_name_from_url(url) : # def get_project_name_from_dir(proj_dir) : # def load_fips_yml(proj_dir) : # def lookup_target_cwd(proj_dir, target) : # def is_valid_project_dir(proj_dir) : # def ensure_valid_project_dir(proj_dir) : # def is_git_url(url) : # def confirm(question) : # def url_download_hook(count, block_size, total_size) : # def get_host_platform() : # def get_cfg_target_list(fips_dir, proj_dir, cfg): # def get_cfg_headersdirs_by_target(fips_dir, proj_dir, cfg): # def get_cfg_defines_by_target(fips_dir, proj_dir, cfg): # def get_num_cpucores(): # # Path: mod/settings.py # def load(proj_dir) : # def save(proj_dir, settings) : # def get_default(key) : # def get(proj_dir, key) : # def set(proj_dir, key, value) : # def unset(proj_dir, key) : # def get_all_settings(proj_dir): . Output only the next line.
log.error('expected config name')
Predict the next line for this snippet: <|code_start|>"""set a default config or target set config [config-name] set target [target-name] """ #------------------------------------------------------------------------------- def run(fips_dir, proj_dir, args) : """run the 'set' verb""" # FIXME: thos shouldn't be as hardwired as it is, see help() function if len(args) > 0 : noun = args[0] if noun == 'config' : if len(args) > 1 : cfg_name = args[1] <|code_end|> with the help of current file imports: from mod import log, util, settings and context from other files: # Path: mod/log.py # RED = '\033[1;31m' # GREEN = '\033[1;32m' # YELLOW = '\033[1;33m' # BLUE = '\033[1;36m' # DEF = '\033[0;0m' # def error(msg, fatal=True) : # def warn(msg) : # def ok(item, status) : # def failed(item, status) : # def optional(item, status) : # def info(msg) : # def colored(color, msg) : # # Path: mod/util.py # def fix_path(path) : # def get_workspace_dir(fips_dir) : # def get_project_dir(fips_dir, proj_name) : # def get_build_root_dir(fips_dir, proj_name): # def get_deploy_root_dir(fips_dir, proj_name): # def get_build_dir(fips_dir, proj_name, cfg) : # def get_deploy_dir(fips_dir, proj_name, cfg) : # def get_fips_dir(proj_dir, name): # def get_configs_dir(proj_dir): # def get_verbs_dir(proj_dir): # def get_generators_dir(proj_dir): # def get_toolchains_dir(proj_dir): # def get_giturl_from_url(url) : # def get_gitbranch_from_url(url) : # def get_project_name_from_url(url) : # def get_project_name_from_dir(proj_dir) : # def load_fips_yml(proj_dir) : # def lookup_target_cwd(proj_dir, target) : # def is_valid_project_dir(proj_dir) : # def ensure_valid_project_dir(proj_dir) : # def is_git_url(url) : # def confirm(question) : # def url_download_hook(count, block_size, total_size) : # def get_host_platform() : # def get_cfg_target_list(fips_dir, proj_dir, cfg): # def get_cfg_headersdirs_by_target(fips_dir, proj_dir, cfg): # def get_cfg_defines_by_target(fips_dir, proj_dir, cfg): # def get_num_cpucores(): # # Path: mod/settings.py # def load(proj_dir) : # def save(proj_dir, settings) : # def get_default(key) : # def get(proj_dir, key) : # def set(proj_dir, key, value) : # def unset(proj_dir, key) : # def get_all_settings(proj_dir): , which may contain function names, class names, or code. Output only the next line.
settings.set(proj_dir, 'config', cfg_name)
Based on the snippet: <|code_start|> subprocess.check_output([exe_name, '--version']) return True except (OSError, subprocess.CalledProcessError): return False #------------------------------------------------------------------------------ def exe_name(): if try_exists('code'): return 'code' else: # open source version on RaspberryPi return 'code-oss' #------------------------------------------------------------------------------ def check_exists(fips_dir) : """test if 'code' is in the path :returns: True if code is in the path """ if exe_name() != 'code': return try_exists('code-oss') else: return True #------------------------------------------------------------------------------ def match(build_tool): return build_tool in ['vscode_cmake', 'vscode_ninja'] #------------------------------------------------------------------------------ def run(proj_dir): exe = exe_name() <|code_end|> , predict the immediate next line with the help of imports: import platform,subprocess, os, yaml, json, inspect, tempfile, glob, shutil from mod import util, log, verb, dep from mod.tools import cmake and context (classes, functions, sometimes code) from other files: # Path: mod/util.py # def fix_path(path) : # def get_workspace_dir(fips_dir) : # def get_project_dir(fips_dir, proj_name) : # def get_build_root_dir(fips_dir, proj_name): # def get_deploy_root_dir(fips_dir, proj_name): # def get_build_dir(fips_dir, proj_name, cfg) : # def get_deploy_dir(fips_dir, proj_name, cfg) : # def get_fips_dir(proj_dir, name): # def get_configs_dir(proj_dir): # def get_verbs_dir(proj_dir): # def get_generators_dir(proj_dir): # def get_toolchains_dir(proj_dir): # def get_giturl_from_url(url) : # def get_gitbranch_from_url(url) : # def get_project_name_from_url(url) : # def get_project_name_from_dir(proj_dir) : # def load_fips_yml(proj_dir) : # def lookup_target_cwd(proj_dir, target) : # def is_valid_project_dir(proj_dir) : # def ensure_valid_project_dir(proj_dir) : # def is_git_url(url) : # def confirm(question) : # def url_download_hook(count, block_size, total_size) : # def get_host_platform() : # def get_cfg_target_list(fips_dir, proj_dir, cfg): # def get_cfg_headersdirs_by_target(fips_dir, proj_dir, cfg): # def get_cfg_defines_by_target(fips_dir, proj_dir, cfg): # def get_num_cpucores(): # # Path: mod/log.py # RED = '\033[1;31m' # GREEN = '\033[1;32m' # YELLOW = '\033[1;33m' # BLUE = '\033[1;36m' # DEF = '\033[0;0m' # def error(msg, fatal=True) : # def warn(msg) : # def ok(item, status) : # def failed(item, status) : # def optional(item, status) : # def info(msg) : # def colored(color, msg) : # # Path: mod/verb.py # def import_verbs_from(proj_name, proj_dir, verb_dir) : # def import_verbs(fips_dir, proj_dir) : # # Path: mod/dep.py # def get_imports(fips_dir, proj_dir) : # def get_exports(proj_dir) : # def get_policy(proj_dir, policy) : # def _rec_get_all_imports_exports(fips_dir, proj_dir, result) : # def get_all_imports_exports(fips_dir, proj_dir) : # def _rec_fetch_imports(fips_dir, proj_dir, handled) : # def fetch_imports(fips_dir, proj_dir) : # def gather_imports(fips_dir, proj_dir) : # def write_imports(fips_dir, proj_dir, cfg_name, imported) : # def gather_and_write_imports(fips_dir, proj_dir, cfg_name) : # def check_imports(fips_dir, proj_dir) : # def check_local_changes(fips_dir, proj_dir) : # def _rec_update_imports(fips_dir, proj_dir, handled) : # def update_imports(fips_dir, proj_dir): # # Path: mod/tools/cmake.py # def check_exists(fips_dir, major=2, minor=8) : # def run_gen(cfg, fips_dir, project_dir, build_dir, local_build, toolchain_path, defines) : # def run_build(fips_dir, target, build_type, build_dir, num_jobs=1, args=None) : # def run_clean(fips_dir, build_dir) : . Output only the next line.
proj_name = util.get_project_name_from_dir(proj_dir)
Predict the next line for this snippet: <|code_start|> #------------------------------------------------------------------------------ def exe_name(): if try_exists('code'): return 'code' else: # open source version on RaspberryPi return 'code-oss' #------------------------------------------------------------------------------ def check_exists(fips_dir) : """test if 'code' is in the path :returns: True if code is in the path """ if exe_name() != 'code': return try_exists('code-oss') else: return True #------------------------------------------------------------------------------ def match(build_tool): return build_tool in ['vscode_cmake', 'vscode_ninja'] #------------------------------------------------------------------------------ def run(proj_dir): exe = exe_name() proj_name = util.get_project_name_from_dir(proj_dir) try: subprocess.call('{} .vscode/{}.code-workspace'.format(exe, proj_name), cwd=proj_dir, shell=True) except OSError: <|code_end|> with the help of current file imports: import platform,subprocess, os, yaml, json, inspect, tempfile, glob, shutil from mod import util, log, verb, dep from mod.tools import cmake and context from other files: # Path: mod/util.py # def fix_path(path) : # def get_workspace_dir(fips_dir) : # def get_project_dir(fips_dir, proj_name) : # def get_build_root_dir(fips_dir, proj_name): # def get_deploy_root_dir(fips_dir, proj_name): # def get_build_dir(fips_dir, proj_name, cfg) : # def get_deploy_dir(fips_dir, proj_name, cfg) : # def get_fips_dir(proj_dir, name): # def get_configs_dir(proj_dir): # def get_verbs_dir(proj_dir): # def get_generators_dir(proj_dir): # def get_toolchains_dir(proj_dir): # def get_giturl_from_url(url) : # def get_gitbranch_from_url(url) : # def get_project_name_from_url(url) : # def get_project_name_from_dir(proj_dir) : # def load_fips_yml(proj_dir) : # def lookup_target_cwd(proj_dir, target) : # def is_valid_project_dir(proj_dir) : # def ensure_valid_project_dir(proj_dir) : # def is_git_url(url) : # def confirm(question) : # def url_download_hook(count, block_size, total_size) : # def get_host_platform() : # def get_cfg_target_list(fips_dir, proj_dir, cfg): # def get_cfg_headersdirs_by_target(fips_dir, proj_dir, cfg): # def get_cfg_defines_by_target(fips_dir, proj_dir, cfg): # def get_num_cpucores(): # # Path: mod/log.py # RED = '\033[1;31m' # GREEN = '\033[1;32m' # YELLOW = '\033[1;33m' # BLUE = '\033[1;36m' # DEF = '\033[0;0m' # def error(msg, fatal=True) : # def warn(msg) : # def ok(item, status) : # def failed(item, status) : # def optional(item, status) : # def info(msg) : # def colored(color, msg) : # # Path: mod/verb.py # def import_verbs_from(proj_name, proj_dir, verb_dir) : # def import_verbs(fips_dir, proj_dir) : # # Path: mod/dep.py # def get_imports(fips_dir, proj_dir) : # def get_exports(proj_dir) : # def get_policy(proj_dir, policy) : # def _rec_get_all_imports_exports(fips_dir, proj_dir, result) : # def get_all_imports_exports(fips_dir, proj_dir) : # def _rec_fetch_imports(fips_dir, proj_dir, handled) : # def fetch_imports(fips_dir, proj_dir) : # def gather_imports(fips_dir, proj_dir) : # def write_imports(fips_dir, proj_dir, cfg_name, imported) : # def gather_and_write_imports(fips_dir, proj_dir, cfg_name) : # def check_imports(fips_dir, proj_dir) : # def check_local_changes(fips_dir, proj_dir) : # def _rec_update_imports(fips_dir, proj_dir, handled) : # def update_imports(fips_dir, proj_dir): # # Path: mod/tools/cmake.py # def check_exists(fips_dir, major=2, minor=8) : # def run_gen(cfg, fips_dir, project_dir, build_dir, local_build, toolchain_path, defines) : # def run_build(fips_dir, target, build_type, build_dir, num_jobs=1, args=None) : # def run_clean(fips_dir, build_dir) : , which may contain function names, class names, or code. Output only the next line.
log.error("Failed to run Visual Studio Code as '{}'".format(exe))