Instruction
stringlengths
362
7.83k
output_code
stringlengths
1
945
Predict the next line for this snippet: <|code_start|>''' NFI -- Silensec's Nyuki Forensics Investigator Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. Juma Fredrick (j.fredrick[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' <|code_end|> with the help of current file imports: from IApp import IApp, KnownTable, DataTypes import ConvertUtils and context from other files: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 , which may contain function names, class names, or code. Output only the next line.
class com_google_android_feedback(IApp):
Given snippet: <|code_start|>''' NFI -- Silensec's Nyuki Forensics Investigator Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. Juma Fredrick (j.fredrick[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' class com_google_android_feedback(IApp): name = "com.google.android.feedback" cname = "Google Android Feedback" databases = { "webviewCookiesChromium.db": [ <|code_end|> , continue by predicting the next line. Consider current file imports: from IApp import IApp, KnownTable, DataTypes import ConvertUtils and context: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 which might include code, classes, or functions. Output only the next line.
KnownTable("cookies", None,
Using the snippet: <|code_start|>Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. Juma Fredrick (j.fredrick[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' class com_google_android_feedback(IApp): name = "com.google.android.feedback" cname = "Google Android Feedback" databases = { "webviewCookiesChromium.db": [ KnownTable("cookies", None, {"creation_utc":ConvertUtils.WebkitToUnix, "expires_utc":ConvertUtils.WebkitToUnix, "last_access_utc":ConvertUtils.WebkitToUnix }, <|code_end|> , determine the next line of code. You have imports: from IApp import IApp, KnownTable, DataTypes import ConvertUtils and context (class names, function names, or code) available: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 . Output only the next line.
{"creation_utc":DataTypes.DATE,
Here is a snippet: <|code_start|> CATALOG_APPS : { "name": "Apps", "display": True, "url": "/apps", "icon": "fa-archive" }, CATALOG_NETWORKING : { "name": "Networking", "display": True, "url": "/devnet", "icon": "fa-globe" }, CATALOG_LOGS : { "name": "Device Logs", "display": True, "url": "/logs", "icon": "fa-file" }, CATALOG_TIMELINE : { "name": "Timeline", "display": False, "url": "/timeline", "icon": "fa-clock-o" }, CATALOG_COMMS : { "name": "Communications", "display":True, "url": "/comms", "icon":"fa-comments-o" } } def __init__(self, lookup, case, settings): '@type lookup: mako.lookup.TemplateLookup' self.lookup = lookup self.case = case self.settings = settings return def set_templatelookup(self, lookup): '@type lookup: mako.lookup.TemplateLookup' self.lookup = lookup def get_menuentry_list(self, store, case_id): menu = [] for cat_id, catalog in self.catalogs_info.iteritems(): if catalog['display'] == False: continue store_catalog = store.get_misccatalog(cat_id) if len(store_catalog.sections) != 0: <|code_end|> . Write the next line using the current file imports: from IMainModule import MenuEntry, IMainModule import cherrypy and context from other files: # Path: IMainModule.py # class MenuEntry(object): # name = "N/A" # icon = None # link = "#" # content = [] # def __init__(self, name, link, icon=None, content=None ): # self.name = name # self.icon = icon # self.link = link # if content == None: # self.content = [] # else: # self.content = content # # #Overload me # def get_menuentry_list(self,store): # return [] # # class IMainModule(object): # def __init__(self, params): # ''' # Constructor # ''' , which may include functions, classes, or code. Output only the next line.
entry = MenuEntry(catalog['name'], "#", catalog['icon'] )
Here is a snippet: <|code_start|>''' NFI -- Silensec's Nyuki Forensics Investigator Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' <|code_end|> . Write the next line using the current file imports: from IMainModule import MenuEntry, IMainModule import cherrypy and context from other files: # Path: IMainModule.py # class MenuEntry(object): # name = "N/A" # icon = None # link = "#" # content = [] # def __init__(self, name, link, icon=None, content=None ): # self.name = name # self.icon = icon # self.link = link # if content == None: # self.content = [] # else: # self.content = content # # #Overload me # def get_menuentry_list(self,store): # return [] # # class IMainModule(object): # def __init__(self, params): # ''' # Constructor # ''' , which may include functions, classes, or code. Output only the next line.
class Catalog(IMainModule):
Predict the next line for this snippet: <|code_start|>''' NFI -- Silensec's Nyuki Forensics Investigator Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' #XXX this module is incomplete <|code_end|> with the help of current file imports: from IApp import IApp, KnownTable, DataTypes import ConvertUtils and context from other files: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 , which may contain function names, class names, or code. Output only the next line.
class com_linkedin_android(IApp):
Predict the next line for this snippet: <|code_start|>''' NFI -- Silensec's Nyuki Forensics Investigator Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' #XXX this module is incomplete class com_linkedin_android(IApp): name = "com.linkedin.android" cname = "LinkedIn" databases = { "linkedin.db": [ <|code_end|> with the help of current file imports: from IApp import IApp, KnownTable, DataTypes import ConvertUtils and context from other files: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 , which may contain function names, class names, or code. Output only the next line.
KnownTable("messages", None,
Given the following code snippet before the placeholder: <|code_start|>''' NFI -- Silensec's Nyuki Forensics Investigator Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' #XXX this module is incomplete class com_linkedin_android(IApp): name = "com.linkedin.android" cname = "LinkedIn" databases = { "linkedin.db": [ KnownTable("messages", None, {"timestamp":ConvertUtils.JsToUnix}, <|code_end|> , predict the next line using imports from the current file: from IApp import IApp, KnownTable, DataTypes import ConvertUtils and context including class names, function names, and sometimes code from other files: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 . Output only the next line.
{"timestamp":DataTypes.DATE}),
Based on the snippet: <|code_start|>''' NFI -- Silensec's Nyuki Forensics Investigator Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. Juma Fredrick (j.fredrick[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' <|code_end|> , predict the immediate next line with the help of imports: from IApp import IApp, KnownTable, DataTypes import ConvertUtils and context (classes, functions, sometimes code) from other files: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 . Output only the next line.
class com_android_email(IApp):
Continue the code snippet: <|code_start|>''' NFI -- Silensec's Nyuki Forensics Investigator Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. Juma Fredrick (j.fredrick[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' class com_android_email(IApp): name = "com.android.email" cname = "Android Email" databases = { "EmailProviderBackup.db": [ <|code_end|> . Use current file imports: from IApp import IApp, KnownTable, DataTypes import ConvertUtils and context (classes, functions, or code) from other files: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 . Output only the next line.
KnownTable("Mailbox", None,
Given the code snippet: <|code_start|>Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. Juma Fredrick (j.fredrick[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' class com_android_email(IApp): name = "com.android.email" cname = "Android Email" databases = { "EmailProviderBackup.db": [ KnownTable("Mailbox", None, {"syncTime":ConvertUtils.JsToUnix, "lastTouchedTime":ConvertUtils.JsToUnix}, <|code_end|> , generate the next line using the imports in this file: from IApp import IApp, KnownTable, DataTypes import ConvertUtils and context (functions, classes, or occasionally code) from other files: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 . Output only the next line.
{"syncTime":DataTypes.DATE, "lastTouchedTime":DataTypes.DATE}),
Using the snippet: <|code_start|>''' NFI -- Silensec's Nyuki Forensics Investigator Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' <|code_end|> , determine the next line of code. You have imports: from IApp import IApp, KnownTable, DataTypes import ConvertUtils and context (class names, function names, or code) available: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 . Output only the next line.
class com_android_providers_contacts(IApp):
Using the snippet: <|code_start|>''' NFI -- Silensec's Nyuki Forensics Investigator Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' class com_android_providers_contacts(IApp): name = "com.android.providers.contacts" cname = "Contacts Provider" databases = { "contacts2.db": [ <|code_end|> , determine the next line of code. You have imports: from IApp import IApp, KnownTable, DataTypes import ConvertUtils and context (class names, function names, or code) available: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 . Output only the next line.
KnownTable("_sync_state", None, None, {"data": DataTypes.DATA}),
Continue the code snippet: <|code_start|>''' NFI -- Silensec's Nyuki Forensics Investigator Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' class com_android_providers_contacts(IApp): name = "com.android.providers.contacts" cname = "Contacts Provider" databases = { "contacts2.db": [ <|code_end|> . Use current file imports: from IApp import IApp, KnownTable, DataTypes import ConvertUtils and context (classes, functions, or code) from other files: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 . Output only the next line.
KnownTable("_sync_state", None, None, {"data": DataTypes.DATA}),
Based on the snippet: <|code_start|>''' NFI -- Silensec's Nyuki Forensics Investigator Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' store_types = { <|code_end|> , predict the immediate next line with the help of imports: import ExtractStore, SQLite3Initializer import xml.etree.ElementTree as ET import re,struct, itertools import StringIO, sqlite3, tempfile, shutil,os from IMiscSource import FieldType, ReadTypeXML, BinaryRead, BinaryClass and context (classes, functions, sometimes code) from other files: # Path: IMiscSource.py # class FieldType(object): # TYPE_STR = 1 # TYPE_INT = 2 # TYPE_DATA = 3 # #XML TYPE_CONTAINER searches for children in given element # TYPE_CONTAINER = 4 # #XML TYPE_ARRAY searches for all nodes in given xml doc # TYPE_ARRAY = 5 # TYPE_DATE = 6 # # class ReadTypeXML(object): # READ_TEXT = 0, # READ_ATTR = 1 # # class BinaryRead(object): # ''' # The BinaryRead field designates how many bytes will be consumed to read this # field. Eg, "how big this field is". # - BYTE, consume 1 byte value # - SHORT, consume 2 byte value # - INTEGER, consume 4 byte value # - ASCII_STRING, consume ANSI/UTF8 string until null byte is reached # - UTF16_STRING, consume UTF-16 string until "null byte" is reached # - EOF, consume until end of file # # **Note:** # 1. Providing a string value to this field will attempt to read the # value of a previously parsed variable given a "field_name" attribute # equal to that string. Note that the given field must be an integral # value. # 2. Providing a function to this field will call that function, providing # the dictionary of currently passed variable "field_name"s and # values as argument. # The function must return an integer value signifying how many bytes # to consume. # 3. Providing a number greater than zero specifies the exact number of # bytes to consume for this field. # ''' # BYTE = -1 # SHORT = -2 # INTEGER = -3 # ASCII_STRING = -4 # UTF16_STRING = -5 # EOF = -6 # # class BinaryClass(object): # ''' # The BinaryClass object tells the parser what kind of value it should expect # in this field: # - PRIMITIVE, is for primitive types such as byte, short, int values # - ENUMERATION, this value is an enum. If ENUM then the "converter" value # should contain the dictionary which translates # integer values into strings. For example consider: # C code: # typedef enum VAL = { # FIRST_ENUM=1, # SECOND_ENUM # } # # Enum dictionary for this field: # enumdict = { 1: "FIRST_ENUM", 2: "SECOND_ENUM" } # - FLAG_BITWISE, similar to enum but this is for flag fields. The # "converter" field must contain a similar dictionary with # flag values that will be bitwise-compared to the entry # to determine which flags are on or off. # - FLAG_NUMERICAL, similar to FLAG_BITWISE but the "converter" field # contains actual numbers that are going to be compared # directly to the value of the field. # - CONSUME, simply consume this field and don't populate it within the # store. # - ANSI_STRING, specify that this is an ANSI string, the length can be # given at the BinaryRead field. # - UNICODE_STRING, specify that this is a unicode string, it's length # can be given at the BinaryRead field. # # The following haven't been implemented yet # - DECISION_VALUE, **NOT/MIGHT NOT BE IMPLEMENTED** # This value represents fields that "decide" what the # next field would be. It would work a bit like the # container=[] of xml and regex fields but at the # moment I see no reason why this could be used. # Please prove me wrong and it shall be implemented # promptly. # - POINTER_ABSOLUTE, that this field is a pointer(forwarder) to another # field that contains the offset to that field from # the beginning of the file # - POINTER_RELATIVE, same as above but pointer is relative offset from # current location # ''' # PRIMITIVE = 1 # POINTER_ABSOLUTE = 2 # POINTER_RELATIVE = 3 # ENUMERATION = 4 # FLAG_BITWISE = 5 # FLAG_NUMERICAL = 6 # CONSUME = 7 # ASCII_STRING = 8 # UTF8 = 9 # UTF16 = 10 # DATE = 11 # DECISION_VALUE = 12 . Output only the next line.
FieldType.TYPE_DATE: ExtractStore.TYPE_DATE,
Predict the next line for this snippet: <|code_start|> #item = ExtractStore.MiscItem(item_type=ExtractStore.TYPE_MULTI) for child in node.getchildren(): imult = _parse_xml_knownfields( known_field.contents, child, print_queue ) if len(imult) == 0: continue child_item = ExtractStore.MiscItem( item_type=ExtractStore.TYPE_MULTI, item_contents=imult ) #item.add_item( child_item ) items.append( child_item ) #items.append(item) elif known_field.fieldtype == FieldType.TYPE_ARRAY: if len(known_field.contents) == 0: continue if type(known_field.xml_path) != list: xpaths = [known_field.xml_path] else: xpaths = known_field.xml_path for xpath in xpaths: nodes = root.findall( xpath ) #item = ExtractStore.MiscItem(item_type=ExtractStore.TYPE_MULTI) for node in nodes: imult = _parse_xml_knownfields( known_field.contents, node, print_queue ) child_item = ExtractStore.MiscItem( item_type=ExtractStore.TYPE_MULTI, item_contents=imult ) #item.add_item( child_item ) items.append( child_item ) #items.append(item) else: <|code_end|> with the help of current file imports: import ExtractStore, SQLite3Initializer import xml.etree.ElementTree as ET import re,struct, itertools import StringIO, sqlite3, tempfile, shutil,os from IMiscSource import FieldType, ReadTypeXML, BinaryRead, BinaryClass and context from other files: # Path: IMiscSource.py # class FieldType(object): # TYPE_STR = 1 # TYPE_INT = 2 # TYPE_DATA = 3 # #XML TYPE_CONTAINER searches for children in given element # TYPE_CONTAINER = 4 # #XML TYPE_ARRAY searches for all nodes in given xml doc # TYPE_ARRAY = 5 # TYPE_DATE = 6 # # class ReadTypeXML(object): # READ_TEXT = 0, # READ_ATTR = 1 # # class BinaryRead(object): # ''' # The BinaryRead field designates how many bytes will be consumed to read this # field. Eg, "how big this field is". # - BYTE, consume 1 byte value # - SHORT, consume 2 byte value # - INTEGER, consume 4 byte value # - ASCII_STRING, consume ANSI/UTF8 string until null byte is reached # - UTF16_STRING, consume UTF-16 string until "null byte" is reached # - EOF, consume until end of file # # **Note:** # 1. Providing a string value to this field will attempt to read the # value of a previously parsed variable given a "field_name" attribute # equal to that string. Note that the given field must be an integral # value. # 2. Providing a function to this field will call that function, providing # the dictionary of currently passed variable "field_name"s and # values as argument. # The function must return an integer value signifying how many bytes # to consume. # 3. Providing a number greater than zero specifies the exact number of # bytes to consume for this field. # ''' # BYTE = -1 # SHORT = -2 # INTEGER = -3 # ASCII_STRING = -4 # UTF16_STRING = -5 # EOF = -6 # # class BinaryClass(object): # ''' # The BinaryClass object tells the parser what kind of value it should expect # in this field: # - PRIMITIVE, is for primitive types such as byte, short, int values # - ENUMERATION, this value is an enum. If ENUM then the "converter" value # should contain the dictionary which translates # integer values into strings. For example consider: # C code: # typedef enum VAL = { # FIRST_ENUM=1, # SECOND_ENUM # } # # Enum dictionary for this field: # enumdict = { 1: "FIRST_ENUM", 2: "SECOND_ENUM" } # - FLAG_BITWISE, similar to enum but this is for flag fields. The # "converter" field must contain a similar dictionary with # flag values that will be bitwise-compared to the entry # to determine which flags are on or off. # - FLAG_NUMERICAL, similar to FLAG_BITWISE but the "converter" field # contains actual numbers that are going to be compared # directly to the value of the field. # - CONSUME, simply consume this field and don't populate it within the # store. # - ANSI_STRING, specify that this is an ANSI string, the length can be # given at the BinaryRead field. # - UNICODE_STRING, specify that this is a unicode string, it's length # can be given at the BinaryRead field. # # The following haven't been implemented yet # - DECISION_VALUE, **NOT/MIGHT NOT BE IMPLEMENTED** # This value represents fields that "decide" what the # next field would be. It would work a bit like the # container=[] of xml and regex fields but at the # moment I see no reason why this could be used. # Please prove me wrong and it shall be implemented # promptly. # - POINTER_ABSOLUTE, that this field is a pointer(forwarder) to another # field that contains the offset to that field from # the beginning of the file # - POINTER_RELATIVE, same as above but pointer is relative offset from # current location # ''' # PRIMITIVE = 1 # POINTER_ABSOLUTE = 2 # POINTER_RELATIVE = 3 # ENUMERATION = 4 # FLAG_BITWISE = 5 # FLAG_NUMERICAL = 6 # CONSUME = 7 # ASCII_STRING = 8 # UTF8 = 9 # UTF16 = 10 # DATE = 11 # DECISION_VALUE = 12 , which may contain function names, class names, or code. Output only the next line.
if known_field.read_type == ReadTypeXML.READ_TEXT:
Using the snippet: <|code_start|> store_types[known_field.field_type], known_field.description, value, item_name = known_field.internal_name ) ) return items def parse_regex( filename, filepath, known_info, print_queue, settings=None ): file_handle = open( filepath, "rb") file_contents = file_handle.read() file_handle.close() subsections = [] for descr, known_fields in known_info.knownfields.iteritems(): print_queue.put("\t[Regex Parsing] Scanning: " + descr.label ) items = _parse_regex_knownfields( known_fields, file_contents, print_queue ) subsection = ExtractStore.MiscSubSection( descr, items ) subsections.append(subsection) return subsections def parse_keyval( filename, filepath, known_info, section, print_queue, settings=None ): return def parse_ascii(): return primitive_info = { <|code_end|> , determine the next line of code. You have imports: import ExtractStore, SQLite3Initializer import xml.etree.ElementTree as ET import re,struct, itertools import StringIO, sqlite3, tempfile, shutil,os from IMiscSource import FieldType, ReadTypeXML, BinaryRead, BinaryClass and context (class names, function names, or code) available: # Path: IMiscSource.py # class FieldType(object): # TYPE_STR = 1 # TYPE_INT = 2 # TYPE_DATA = 3 # #XML TYPE_CONTAINER searches for children in given element # TYPE_CONTAINER = 4 # #XML TYPE_ARRAY searches for all nodes in given xml doc # TYPE_ARRAY = 5 # TYPE_DATE = 6 # # class ReadTypeXML(object): # READ_TEXT = 0, # READ_ATTR = 1 # # class BinaryRead(object): # ''' # The BinaryRead field designates how many bytes will be consumed to read this # field. Eg, "how big this field is". # - BYTE, consume 1 byte value # - SHORT, consume 2 byte value # - INTEGER, consume 4 byte value # - ASCII_STRING, consume ANSI/UTF8 string until null byte is reached # - UTF16_STRING, consume UTF-16 string until "null byte" is reached # - EOF, consume until end of file # # **Note:** # 1. Providing a string value to this field will attempt to read the # value of a previously parsed variable given a "field_name" attribute # equal to that string. Note that the given field must be an integral # value. # 2. Providing a function to this field will call that function, providing # the dictionary of currently passed variable "field_name"s and # values as argument. # The function must return an integer value signifying how many bytes # to consume. # 3. Providing a number greater than zero specifies the exact number of # bytes to consume for this field. # ''' # BYTE = -1 # SHORT = -2 # INTEGER = -3 # ASCII_STRING = -4 # UTF16_STRING = -5 # EOF = -6 # # class BinaryClass(object): # ''' # The BinaryClass object tells the parser what kind of value it should expect # in this field: # - PRIMITIVE, is for primitive types such as byte, short, int values # - ENUMERATION, this value is an enum. If ENUM then the "converter" value # should contain the dictionary which translates # integer values into strings. For example consider: # C code: # typedef enum VAL = { # FIRST_ENUM=1, # SECOND_ENUM # } # # Enum dictionary for this field: # enumdict = { 1: "FIRST_ENUM", 2: "SECOND_ENUM" } # - FLAG_BITWISE, similar to enum but this is for flag fields. The # "converter" field must contain a similar dictionary with # flag values that will be bitwise-compared to the entry # to determine which flags are on or off. # - FLAG_NUMERICAL, similar to FLAG_BITWISE but the "converter" field # contains actual numbers that are going to be compared # directly to the value of the field. # - CONSUME, simply consume this field and don't populate it within the # store. # - ANSI_STRING, specify that this is an ANSI string, the length can be # given at the BinaryRead field. # - UNICODE_STRING, specify that this is a unicode string, it's length # can be given at the BinaryRead field. # # The following haven't been implemented yet # - DECISION_VALUE, **NOT/MIGHT NOT BE IMPLEMENTED** # This value represents fields that "decide" what the # next field would be. It would work a bit like the # container=[] of xml and regex fields but at the # moment I see no reason why this could be used. # Please prove me wrong and it shall be implemented # promptly. # - POINTER_ABSOLUTE, that this field is a pointer(forwarder) to another # field that contains the offset to that field from # the beginning of the file # - POINTER_RELATIVE, same as above but pointer is relative offset from # current location # ''' # PRIMITIVE = 1 # POINTER_ABSOLUTE = 2 # POINTER_RELATIVE = 3 # ENUMERATION = 4 # FLAG_BITWISE = 5 # FLAG_NUMERICAL = 6 # CONSUME = 7 # ASCII_STRING = 8 # UTF8 = 9 # UTF16 = 10 # DATE = 11 # DECISION_VALUE = 12 . Output only the next line.
BinaryRead.BYTE : {"fmt": 'b', "size": 1 },
Given snippet: <|code_start|> #XXX should find a more pythonic way to do this... tmpval = [] for c in file_contents[cur:]: if c == '\x00' and tmpval[-1:] == '\x00': break tmpval.append(c) tmpval = tmpval[:-1] #remove last null cur += len(tmpval) + 2 val = ''.join(tmpval).decode("UTF-16") elif field.binary_read == BinaryRead.EOF: val = file_contents[cur:] elif callable(field.binary_read): (val,consume) = field.binary_read(temp_store,cur,file_contents) cur += consume elif type(field.binary_read) == int and field.binary_read > 0: val = file_contents[cur:cur+field.binary_read] cur += field.binary_read elif type(field.binary_read) == str: if field.binary_read in temp_store: size = temp_store[field.binary_read] if type(size) == int: val = file_contents[cur:cur+size] cur += size else: print "Error: De-referencing value is not int" else: print "Error: Invalid BinaryRead value" continue #Interpreting value field_type = None <|code_end|> , continue by predicting the next line. Consider current file imports: import ExtractStore, SQLite3Initializer import xml.etree.ElementTree as ET import re,struct, itertools import StringIO, sqlite3, tempfile, shutil,os from IMiscSource import FieldType, ReadTypeXML, BinaryRead, BinaryClass and context: # Path: IMiscSource.py # class FieldType(object): # TYPE_STR = 1 # TYPE_INT = 2 # TYPE_DATA = 3 # #XML TYPE_CONTAINER searches for children in given element # TYPE_CONTAINER = 4 # #XML TYPE_ARRAY searches for all nodes in given xml doc # TYPE_ARRAY = 5 # TYPE_DATE = 6 # # class ReadTypeXML(object): # READ_TEXT = 0, # READ_ATTR = 1 # # class BinaryRead(object): # ''' # The BinaryRead field designates how many bytes will be consumed to read this # field. Eg, "how big this field is". # - BYTE, consume 1 byte value # - SHORT, consume 2 byte value # - INTEGER, consume 4 byte value # - ASCII_STRING, consume ANSI/UTF8 string until null byte is reached # - UTF16_STRING, consume UTF-16 string until "null byte" is reached # - EOF, consume until end of file # # **Note:** # 1. Providing a string value to this field will attempt to read the # value of a previously parsed variable given a "field_name" attribute # equal to that string. Note that the given field must be an integral # value. # 2. Providing a function to this field will call that function, providing # the dictionary of currently passed variable "field_name"s and # values as argument. # The function must return an integer value signifying how many bytes # to consume. # 3. Providing a number greater than zero specifies the exact number of # bytes to consume for this field. # ''' # BYTE = -1 # SHORT = -2 # INTEGER = -3 # ASCII_STRING = -4 # UTF16_STRING = -5 # EOF = -6 # # class BinaryClass(object): # ''' # The BinaryClass object tells the parser what kind of value it should expect # in this field: # - PRIMITIVE, is for primitive types such as byte, short, int values # - ENUMERATION, this value is an enum. If ENUM then the "converter" value # should contain the dictionary which translates # integer values into strings. For example consider: # C code: # typedef enum VAL = { # FIRST_ENUM=1, # SECOND_ENUM # } # # Enum dictionary for this field: # enumdict = { 1: "FIRST_ENUM", 2: "SECOND_ENUM" } # - FLAG_BITWISE, similar to enum but this is for flag fields. The # "converter" field must contain a similar dictionary with # flag values that will be bitwise-compared to the entry # to determine which flags are on or off. # - FLAG_NUMERICAL, similar to FLAG_BITWISE but the "converter" field # contains actual numbers that are going to be compared # directly to the value of the field. # - CONSUME, simply consume this field and don't populate it within the # store. # - ANSI_STRING, specify that this is an ANSI string, the length can be # given at the BinaryRead field. # - UNICODE_STRING, specify that this is a unicode string, it's length # can be given at the BinaryRead field. # # The following haven't been implemented yet # - DECISION_VALUE, **NOT/MIGHT NOT BE IMPLEMENTED** # This value represents fields that "decide" what the # next field would be. It would work a bit like the # container=[] of xml and regex fields but at the # moment I see no reason why this could be used. # Please prove me wrong and it shall be implemented # promptly. # - POINTER_ABSOLUTE, that this field is a pointer(forwarder) to another # field that contains the offset to that field from # the beginning of the file # - POINTER_RELATIVE, same as above but pointer is relative offset from # current location # ''' # PRIMITIVE = 1 # POINTER_ABSOLUTE = 2 # POINTER_RELATIVE = 3 # ENUMERATION = 4 # FLAG_BITWISE = 5 # FLAG_NUMERICAL = 6 # CONSUME = 7 # ASCII_STRING = 8 # UTF8 = 9 # UTF16 = 10 # DATE = 11 # DECISION_VALUE = 12 which might include code, classes, or functions. Output only the next line.
if field.binary_class == BinaryClass.PRIMITIVE:
Predict the next line for this snippet: <|code_start|> Widget( Widgets.PIE_CHART, "Most calls from/to", 4, self._top_called_person ), Widget( Widgets.PIE_CHART, "Overall time spend in calls", 4, self._most_lengthy_conversations ), Widget( Widgets.PIE_CHART, "Top used Apps", 4, self._top_used_apps ), Widget( Widgets.TABLE, "Device Accounts", 6, self._get_device_accounts ), Widget( Widgets.TABLE, "Device Info", 6, self._get_device_info ) ] self.case = case return @cherrypy.expose def index(self, case_id): store = self.case.get_store(case_id) html = u""" <h3>Dashboard</h3><hr /> """ for wdef in self.widgets: widget = Widgets.get_widget(wdef.widget_id) if widget == None: continue widget.set_title( wdef.title ) widget.set_size( wdef.size ) res = wdef.data_func(widget,store) if res: html += Widgets.render_widget_object(widget) return html def _top_used_apps(self, widget, store): <|code_end|> with the help of current file imports: import cherrypy, os import Widgets from Catalog import Catalog from mako.lookup import TemplateLookup and context from other files: # Path: Catalog.py # class Catalog(IMainModule): # CATALOG_NONE = 0 # CATALOG_DEVINFO = 1 # CATALOG_SETTINGS = 2 # CATALOG_APPS = 3 # CATALOG_NETWORKING = 4 # CATALOG_LOGS = 5 # CATALOG_TIMELINE = 6 # CATALOG_COMMS = 7 # # name = "Catalogs" # internal_name = "catalog" # # catalogs_info = { # CATALOG_NONE : { "name":"Uncategorised", "display":False }, # CATALOG_DEVINFO : {"name": "Device Info", "display": True, # "url": "/devinfo", "icon": "fa-info" }, # CATALOG_SETTINGS : { "name": "Device Settings", "display": False, # "url": "/devsettings", "icon": "fa-gear" }, # CATALOG_APPS : { "name": "Apps", "display": True, "url": "/apps", # "icon": "fa-archive" }, # CATALOG_NETWORKING : { "name": "Networking", "display": True, # "url": "/devnet", "icon": "fa-globe" }, # CATALOG_LOGS : { "name": "Device Logs", "display": True, # "url": "/logs", "icon": "fa-file" }, # CATALOG_TIMELINE : { "name": "Timeline", "display": False, # "url": "/timeline", "icon": "fa-clock-o" }, # CATALOG_COMMS : { "name": "Communications", "display":True, # "url": "/comms", "icon":"fa-comments-o" } # } # # def __init__(self, lookup, case, settings): # '@type lookup: mako.lookup.TemplateLookup' # self.lookup = lookup # self.case = case # self.settings = settings # return # # # def set_templatelookup(self, lookup): # '@type lookup: mako.lookup.TemplateLookup' # self.lookup = lookup # # def get_menuentry_list(self, store, case_id): # menu = [] # for cat_id, catalog in self.catalogs_info.iteritems(): # if catalog['display'] == False: continue # store_catalog = store.get_misccatalog(cat_id) # if len(store_catalog.sections) != 0: # entry = MenuEntry(catalog['name'], "#", catalog['icon'] ) # for section in store_catalog.sections.values(): # child = MenuEntry( section.section_label, catalog['url'] + # '/' + str(case_id) + '/' + # section.section_name ) # entry.content.append(child) # else: # entry = MenuEntry(catalog['name'], # catalog['url']+'/'+str(case_id), # catalog['icon']) # menu.append(entry) # return menu # # def get_catalog_table_html(self,catalog,section_name): # tmpl = self.lookup.get_template("catalog_table.html") # for name,section in catalog.sections.iteritems(): # if( name.replace(' ', '') == section_name ): # return tmpl.render_unicode(section=section) # tmpl = self.lookup.get_template("error.html") # return tmpl.render_unicode(error="Catalog not found") # # @cherrypy.expose # def apps(self, case_id, section_name): # cat = self.case.get_store(case_id).get_misccatalog(Catalog.CATALOG_APPS) # return self.get_catalog_table_html(cat,section_name) # # @cherrypy.expose # def devinfo(self, case_id, section_name): # cat = self.case.get_store(case_id).get_misccatalog( # Catalog.CATALOG_DEVINFO) # return self.get_catalog_table_html(cat, section_name) # # @cherrypy.expose # def logs(self, case_id, section_name): # cat = self.case.get_store(case_id).get_misccatalog(Catalog.CATALOG_LOGS) # return self.get_catalog_table_html(cat, section_name) # # @cherrypy.expose # def devnet(self, case_id, section_name): # cat = self.case.get_store(case_id).get_misccatalog( # Catalog.CATALOG_NETWORKING) # return self.get_catalog_table_html(cat, section_name) # # @cherrypy.expose # def comms(self, case_id, section_name): # cat = self.case.get_store(case_id).get_misccatalog( # Catalog.CATALOG_COMMS) # return self.get_catalog_table_html(cat, section_name) , which may contain function names, class names, or code. Output only the next line.
usage_stats = store.query_catalog( Catalog.CATALOG_LOGS,
Given the code snippet: <|code_start|> Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' class ApplicationParser(object): parser_name = "Android Application Parser" appstore = {} exstore = None def __init__(self, outqueue=None, extract_store=None, mountpoint=None, settings=None, versions=None ): self.mimguess = MimeGuesser() self.outqueue = outqueue self.settings = settings self.versions = versions imp = Importer() <|code_end|> , generate the next line using the imports in this file: from IApp import IApp from MimeGuesser import MimeGuesser from os import listdir from os.path import isfile, isdir, islink, join, basename, dirname from MiscUtils import genfilesig, DEFAULT_HASHER from ModuleImporter import Importer import ExtractStore import os and context (functions, classes, or occasionally code) from other files: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # Path: MiscUtils.py # def genfilesig(filepath,hasher=DEFAULT_HASHER,bs=65536): # try: # f = open(filepath,"rb") # while True: # buf = f.read(bs) # if not buf: # break # hasher.update(buf) # f.close() # return hasher.hexdigest() # except: # print "Error opening file:" + filepath # return None # # DEFAULT_HASHER = hashlib.sha256() # # Path: ModuleImporter.py # class Importer(object): # def __init__(self): # return # # def get_package_modules_dict(self, package_name, parent_obj, keyfield, # args=None ): # return self._load_dict( [package_name], package_name + u".", parent_obj, # keyfield, args) # # def get_package_modules(self, package_name, parent_obj, args=None ): # return self._load( [package_name], package_name + u".", parent_obj, # True, args ) # # def get_package_modules_list(self, package_name, parent_obj ): # return self._load( [package_name], package_name + u".", parent_obj ) # # def _load(self, path, prefix, parent_obj, instantiate=False, args=None ): # modules = [] # for _, name, is_package in walk_packages( path, prefix=prefix ): # if is_package: continue # module = import_module( name ) # for member in dir(module): # if member == parent_obj.__class__.__name__: continue # member_obj = getattr( module, member ) # if inspect.isclass( member_obj ) == False: continue # if issubclass( member_obj, parent_obj.__class__ ): # if instantiate: # if args != None: obj = member_obj(*args) # else: obj = member_obj() # modules.append( obj ) # else: # modules.append( member ) # return modules # # def _load_dict(self, path, prefix, parent_obj, keyfield, args=None ): # modules = {} # for _, name, is_package in walk_packages( path, prefix=prefix ): # if is_package: continue # module = import_module( name ) # for member in dir(module): # if member == parent_obj.__class__.__name__: continue # member_obj = getattr( module, member ) # if inspect.isclass( member_obj ) == False: continue # if issubclass( member_obj, parent_obj.__class__ ): # if args != None: tmpobj = member_obj(*args) # else: tmpobj = member_obj() # modules[getattr( tmpobj, keyfield )] = tmpobj # return modules . Output only the next line.
app_modules = imp.get_package_modules("AndroidApps", IApp())
Here is a snippet: <|code_start|> try: appversion = int(appversion) except: pass for defn in self.appstore[name]: if defn.has_defaultversion: if default != None: self.outqueue.put("{} has more than one default".format(name)) default = defn if defn.has_version(appversion): return defn return default def handle_file(self, filename, dirpath, app): filepath = join(dirpath,filename) handler = self.mimguess.get_handler(filepath) knowninfo = app.get_file_info(filename) fobject = None if handler != None: fobject = handler(filename,filepath,knowninfo,self.outqueue, self.settings) else: """ This is a remote case where no handler can handle the file. However, the default handler for unknown files should always be the raw data handler """ fobject = ExtractStore.ApplicationFile(filename, ExtractStore.TYPE_NONE) fobject.set_mime(self.mimguess.get_filemime(filepath)) <|code_end|> . Write the next line using the current file imports: from IApp import IApp from MimeGuesser import MimeGuesser from os import listdir from os.path import isfile, isdir, islink, join, basename, dirname from MiscUtils import genfilesig, DEFAULT_HASHER from ModuleImporter import Importer import ExtractStore import os and context from other files: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # Path: MiscUtils.py # def genfilesig(filepath,hasher=DEFAULT_HASHER,bs=65536): # try: # f = open(filepath,"rb") # while True: # buf = f.read(bs) # if not buf: # break # hasher.update(buf) # f.close() # return hasher.hexdigest() # except: # print "Error opening file:" + filepath # return None # # DEFAULT_HASHER = hashlib.sha256() # # Path: ModuleImporter.py # class Importer(object): # def __init__(self): # return # # def get_package_modules_dict(self, package_name, parent_obj, keyfield, # args=None ): # return self._load_dict( [package_name], package_name + u".", parent_obj, # keyfield, args) # # def get_package_modules(self, package_name, parent_obj, args=None ): # return self._load( [package_name], package_name + u".", parent_obj, # True, args ) # # def get_package_modules_list(self, package_name, parent_obj ): # return self._load( [package_name], package_name + u".", parent_obj ) # # def _load(self, path, prefix, parent_obj, instantiate=False, args=None ): # modules = [] # for _, name, is_package in walk_packages( path, prefix=prefix ): # if is_package: continue # module = import_module( name ) # for member in dir(module): # if member == parent_obj.__class__.__name__: continue # member_obj = getattr( module, member ) # if inspect.isclass( member_obj ) == False: continue # if issubclass( member_obj, parent_obj.__class__ ): # if instantiate: # if args != None: obj = member_obj(*args) # else: obj = member_obj() # modules.append( obj ) # else: # modules.append( member ) # return modules # # def _load_dict(self, path, prefix, parent_obj, keyfield, args=None ): # modules = {} # for _, name, is_package in walk_packages( path, prefix=prefix ): # if is_package: continue # module = import_module( name ) # for member in dir(module): # if member == parent_obj.__class__.__name__: continue # member_obj = getattr( module, member ) # if inspect.isclass( member_obj ) == False: continue # if issubclass( member_obj, parent_obj.__class__ ): # if args != None: tmpobj = member_obj(*args) # else: tmpobj = member_obj() # modules[getattr( tmpobj, keyfield )] = tmpobj # return modules , which may include functions, classes, or code. Output only the next line.
fobject.add_sig(genfilesig(filepath, DEFAULT_HASHER))
Predict the next line for this snippet: <|code_start|> try: appversion = int(appversion) except: pass for defn in self.appstore[name]: if defn.has_defaultversion: if default != None: self.outqueue.put("{} has more than one default".format(name)) default = defn if defn.has_version(appversion): return defn return default def handle_file(self, filename, dirpath, app): filepath = join(dirpath,filename) handler = self.mimguess.get_handler(filepath) knowninfo = app.get_file_info(filename) fobject = None if handler != None: fobject = handler(filename,filepath,knowninfo,self.outqueue, self.settings) else: """ This is a remote case where no handler can handle the file. However, the default handler for unknown files should always be the raw data handler """ fobject = ExtractStore.ApplicationFile(filename, ExtractStore.TYPE_NONE) fobject.set_mime(self.mimguess.get_filemime(filepath)) <|code_end|> with the help of current file imports: from IApp import IApp from MimeGuesser import MimeGuesser from os import listdir from os.path import isfile, isdir, islink, join, basename, dirname from MiscUtils import genfilesig, DEFAULT_HASHER from ModuleImporter import Importer import ExtractStore import os and context from other files: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # Path: MiscUtils.py # def genfilesig(filepath,hasher=DEFAULT_HASHER,bs=65536): # try: # f = open(filepath,"rb") # while True: # buf = f.read(bs) # if not buf: # break # hasher.update(buf) # f.close() # return hasher.hexdigest() # except: # print "Error opening file:" + filepath # return None # # DEFAULT_HASHER = hashlib.sha256() # # Path: ModuleImporter.py # class Importer(object): # def __init__(self): # return # # def get_package_modules_dict(self, package_name, parent_obj, keyfield, # args=None ): # return self._load_dict( [package_name], package_name + u".", parent_obj, # keyfield, args) # # def get_package_modules(self, package_name, parent_obj, args=None ): # return self._load( [package_name], package_name + u".", parent_obj, # True, args ) # # def get_package_modules_list(self, package_name, parent_obj ): # return self._load( [package_name], package_name + u".", parent_obj ) # # def _load(self, path, prefix, parent_obj, instantiate=False, args=None ): # modules = [] # for _, name, is_package in walk_packages( path, prefix=prefix ): # if is_package: continue # module = import_module( name ) # for member in dir(module): # if member == parent_obj.__class__.__name__: continue # member_obj = getattr( module, member ) # if inspect.isclass( member_obj ) == False: continue # if issubclass( member_obj, parent_obj.__class__ ): # if instantiate: # if args != None: obj = member_obj(*args) # else: obj = member_obj() # modules.append( obj ) # else: # modules.append( member ) # return modules # # def _load_dict(self, path, prefix, parent_obj, keyfield, args=None ): # modules = {} # for _, name, is_package in walk_packages( path, prefix=prefix ): # if is_package: continue # module = import_module( name ) # for member in dir(module): # if member == parent_obj.__class__.__name__: continue # member_obj = getattr( module, member ) # if inspect.isclass( member_obj ) == False: continue # if issubclass( member_obj, parent_obj.__class__ ): # if args != None: tmpobj = member_obj(*args) # else: tmpobj = member_obj() # modules[getattr( tmpobj, keyfield )] = tmpobj # return modules , which may contain function names, class names, or code. Output only the next line.
fobject.add_sig(genfilesig(filepath, DEFAULT_HASHER))
Predict the next line after this snippet: <|code_start|>Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' class ApplicationParser(object): parser_name = "Android Application Parser" appstore = {} exstore = None def __init__(self, outqueue=None, extract_store=None, mountpoint=None, settings=None, versions=None ): self.mimguess = MimeGuesser() self.outqueue = outqueue self.settings = settings self.versions = versions <|code_end|> using the current file's imports: from IApp import IApp from MimeGuesser import MimeGuesser from os import listdir from os.path import isfile, isdir, islink, join, basename, dirname from MiscUtils import genfilesig, DEFAULT_HASHER from ModuleImporter import Importer import ExtractStore import os and any relevant context from other files: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # Path: MiscUtils.py # def genfilesig(filepath,hasher=DEFAULT_HASHER,bs=65536): # try: # f = open(filepath,"rb") # while True: # buf = f.read(bs) # if not buf: # break # hasher.update(buf) # f.close() # return hasher.hexdigest() # except: # print "Error opening file:" + filepath # return None # # DEFAULT_HASHER = hashlib.sha256() # # Path: ModuleImporter.py # class Importer(object): # def __init__(self): # return # # def get_package_modules_dict(self, package_name, parent_obj, keyfield, # args=None ): # return self._load_dict( [package_name], package_name + u".", parent_obj, # keyfield, args) # # def get_package_modules(self, package_name, parent_obj, args=None ): # return self._load( [package_name], package_name + u".", parent_obj, # True, args ) # # def get_package_modules_list(self, package_name, parent_obj ): # return self._load( [package_name], package_name + u".", parent_obj ) # # def _load(self, path, prefix, parent_obj, instantiate=False, args=None ): # modules = [] # for _, name, is_package in walk_packages( path, prefix=prefix ): # if is_package: continue # module = import_module( name ) # for member in dir(module): # if member == parent_obj.__class__.__name__: continue # member_obj = getattr( module, member ) # if inspect.isclass( member_obj ) == False: continue # if issubclass( member_obj, parent_obj.__class__ ): # if instantiate: # if args != None: obj = member_obj(*args) # else: obj = member_obj() # modules.append( obj ) # else: # modules.append( member ) # return modules # # def _load_dict(self, path, prefix, parent_obj, keyfield, args=None ): # modules = {} # for _, name, is_package in walk_packages( path, prefix=prefix ): # if is_package: continue # module = import_module( name ) # for member in dir(module): # if member == parent_obj.__class__.__name__: continue # member_obj = getattr( module, member ) # if inspect.isclass( member_obj ) == False: continue # if issubclass( member_obj, parent_obj.__class__ ): # if args != None: tmpobj = member_obj(*args) # else: tmpobj = member_obj() # modules[getattr( tmpobj, keyfield )] = tmpobj # return modules . Output only the next line.
imp = Importer()
Here is a snippet: <|code_start|>''' NFI -- Silensec's Nyuki Forensics Investigator Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. Juma Fredrick (j.fredrick[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' <|code_end|> . Write the next line using the current file imports: from IApp import IApp, KnownTable, DataTypes import ConvertUtils and context from other files: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 , which may include functions, classes, or code. Output only the next line.
class com_android_providers_media(IApp):
Here is a snippet: <|code_start|>''' NFI -- Silensec's Nyuki Forensics Investigator Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. Juma Fredrick (j.fredrick[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' class com_android_providers_media(IApp): name = "com.android.providers.media" cname = "Android Providers Media" databases = { "external.db": [ <|code_end|> . Write the next line using the current file imports: from IApp import IApp, KnownTable, DataTypes import ConvertUtils and context from other files: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 , which may include functions, classes, or code. Output only the next line.
KnownTable("files", None,
Predict the next line after this snippet: <|code_start|> Silensec Ltd. Juma Fredrick (j.fredrick[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' class com_android_providers_media(IApp): name = "com.android.providers.media" cname = "Android Providers Media" databases = { "external.db": [ KnownTable("files", None, {"date_added":ConvertUtils.UnixTimestamp, "date_modified":ConvertUtils.UnixTimestamp, "datetaken":ConvertUtils.JsToUnix, "duration":ConvertUtils.UnixTimestamp }, <|code_end|> using the current file's imports: from IApp import IApp, KnownTable, DataTypes import ConvertUtils and any relevant context from other files: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 . Output only the next line.
{"date_added":DataTypes.DATE,
Predict the next line after this snippet: <|code_start|>''' NFI -- Silensec's Nyuki Forensics Investigator Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. Juma Fredrick (j.fredrick[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' <|code_end|> using the current file's imports: from IApp import IApp, KnownTable, DataTypes import ConvertUtils import re and any relevant context from other files: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 . Output only the next line.
class com_google_android_gm(IApp):
Using the snippet: <|code_start|>''' NFI -- Silensec's Nyuki Forensics Investigator Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. Juma Fredrick (j.fredrick[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' class com_google_android_gm(IApp): name = "com.google.android.gm" cname = "Google Gmail" databases = { re.compile("mailstore\.[^@]+@[^@]+\.[^@]+\.db"): [ <|code_end|> , determine the next line of code. You have imports: from IApp import IApp, KnownTable, DataTypes import ConvertUtils import re and context (class names, function names, or code) available: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 . Output only the next line.
KnownTable("conversation_labels", None,
Given the code snippet: <|code_start|>NFI -- Silensec's Nyuki Forensics Investigator Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. Juma Fredrick (j.fredrick[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' class com_google_android_gm(IApp): name = "com.google.android.gm" cname = "Google Gmail" databases = { re.compile("mailstore\.[^@]+@[^@]+\.[^@]+\.db"): [ KnownTable("conversation_labels", None, {"date":ConvertUtils.JsToUnix,}, <|code_end|> , generate the next line using the imports in this file: from IApp import IApp, KnownTable, DataTypes import ConvertUtils import re and context (functions, classes, or occasionally code) from other files: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 . Output only the next line.
{"date":DataTypes.DATE,}),
Here is a snippet: <|code_start|>''' NFI -- Silensec's Nyuki Forensics Investigator Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. Juma Fredrick (j.fredrick[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' <|code_end|> . Write the next line using the current file imports: from IApp import IApp, KnownTable, DataTypes import ConvertUtils import re and context from other files: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 , which may include functions, classes, or code. Output only the next line.
class com_opera_browser(IApp):
Predict the next line after this snippet: <|code_start|>''' NFI -- Silensec's Nyuki Forensics Investigator Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. Juma Fredrick (j.fredrick[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' class com_opera_browser(IApp): name = "com.opera.browser" cname = "Android Opera Browser" databases = { re.compile(".*\.localstore"): [ <|code_end|> using the current file's imports: from IApp import IApp, KnownTable, DataTypes import ConvertUtils import re and any relevant context from other files: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 . Output only the next line.
KnownTable("cookies", None,
Given the code snippet: <|code_start|> Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. Juma Fredrick (j.fredrick[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' class com_opera_browser(IApp): name = "com.opera.browser" cname = "Android Opera Browser" databases = { re.compile(".*\.localstore"): [ KnownTable("cookies", None, {"creation_utc":ConvertUtils.WebkitToUnix, "expires_utc":ConvertUtils.WebkitToUnix, "last_access_utc":ConvertUtils.WebkitToUnix }, <|code_end|> , generate the next line using the imports in this file: from IApp import IApp, KnownTable, DataTypes import ConvertUtils import re and context (functions, classes, or occasionally code) from other files: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 . Output only the next line.
{"creation_utc":DataTypes.DATE,
Given the code snippet: <|code_start|>''' NFI -- Silensec's Nyuki Forensics Investigator Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' <|code_end|> , generate the next line using the imports in this file: from IApp import IApp, KnownTable, DataTypes import ConvertUtils and context (functions, classes, or occasionally code) from other files: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 . Output only the next line.
class com_android_providers_calendar(IApp):
Next line prediction: <|code_start|>''' NFI -- Silensec's Nyuki Forensics Investigator Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' class com_android_providers_calendar(IApp): name = "com.android.providers.calendar" cname = "Calendar Provider" databases = { "calendar.db": [ <|code_end|> . Use current file imports: (from IApp import IApp, KnownTable, DataTypes import ConvertUtils) and context including class names, function names, or small code snippets from other files: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 . Output only the next line.
KnownTable("_sync_state", None,
Next line prediction: <|code_start|>''' NFI -- Silensec's Nyuki Forensics Investigator Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' class com_android_providers_calendar(IApp): name = "com.android.providers.calendar" cname = "Calendar Provider" databases = { "calendar.db": [ KnownTable("_sync_state", None, None, <|code_end|> . Use current file imports: (from IApp import IApp, KnownTable, DataTypes import ConvertUtils) and context including class names, function names, or small code snippets from other files: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 . Output only the next line.
{"data": DataTypes.DATA}),
Continue the code snippet: <|code_start|>''' NFI -- Silensec's Nyuki Forensics Investigator Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' class HtmlExtract(object): def __init__(self): self.datahandlers = { <|code_end|> . Use current file imports: import os,cgi,string,re,StringIO import ExtractStore import shutil import magic import biplist import traceback,sys,base64 from IApp import DataTypes, IApp from MimeGuesser import MimeGuesser and context (classes, functions, or code) from other files: # Path: IApp.py # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 # # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return . Output only the next line.
DataTypes.DATA: self.datahandler,
Predict the next line for this snippet: <|code_start|>''' NFI -- Silensec's Nyuki Forensics Investigator Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. Juma Fredrick (j.fredrick[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' <|code_end|> with the help of current file imports: from IApp import IApp, KnownTable, DataTypes import ConvertUtils and context from other files: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 , which may contain function names, class names, or code. Output only the next line.
class org_mozilla_firefox(IApp):
Next line prediction: <|code_start|>''' NFI -- Silensec's Nyuki Forensics Investigator Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. Juma Fredrick (j.fredrick[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' class org_mozilla_firefox(IApp): name = "org.mozilla.firefox" cname = "Android mozillafirefox Browser" databases = { "signons.sqlite": [ <|code_end|> . Use current file imports: (from IApp import IApp, KnownTable, DataTypes import ConvertUtils) and context including class names, function names, or small code snippets from other files: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 . Output only the next line.
KnownTable("moz_deleted_logins", None,
Next line prediction: <|code_start|>NFI -- Silensec's Nyuki Forensics Investigator Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. Juma Fredrick (j.fredrick[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' class org_mozilla_firefox(IApp): name = "org.mozilla.firefox" cname = "Android mozillafirefox Browser" databases = { "signons.sqlite": [ KnownTable("moz_deleted_logins", None, {"timeDeleted":ConvertUtils.JsToUnix }, <|code_end|> . Use current file imports: (from IApp import IApp, KnownTable, DataTypes import ConvertUtils) and context including class names, function names, or small code snippets from other files: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 . Output only the next line.
{"timeDeleted":DataTypes.DATE }),
Based on the snippet: <|code_start|>''' NFI -- Silensec's Nyuki Forensics Investigator Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' #XXX update this <|code_end|> , predict the immediate next line with the help of imports: from IApp import IApp, KnownTable, DataTypes import ConvertUtils and context (classes, functions, sometimes code) from other files: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 . Output only the next line.
class com_google_android_gsf(IApp):
Continue the code snippet: <|code_start|>''' NFI -- Silensec's Nyuki Forensics Investigator Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' #XXX update this class com_google_android_gsf(IApp): name = "com.google.android.gsf" cname = "Google Services Framework" databases = { "subscribedfeeds.db": [ <|code_end|> . Use current file imports: from IApp import IApp, KnownTable, DataTypes import ConvertUtils and context (classes, functions, or code) from other files: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 . Output only the next line.
KnownTable("_sync_state", None, None, {"data": DataTypes.DATA}),
Based on the snippet: <|code_start|>''' NFI -- Silensec's Nyuki Forensics Investigator Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' #XXX update this class com_google_android_gsf(IApp): name = "com.google.android.gsf" cname = "Google Services Framework" databases = { "subscribedfeeds.db": [ <|code_end|> , predict the immediate next line with the help of imports: from IApp import IApp, KnownTable, DataTypes import ConvertUtils and context (classes, functions, sometimes code) from other files: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 . Output only the next line.
KnownTable("_sync_state", None, None, {"data": DataTypes.DATA}),
Predict the next line for this snippet: <|code_start|>''' NFI -- Silensec's Nyuki Forensics Investigator Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. Juma Fredrick (j.fredrick[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' <|code_end|> with the help of current file imports: from IApp import IApp, KnownTable, DataTypes import ConvertUtils and context from other files: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 , which may contain function names, class names, or code. Output only the next line.
class com_whatsapp(IApp):
Predict the next line after this snippet: <|code_start|>''' NFI -- Silensec's Nyuki Forensics Investigator Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. Juma Fredrick (j.fredrick[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' class com_whatsapp(IApp): name = "com.whatsapp" cname = "Android WhatsApp" databases = { "wa.db": [ <|code_end|> using the current file's imports: from IApp import IApp, KnownTable, DataTypes import ConvertUtils and any relevant context from other files: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 . Output only the next line.
KnownTable("wa_contacts", None,
Given the following code snippet before the placeholder: <|code_start|> Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. Juma Fredrick (j.fredrick[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' class com_whatsapp(IApp): name = "com.whatsapp" cname = "Android WhatsApp" databases = { "wa.db": [ KnownTable("wa_contacts", None, {"status_timestamp":ConvertUtils.JsToUnix, "photo_id_timestamp":ConvertUtils.JsToUnix }, <|code_end|> , predict the next line using imports from the current file: from IApp import IApp, KnownTable, DataTypes import ConvertUtils and context including class names, function names, and sometimes code from other files: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 . Output only the next line.
{"status_timestamp":DataTypes.DATE,
Next line prediction: <|code_start|>''' NFI -- Silensec's Nyuki Forensics Investigator Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. Juma Fredrick (j.fredrick[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' <|code_end|> . Use current file imports: (from IApp import IApp, KnownTable, DataTypes import ConvertUtils) and context including class names, function names, or small code snippets from other files: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 . Output only the next line.
class com_facebook_orca(IApp):
Given the following code snippet before the placeholder: <|code_start|>''' NFI -- Silensec's Nyuki Forensics Investigator Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. Juma Fredrick (j.fredrick[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' class com_facebook_orca(IApp): name = "com.facebook.orca" cname = "Android Facebook Orca" databases = { "newsfeed_db": [ <|code_end|> , predict the next line using imports from the current file: from IApp import IApp, KnownTable, DataTypes import ConvertUtils and context including class names, function names, and sometimes code from other files: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 . Output only the next line.
KnownTable("home_stories", None,
Given snippet: <|code_start|> Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. Juma Fredrick (j.fredrick[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' class com_facebook_orca(IApp): name = "com.facebook.orca" cname = "Android Facebook Orca" databases = { "newsfeed_db": [ KnownTable("home_stories", None, {"fetched_at":ConvertUtils.JsToUnix}, <|code_end|> , continue by predicting the next line. Consider current file imports: from IApp import IApp, KnownTable, DataTypes import ConvertUtils and context: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 which might include code, classes, or functions. Output only the next line.
{"fetched_at":DataTypes.DATE}),
Given the following code snippet before the placeholder: <|code_start|>''' NFI -- Silensec's Nyuki Forensics Investigator Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. Juma Fredrick (j.fredrick[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' <|code_end|> , predict the next line using imports from the current file: from IApp import IApp, KnownTable, DataTypes import ConvertUtils and context including class names, function names, and sometimes code from other files: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 . Output only the next line.
class com_android_chrome(IApp):
Here is a snippet: <|code_start|>''' NFI -- Silensec's Nyuki Forensics Investigator Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. Juma Fredrick (j.fredrick[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' class com_android_chrome(IApp): name = "com.android.chrome" cname = "Android Chrome Browser" databases = { "History": [ <|code_end|> . Write the next line using the current file imports: from IApp import IApp, KnownTable, DataTypes import ConvertUtils and context from other files: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 , which may include functions, classes, or code. Output only the next line.
KnownTable("downloads", None,
Predict the next line for this snippet: <|code_start|> Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. Juma Fredrick (j.fredrick[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' class com_android_chrome(IApp): name = "com.android.chrome" cname = "Android Chrome Browser" databases = { "History": [ KnownTable("downloads", None, {"start_time":ConvertUtils.WebkitToUnix, "end_time":ConvertUtils.WebkitToUnix}, <|code_end|> with the help of current file imports: from IApp import IApp, KnownTable, DataTypes import ConvertUtils and context from other files: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 , which may contain function names, class names, or code. Output only the next line.
{"start_time":DataTypes.DATE, "end_time":DataTypes.DATE}),
Given the code snippet: <|code_start|> if int_name in self.sections: return self.sections[int_name] if create_new: newsection = MiscSection( section_label ) self.add_section( newsection ) return newsection return None class ExtractStore(object): store = [] misc_catalogs = {} timeline = None def __init__(self): self.store = [] self.misc_catalogs = {} return """ Add the application's package name in order to generate the appropriate structure for this application Params: - package_name: The application's package name (string) """ def create_application(self, package_name, canonical_name=None): app = Application(package_name, canonical_name) self.store.append(app) return app def create_timeline(self): <|code_end|> , generate the next line using the imports in this file: import os, string import Includes import cPickle, time, marshal import cPickle,marshal from Timeline import Timeline and context (functions, classes, or occasionally code) from other files: # Path: Timeline.py # class Timeline(object): # CLASS_SUCCESS = "success" # CLASS_WARN = "warning" # CLASS_INFO = "info" # CLASS_PRIMARY = "primary" # # _DATES_KEYFORM = "{day}{month}{year}" # def __init__(self): # self.items = [] # self.timeline_dates = {} # return # # def _convertunix(self, unix): # if type(unix) in [str,unicode]: # if unix.isdigit(): unix = int(unix) # else: return None # return unix # # def _get_month_from_unix(self,unix): # unix = self._convertunix(unix) # try: # return datetime.fromtimestamp(unix).strftime('%b') # except: # return None # # def _get_day_from_unix(self, unix): # unix = self._convertunix(unix) # try: # return datetime.fromtimestamp(unix).strftime('%d') # except: # return None # # def add_item(self, item): # item.date = self._convertunix(item.date) # if item.date == None: return # dt = datetime.fromtimestamp(item.date) # try: # item_day = dt.strftime('%d') # item_month = dt.strftime('%b') # item_year = dt.strftime('%Y') # except: # return # # key = self._DATES_KEYFORM.format(day=item_day,month=item_month, # year=item_year) # if key in self.timeline_dates: # self.timeline_dates[key].add_item(item) # else: # day_date = datetime.fromtimestamp(item.date).date() # day_tsmp = time.mktime(day_date.timetuple()) # timeline_date = TimelineDate( day_tsmp, item_day, item_month, # item_year, [item] ) # bisect.insort(self.items, timeline_date) # self.timeline_dates[key] = timeline_date # return # # def _get_beginning_ofmonth(self): # today = date.today() # fdmonth = date(today.year, today.month, 1) # return int(time.mktime(fdmonth.timetuple())) # # def get_items(self, start=None, end=None, force_month=False ): # if force_month == False: # if start == None and end == None: # return self.items # # start = self._convertunix(start) # end = self._convertunix(end) # # if start == None: # start = self._get_beginning_ofmonth() # if end == None: # end = int(time.time()) # print "Start: {}({}) end: {}({})".format(type(start),start,type(end),end) # res = [ i for i in self.items if i.day_timestamp >= start and # i.day_timestamp <= end ] # print "Got: {}".format(len(res)) # return res . Output only the next line.
self.timeline = Timeline()
Based on the snippet: <|code_start|>NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' class DataTypes(object): EMPTY = 0 DATA = 1 TEXT = 2 DATE = 3 class IApp(object): ''' classdocs ''' name = "Unknown" cname = "Unknown" databases = {} known = False dummyRE = type(re.compile("nfi")) version = [-1] def get_versions(self): return self.version def has_defaultversion(self): <|code_end|> , predict the immediate next line with the help of imports: import re from IDeviceVersion import IDeviceVersion and context (classes, functions, sometimes code) from other files: # Path: IDeviceVersion.py # class IDeviceVersion(object): # ''' # This class should be overwritten by individual system modules. These # modules should overwrite the 'populate_info' function in which they should # attempt to read application and platform versions using any means necessary. # These modules MUST eventually identify at least the platform version of the # device. # # The application_versions dictionary should contain the application name as # key and the application's version as value. # ''' # DEFAULT_VERSION = -1 # # name = "IDeviceVersion" # device_version = -1 # application_versions = {} # # def __init__(self, print_queue, mounts, store=None ): # self.print_queue = print_queue # self.mounts = mounts # self.store = store # # def populate_info(self): # raise NotImplementedError # # def selfprint(self,msg): # self.print_queue.put("[{}]: {}".format(self.name,msg)) # # def has_version(self,version): # if version in self.application_versions: # return True # return False # # def get_device_version(self): # return self.device_version # # def get_application_version(self, app_name): # if app_name in self.application_versions: # return self.application_versions[app_name] # return None # # def print_debug(self): # appversions = '\n'.join(["\t\t{}: {}".format(n,v) for n,v in # self.application_versions.iteritems()]) # self.selfprint(""" # Platform Version: {} # Application Versions:\n{} # """.format( self.device_version, appversions ) ) . Output only the next line.
if IDeviceVersion.DEFAULT_VERSION in self.version:
Next line prediction: <|code_start|>''' NFI -- Silensec's Nyuki Forensics Investigator Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. Juma Fredrick (j.fredrick[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' <|code_end|> . Use current file imports: (from IApp import IApp, KnownTable, DataTypes import ConvertUtils) and context including class names, function names, or small code snippets from other files: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 . Output only the next line.
class com_viber_voip(IApp):
Predict the next line for this snippet: <|code_start|>''' NFI -- Silensec's Nyuki Forensics Investigator Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. Juma Fredrick (j.fredrick[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' class com_viber_voip(IApp): name = "com.viber.voip" cname = "Android Viber Voip" databases = { "webviewCookiesChromium.db": [ <|code_end|> with the help of current file imports: from IApp import IApp, KnownTable, DataTypes import ConvertUtils and context from other files: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 , which may contain function names, class names, or code. Output only the next line.
KnownTable("cookies", None,
Using the snippet: <|code_start|>Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. Juma Fredrick (j.fredrick[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' class com_viber_voip(IApp): name = "com.viber.voip" cname = "Android Viber Voip" databases = { "webviewCookiesChromium.db": [ KnownTable("cookies", None, {"creation_utc":ConvertUtils.WebkitToUnix, "expires_utc":ConvertUtils.WebkitToUnix, "last_access_utc":ConvertUtils.WebkitToUnix }, <|code_end|> , determine the next line of code. You have imports: from IApp import IApp, KnownTable, DataTypes import ConvertUtils and context (class names, function names, or code) available: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 . Output only the next line.
{"creation_utc":DataTypes.DATE,
Based on the snippet: <|code_start|>''' NFI -- Silensec's Nyuki Forensics Investigator Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. Juma Fredrick (j.fredrick[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' <|code_end|> , predict the immediate next line with the help of imports: from IApp import IApp, KnownTable, DataTypes import ConvertUtils and context (classes, functions, sometimes code) from other files: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 . Output only the next line.
class com_android_deskclock(IApp):
Predict the next line after this snippet: <|code_start|>''' NFI -- Silensec's Nyuki Forensics Investigator Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. Juma Fredrick (j.fredrick[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' class com_android_deskclock(IApp): name = "com.android.deskclock" cname = "Android deskclock" databases = { "alarms.db": [ <|code_end|> using the current file's imports: from IApp import IApp, KnownTable, DataTypes import ConvertUtils and any relevant context from other files: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 . Output only the next line.
KnownTable("alarms", None,
Predict the next line after this snippet: <|code_start|> Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. Juma Fredrick (j.fredrick[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' class com_android_deskclock(IApp): name = "com.android.deskclock" cname = "Android deskclock" databases = { "alarms.db": [ KnownTable("alarms", None, {"alarmtime":ConvertUtils.JsToUnix}, <|code_end|> using the current file's imports: from IApp import IApp, KnownTable, DataTypes import ConvertUtils and any relevant context from other files: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 . Output only the next line.
{"alarmtime":DataTypes.DATE})
Here is a snippet: <|code_start|>''' NFI -- Silensec's Nyuki Forensics Investigator Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. Juma Fredrick (j.fredrick[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' <|code_end|> . Write the next line using the current file imports: from IApp import IApp, KnownTable, DataTypes import ConvertUtils and context from other files: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 , which may include functions, classes, or code. Output only the next line.
class com_android_vending(IApp):
Continue the code snippet: <|code_start|>''' NFI -- Silensec's Nyuki Forensics Investigator Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. Juma Fredrick (j.fredrick[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' class com_android_vending(IApp): name = "com.android.vending" cname = "Android Vending" databases = { "suggestions.db": [ <|code_end|> . Use current file imports: from IApp import IApp, KnownTable, DataTypes import ConvertUtils and context (classes, functions, or code) from other files: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 . Output only the next line.
KnownTable("suggestions", None,
Based on the snippet: <|code_start|>NFI -- Silensec's Nyuki Forensics Investigator Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. Juma Fredrick (j.fredrick[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' class com_android_vending(IApp): name = "com.android.vending" cname = "Android Vending" databases = { "suggestions.db": [ KnownTable("suggestions", None, {"date":ConvertUtils.JsToUnix }, <|code_end|> , predict the immediate next line with the help of imports: from IApp import IApp, KnownTable, DataTypes import ConvertUtils and context (classes, functions, sometimes code) from other files: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 . Output only the next line.
{"date":DataTypes.DATE })
Predict the next line for this snippet: <|code_start|>it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' class BoxType(): TYPE_DIV = 0 TYPE_PRE = 1 TYPE_TEXTBOX = 2 _box_formats = { TYPE_DIV : u"""<div class="{}">{}</div>""", TYPE_PRE : u"<pre>{}</pre>", TYPE_TEXTBOX : u"""<div class="textbox">{}</div>""" } class TimelineBox(object): ''' This plugin is similar to the TimelineMessage object with the only difference that it generates a box wrapping the text. ''' def __init__(self, box_type, box_class, format_string, *item_names): <|code_end|> with the help of current file imports: from TimelineDefn import TimelineMessage and context from other files: # Path: TimelineDefn.py # class TimelineMessage(object): # def __init__(self, format_string, *item_names): # """ # Create a message to be printed on the timeline event. # Arguments: # - format_string, the format string that will be used with .format # make sure that the parameters dont have any names # example: "Received call from contact {} with number {}" # - item_names, variable argument string arguments with the internal # names of the values we are looking for. # """ # self.format_string = format_string # self.item_names = item_names # # def construct_message(self, dataquery_item): # """ # Constructs the formatted message given the format this object was # initialized with. The dataquery_item must be a dictionary containing # a single timeline event. # # I thought about error checking fmt but that would hide the issue rather # than force people to re-write their definitions. So no error checking... # """ # args = [] # for name in self.item_names: # if name not in dataquery_item: # raise KeyError # args.append(dataquery_item[name]) # return self.format_string.format(*args) , which may contain function names, class names, or code. Output only the next line.
self.message = TimelineMessage( format_string, *item_names )
Predict the next line for this snippet: <|code_start|> """ The MiscParser is responsible for """ class MiscParser(object): parser_name = "MiscParser" print_queue = None store = None misc_definitions = None sub_parsers = { ParserType.TYPE_XML: parse_xml, ParserType.TYPE_REGEX: parse_regex, ParserType.TYPE_BINARY: parse_binary, ParserType.TYPE_SQLITE3: parse_sqlite } def __init__(self, print_queue=None,store=None, settings=None, versions=None): ''' Initialize the print_queue and specify a store if one is needed. If not then the class automatically creates a new instance ''' self.print_queue = print_queue if store == None: self.store = ExtractStore.ExtractStore() else: self.store = store imp = Importer() <|code_end|> with the help of current file imports: from IMiscSource import IMiscSource, ParserType from ParseHandlers import * from ModuleImporter import Importer import ExtractStore import os,re and context from other files: # Path: IMiscSource.py # class IMiscSource(object): # version = [] # catalog_id = Catalog.CATALOG_NONE # title = "Dummy Title" # relative_directories = [] # knownfiles = {} # # def __init__(self): # return # # def for_version(self,version): # #Empty version means DEFAULT # if len(self.version) == 0: # return True # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # if version in self.version: # return True # return False # # def get_max_depth(self): # return len(self.relative_directories) # # def get_relative_dir(self, depth=0): # if len(self.relative_directories) > depth: # return self.relative_directories[depth] # else: # return None # # class ParserType(object): # TYPE_UNKNOWN = 0 # TYPE_REGEX = 1 # TYPE_XML = 2 # TYPE_BINARY = 3 # TYPE_SQLITE3 = 4 # # Path: ModuleImporter.py # class Importer(object): # def __init__(self): # return # # def get_package_modules_dict(self, package_name, parent_obj, keyfield, # args=None ): # return self._load_dict( [package_name], package_name + u".", parent_obj, # keyfield, args) # # def get_package_modules(self, package_name, parent_obj, args=None ): # return self._load( [package_name], package_name + u".", parent_obj, # True, args ) # # def get_package_modules_list(self, package_name, parent_obj ): # return self._load( [package_name], package_name + u".", parent_obj ) # # def _load(self, path, prefix, parent_obj, instantiate=False, args=None ): # modules = [] # for _, name, is_package in walk_packages( path, prefix=prefix ): # if is_package: continue # module = import_module( name ) # for member in dir(module): # if member == parent_obj.__class__.__name__: continue # member_obj = getattr( module, member ) # if inspect.isclass( member_obj ) == False: continue # if issubclass( member_obj, parent_obj.__class__ ): # if instantiate: # if args != None: obj = member_obj(*args) # else: obj = member_obj() # modules.append( obj ) # else: # modules.append( member ) # return modules # # def _load_dict(self, path, prefix, parent_obj, keyfield, args=None ): # modules = {} # for _, name, is_package in walk_packages( path, prefix=prefix ): # if is_package: continue # module = import_module( name ) # for member in dir(module): # if member == parent_obj.__class__.__name__: continue # member_obj = getattr( module, member ) # if inspect.isclass( member_obj ) == False: continue # if issubclass( member_obj, parent_obj.__class__ ): # if args != None: tmpobj = member_obj(*args) # else: tmpobj = member_obj() # modules[getattr( tmpobj, keyfield )] = tmpobj # return modules , which may contain function names, class names, or code. Output only the next line.
defns = imp.get_package_modules( "AndroidMisc", IMiscSource() )
Here is a snippet: <|code_start|>Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' """ The MiscParser is responsible for """ class MiscParser(object): parser_name = "MiscParser" print_queue = None store = None misc_definitions = None sub_parsers = { <|code_end|> . Write the next line using the current file imports: from IMiscSource import IMiscSource, ParserType from ParseHandlers import * from ModuleImporter import Importer import ExtractStore import os,re and context from other files: # Path: IMiscSource.py # class IMiscSource(object): # version = [] # catalog_id = Catalog.CATALOG_NONE # title = "Dummy Title" # relative_directories = [] # knownfiles = {} # # def __init__(self): # return # # def for_version(self,version): # #Empty version means DEFAULT # if len(self.version) == 0: # return True # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # if version in self.version: # return True # return False # # def get_max_depth(self): # return len(self.relative_directories) # # def get_relative_dir(self, depth=0): # if len(self.relative_directories) > depth: # return self.relative_directories[depth] # else: # return None # # class ParserType(object): # TYPE_UNKNOWN = 0 # TYPE_REGEX = 1 # TYPE_XML = 2 # TYPE_BINARY = 3 # TYPE_SQLITE3 = 4 # # Path: ModuleImporter.py # class Importer(object): # def __init__(self): # return # # def get_package_modules_dict(self, package_name, parent_obj, keyfield, # args=None ): # return self._load_dict( [package_name], package_name + u".", parent_obj, # keyfield, args) # # def get_package_modules(self, package_name, parent_obj, args=None ): # return self._load( [package_name], package_name + u".", parent_obj, # True, args ) # # def get_package_modules_list(self, package_name, parent_obj ): # return self._load( [package_name], package_name + u".", parent_obj ) # # def _load(self, path, prefix, parent_obj, instantiate=False, args=None ): # modules = [] # for _, name, is_package in walk_packages( path, prefix=prefix ): # if is_package: continue # module = import_module( name ) # for member in dir(module): # if member == parent_obj.__class__.__name__: continue # member_obj = getattr( module, member ) # if inspect.isclass( member_obj ) == False: continue # if issubclass( member_obj, parent_obj.__class__ ): # if instantiate: # if args != None: obj = member_obj(*args) # else: obj = member_obj() # modules.append( obj ) # else: # modules.append( member ) # return modules # # def _load_dict(self, path, prefix, parent_obj, keyfield, args=None ): # modules = {} # for _, name, is_package in walk_packages( path, prefix=prefix ): # if is_package: continue # module = import_module( name ) # for member in dir(module): # if member == parent_obj.__class__.__name__: continue # member_obj = getattr( module, member ) # if inspect.isclass( member_obj ) == False: continue # if issubclass( member_obj, parent_obj.__class__ ): # if args != None: tmpobj = member_obj(*args) # else: tmpobj = member_obj() # modules[getattr( tmpobj, keyfield )] = tmpobj # return modules , which may include functions, classes, or code. Output only the next line.
ParserType.TYPE_XML: parse_xml,
Given snippet: <|code_start|>''' """ The MiscParser is responsible for """ class MiscParser(object): parser_name = "MiscParser" print_queue = None store = None misc_definitions = None sub_parsers = { ParserType.TYPE_XML: parse_xml, ParserType.TYPE_REGEX: parse_regex, ParserType.TYPE_BINARY: parse_binary, ParserType.TYPE_SQLITE3: parse_sqlite } def __init__(self, print_queue=None,store=None, settings=None, versions=None): ''' Initialize the print_queue and specify a store if one is needed. If not then the class automatically creates a new instance ''' self.print_queue = print_queue if store == None: self.store = ExtractStore.ExtractStore() else: self.store = store <|code_end|> , continue by predicting the next line. Consider current file imports: from IMiscSource import IMiscSource, ParserType from ParseHandlers import * from ModuleImporter import Importer import ExtractStore import os,re and context: # Path: IMiscSource.py # class IMiscSource(object): # version = [] # catalog_id = Catalog.CATALOG_NONE # title = "Dummy Title" # relative_directories = [] # knownfiles = {} # # def __init__(self): # return # # def for_version(self,version): # #Empty version means DEFAULT # if len(self.version) == 0: # return True # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # if version in self.version: # return True # return False # # def get_max_depth(self): # return len(self.relative_directories) # # def get_relative_dir(self, depth=0): # if len(self.relative_directories) > depth: # return self.relative_directories[depth] # else: # return None # # class ParserType(object): # TYPE_UNKNOWN = 0 # TYPE_REGEX = 1 # TYPE_XML = 2 # TYPE_BINARY = 3 # TYPE_SQLITE3 = 4 # # Path: ModuleImporter.py # class Importer(object): # def __init__(self): # return # # def get_package_modules_dict(self, package_name, parent_obj, keyfield, # args=None ): # return self._load_dict( [package_name], package_name + u".", parent_obj, # keyfield, args) # # def get_package_modules(self, package_name, parent_obj, args=None ): # return self._load( [package_name], package_name + u".", parent_obj, # True, args ) # # def get_package_modules_list(self, package_name, parent_obj ): # return self._load( [package_name], package_name + u".", parent_obj ) # # def _load(self, path, prefix, parent_obj, instantiate=False, args=None ): # modules = [] # for _, name, is_package in walk_packages( path, prefix=prefix ): # if is_package: continue # module = import_module( name ) # for member in dir(module): # if member == parent_obj.__class__.__name__: continue # member_obj = getattr( module, member ) # if inspect.isclass( member_obj ) == False: continue # if issubclass( member_obj, parent_obj.__class__ ): # if instantiate: # if args != None: obj = member_obj(*args) # else: obj = member_obj() # modules.append( obj ) # else: # modules.append( member ) # return modules # # def _load_dict(self, path, prefix, parent_obj, keyfield, args=None ): # modules = {} # for _, name, is_package in walk_packages( path, prefix=prefix ): # if is_package: continue # module = import_module( name ) # for member in dir(module): # if member == parent_obj.__class__.__name__: continue # member_obj = getattr( module, member ) # if inspect.isclass( member_obj ) == False: continue # if issubclass( member_obj, parent_obj.__class__ ): # if args != None: tmpobj = member_obj(*args) # else: tmpobj = member_obj() # modules[getattr( tmpobj, keyfield )] = tmpobj # return modules which might include code, classes, or functions. Output only the next line.
imp = Importer()
Predict the next line after this snippet: <|code_start|>''' NFI -- Silensec's Nyuki Forensics Investigator Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. Juma Fredrick (j.fredrick[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' <|code_end|> using the current file's imports: from IApp import IApp, KnownTable, DataTypes import ConvertUtils and any relevant context from other files: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 . Output only the next line.
class com_skype_raider(IApp):
Based on the snippet: <|code_start|>Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. Juma Fredrick (j.fredrick[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' class com_skype_raider(IApp): name = 'com.skype.raider' cname = 'Android Skype' databases = { 'queue.db': [ <|code_end|> , predict the immediate next line with the help of imports: from IApp import IApp, KnownTable, DataTypes import ConvertUtils and context (classes, functions, sometimes code) from other files: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 . Output only the next line.
KnownTable('history', None,
Given snippet: <|code_start|> Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' class com_skype_raider(IApp): name = 'com.skype.raider' cname = 'Android Skype' databases = { 'queue.db': [ KnownTable('history', None, {'stored_time': ConvertUtils.UnixTimestamp, 'started_time': ConvertUtils.UnixTimestamp, 'completed_time': ConvertUtils.UnixTimestamp}, <|code_end|> , continue by predicting the next line. Consider current file imports: from IApp import IApp, KnownTable, DataTypes import ConvertUtils and context: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 which might include code, classes, or functions. Output only the next line.
{'stored_time': DataTypes.DATE,
Based on the snippet: <|code_start|>''' NFI -- Silensec's Nyuki Forensics Investigator Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. Juma Fredrick (j.fredrick[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' <|code_end|> , predict the immediate next line with the help of imports: from IApp import IApp, KnownTable, DataTypes import ConvertUtils and context (classes, functions, sometimes code) from other files: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 . Output only the next line.
class com_google_android_gallery3d(IApp):
Given snippet: <|code_start|>''' NFI -- Silensec's Nyuki Forensics Investigator Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. Juma Fredrick (j.fredrick[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' class com_google_android_gallery3d(IApp): name = "com.google.android.gallery3d" cname = "Google android Gallery3d" databases = { "picasa.db": [ <|code_end|> , continue by predicting the next line. Consider current file imports: from IApp import IApp, KnownTable, DataTypes import ConvertUtils and context: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 which might include code, classes, or functions. Output only the next line.
KnownTable("albums", None,
Next line prediction: <|code_start|>Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. Juma Fredrick (j.fredrick[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' class com_google_android_gallery3d(IApp): name = "com.google.android.gallery3d" cname = "Google android Gallery3d" databases = { "picasa.db": [ KnownTable("albums", None, {"date_updated":ConvertUtils.JsToUnix, "date_published":ConvertUtils.JsToUnix, "date_edited":ConvertUtils.JsToUnix }, <|code_end|> . Use current file imports: (from IApp import IApp, KnownTable, DataTypes import ConvertUtils) and context including class names, function names, or small code snippets from other files: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 . Output only the next line.
{"date_updated":DataTypes.DATE,
Based on the snippet: <|code_start|>''' NFI -- Silensec's Nyuki Forensics Investigator Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. Juma Fredrick (j.fredrick[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' <|code_end|> , predict the immediate next line with the help of imports: from IApp import IApp, KnownTable, DataTypes import ConvertUtils and context (classes, functions, sometimes code) from other files: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 . Output only the next line.
class com_facebook_katana(IApp):
Based on the snippet: <|code_start|>''' NFI -- Silensec's Nyuki Forensics Investigator Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. Juma Fredrick (j.fredrick[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' class com_facebook_katana(IApp): name = "com.facebook.katana" cname = "Android Facebook Katana" databases = { "newsfeed_db": [ <|code_end|> , predict the immediate next line with the help of imports: from IApp import IApp, KnownTable, DataTypes import ConvertUtils and context (classes, functions, sometimes code) from other files: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 . Output only the next line.
KnownTable("home_stories", None,
Given snippet: <|code_start|> Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. Juma Fredrick (j.fredrick[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' class com_facebook_katana(IApp): name = "com.facebook.katana" cname = "Android Facebook Katana" databases = { "newsfeed_db": [ KnownTable("home_stories", None, {"fetched_at":ConvertUtils.JsToUnix}, <|code_end|> , continue by predicting the next line. Consider current file imports: from IApp import IApp, KnownTable, DataTypes import ConvertUtils and context: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 which might include code, classes, or functions. Output only the next line.
{"fetched_at":DataTypes.DATE}),
Here is a snippet: <|code_start|>''' NFI -- Silensec's Nyuki Forensics Investigator Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' <|code_end|> . Write the next line using the current file imports: from IApp import IApp, KnownTable, DataTypes import ConvertUtils and context from other files: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 , which may include functions, classes, or code. Output only the next line.
class com_android_browser(IApp):
Using the snippet: <|code_start|>''' NFI -- Silensec's Nyuki Forensics Investigator Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' class com_android_browser(IApp): name = "com.android.browser" cname = "Android Browser" databases = { "browser2.db": [ <|code_end|> , determine the next line of code. You have imports: from IApp import IApp, KnownTable, DataTypes import ConvertUtils and context (class names, function names, or code) available: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 . Output only the next line.
KnownTable("history", None,
Next line prediction: <|code_start|>''' NFI -- Silensec's Nyuki Forensics Investigator Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' class com_android_browser(IApp): name = "com.android.browser" cname = "Android Browser" databases = { "browser2.db": [ KnownTable("history", None, {"date":ConvertUtils.JsToUnix}, <|code_end|> . Use current file imports: (from IApp import IApp, KnownTable, DataTypes import ConvertUtils) and context including class names, function names, or small code snippets from other files: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 . Output only the next line.
{"date":DataTypes.DATE}),
Predict the next line after this snippet: <|code_start|>''' NFI -- Silensec's Nyuki Forensics Investigator Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. Juma Fredrick (j.fredrick[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' <|code_end|> using the current file's imports: from IApp import IApp, KnownTable, DataTypes import ConvertUtils and any relevant context from other files: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 . Output only the next line.
class com_android_inputmethod_latin(IApp):
Based on the snippet: <|code_start|>''' NFI -- Silensec's Nyuki Forensics Investigator Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. Juma Fredrick (j.fredrick[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' class com_android_inputmethod_latin(IApp): name = "com.android.inputmethod.latin" cname = "Android Inputmethod" databases = { "pendingUpdates": [ <|code_end|> , predict the immediate next line with the help of imports: from IApp import IApp, KnownTable, DataTypes import ConvertUtils and context (classes, functions, sometimes code) from other files: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 . Output only the next line.
KnownTable("pendingupdates", None,
Given the following code snippet before the placeholder: <|code_start|>NFI -- Silensec's Nyuki Forensics Investigator Copyright (C) 2014 George Nicolaou (george[at]silensec[dot]com) Silensec Ltd. Juma Fredrick (j.fredrick[at]silensec[dot]com) Silensec Ltd. This file is part of Nyuki Forensics Investigator (NFI). NFI is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. NFI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NFI. If not, see <http://www.gnu.org/licenses/>. ''' class com_android_inputmethod_latin(IApp): name = "com.android.inputmethod.latin" cname = "Android Inputmethod" databases = { "pendingUpdates": [ KnownTable("pendingupdates", None, {"date":ConvertUtils.UnixTimestamp }, <|code_end|> , predict the next line using imports from the current file: from IApp import IApp, KnownTable, DataTypes import ConvertUtils and context including class names, function names, and sometimes code from other files: # Path: IApp.py # class IApp(object): # ''' # classdocs # ''' # name = "Unknown" # cname = "Unknown" # databases = {} # known = False # dummyRE = type(re.compile("nfi")) # version = [-1] # # def get_versions(self): # return self.version # # def has_defaultversion(self): # if IDeviceVersion.DEFAULT_VERSION in self.version: # return True # return False # # def has_version(self,appversion): # if appversion in self.version: # return True # return False # # def get_packagename(self): # return self.name # # def get_canonicalname(self): # return self.cname # # def get_files(self): # return self.databases # # def get_file_info(self, dbname): # if len(self.databases) == 0: # return None # for thisdbname,defn in self.databases.iteritems(): # if type(thisdbname) == type("str"): # if thisdbname == dbname: # return defn # elif type(thisdbname) == self.dummyRE: # if thisdbname.match(dbname) != None: # return defn # return None # # def set_packagename(self, name): # self.name = name # # def __init__(self): # return # # class KnownTable(object): # name = None # sql = None # converter = None # knownfields = None # def __init__(self, table_name, parse_sql, converter=None, knownfields=None ): # self.name = table_name # self.sql = parse_sql # self.converter = converter # self.knownfields = knownfields # # class DataTypes(object): # EMPTY = 0 # DATA = 1 # TEXT = 2 # DATE = 3 . Output only the next line.
{"date":DataTypes.DATE })
Using the snippet: <|code_start|> logger = logging.getLogger(__name__) class FileBrowser(BaseView, FormView): """ Browse live filesystem using python os stdlib """ template_name = 'file_list.html' headline = 'File Browser' <|code_end|> , determine the next line of code. You have imports: from collections import defaultdict from datetime import datetime from pathlib import Path from django.core.urlresolvers import reverse_lazy from vanilla import TemplateView, FormView from ..models import IconMapping from ..forms import FileBrowserForm from ..utils.zfs import ZFSUtil from ..views.base import BaseView import logging import magic and context (class names, function names, or code) available: # Path: nasman/snapshots/models.py # class IconMapping(models.Model): # """ # Model to manage icon mapping to mimetypes # """ # icon = IconField( # 'icon', # default='fa-file-o' # ) # mime_type = models.CharField( # 'mime-type', # max_length=255, # primary_key=True, # db_index=True # ) # # class Meta: # app_label = 'snapshots' # # def __str__(self): # return self.mime_type # # Path: nasman/snapshots/forms.py # class FileBrowserForm(forms.Form): # filesystem = FilesystemField( # choices=filesystem_choices, # widget=SmallSelectWidget() # ) # snapshot = SnapshotField(widget=forms.HiddenInput) # path = PathField(widget=forms.HiddenInput) # # Path: nasman/snapshots/utils/zfs.py # class ZFSUtil(BaseUtil): # """ # Helper utility for accessing ZFS features # """ # # @classmethod # def get_filesystems(cls): # """ # Gets a list of filesystems # :return: A list of `ZFSFilesystem` objects # :rtype: list # """ # parsed = _parse_cmd_output( # ['zfs', 'list', '-Hp', '-tfilesystem', '-oname,mountpoint'] # ) # if parsed is None: # return None # filesystems = [] # for fs in parsed: # filesystems.append( # ZFSFilesystem( # fs[0], # fs[1] # ) # ) # return filesystems # # @classmethod # def get_snapshots(cls, refresh=False): # """ # Gets a list of snapshots # :return: A list of `ZFSSnapshot` # :rtype: list # """ # cached = cache.get('zfs-snapshots') # if not refresh and cached is not None: # logger.info('Returning cached list') # return cached # parsed = _parse_cmd_output( # ['zfs', 'list', '-Hp', '-tsnap', '-oname,creation'] # ) # if parsed is None: # return None # snaps = [] # for snap in parsed: # ts = datetime.fromtimestamp(int(snap[1])) # ts = pytz.timezone(cls.timezone_name).localize(ts) # snaps.append( # ZFSSnapshot( # snap[0], # ts # ) # ) # cache.set('zfs-snapshots', snaps, 43200) # logger.info('Refreshed list of snapshots {}'.format(snaps)) # return snaps # # @classmethod # def get_filesystem(cls, fs_name): # """ # Gets a filesystem by name # :param fs_name: Name of the filesystem to get # :type fs_name: basestring # :return: A `ZFSFilesystem` # :rtype: `nasman.snapshots.zfs.ZFSFilesystem` # """ # parsed = _parse_cmd_output( # ['zfs', # 'list', # '-Hp', # '-tfilesystem', # '-oname,mountpoint', # fs_name] # ) # if parsed is None: # return None # return ZFSFilesystem(parsed[0][0], parsed[0][1]) # # @classmethod # def get_snapshot(cls, snap_name): # """ # Gets a snapshot by name # :param snap_name: Name of the snapshot to get # :type snap_name: basestring # :return: A `ZFSSnapshot` # :rtype: `nasman.snapshots.zfs.ZFSSnapshot` # """ # parsed = _parse_cmd_output( # ['zfs', # 'list', # '-Hp', # '-tsnap', # '-oname,creation', # snap_name] # ) # if parsed is None: # return None # return ZFSSnapshot(parsed[0][0], parsed[0][1]) # # @classmethod # def create_snapshot(cls, snap_name, fs_name, recurse): # """ # Creates a snapshot # :param snap_name: Name of the snapshot to create # :type snap_name: str # :param fs_name: Name of the filesystem to take snapshot of # :type fs_name: str # :param recurse: Whether to recurse filesystems # :type recurse: bool # :return: The snapshot just created # :rtype: `nasman.snapshots.zfs.ZFSSnapshot` # """ # cache.delete('zfs-snapshots') # full_name = '{0}@{1}'.format( # fs_name, # snap_name # ) # cmd = ['zfs', # 'snapshot', # full_name # ] # if recurse: # cmd.append('-r') # parsed = _parse_cmd_output(cmd) # if parsed is None: # return None # return cls.get_snapshot(full_name) # # Path: nasman/snapshots/views/base.py # class BaseView(SetHeadlineMixin): # pass . Output only the next line.
form_class = FileBrowserForm
Here is a snippet: <|code_start|> }) object_list.sort(key=lambda k: (not k['directory'], k['name'])) # Path breadcrumbs breadcrumbs = sorted(path.parents) + [path] # The up one '..' link up_one = None if path != root: up_one = path.parent # TODO: context relevant snapshot list context.update({ 'up_one': up_one, 'files_list': object_list, 'path': breadcrumbs, 'browser_title': breadcrumbs[-1], }) return context def form_valid(self, form): return self.form_invalid(form) class FilesystemList(BaseView, TemplateView): template_name = 'filesystem_list.html' headline = 'ZFS Filesystems' def get_context_data(self, **kwargs): context = super(FilesystemList, self).get_context_data() <|code_end|> . Write the next line using the current file imports: from collections import defaultdict from datetime import datetime from pathlib import Path from django.core.urlresolvers import reverse_lazy from vanilla import TemplateView, FormView from ..models import IconMapping from ..forms import FileBrowserForm from ..utils.zfs import ZFSUtil from ..views.base import BaseView import logging import magic and context from other files: # Path: nasman/snapshots/models.py # class IconMapping(models.Model): # """ # Model to manage icon mapping to mimetypes # """ # icon = IconField( # 'icon', # default='fa-file-o' # ) # mime_type = models.CharField( # 'mime-type', # max_length=255, # primary_key=True, # db_index=True # ) # # class Meta: # app_label = 'snapshots' # # def __str__(self): # return self.mime_type # # Path: nasman/snapshots/forms.py # class FileBrowserForm(forms.Form): # filesystem = FilesystemField( # choices=filesystem_choices, # widget=SmallSelectWidget() # ) # snapshot = SnapshotField(widget=forms.HiddenInput) # path = PathField(widget=forms.HiddenInput) # # Path: nasman/snapshots/utils/zfs.py # class ZFSUtil(BaseUtil): # """ # Helper utility for accessing ZFS features # """ # # @classmethod # def get_filesystems(cls): # """ # Gets a list of filesystems # :return: A list of `ZFSFilesystem` objects # :rtype: list # """ # parsed = _parse_cmd_output( # ['zfs', 'list', '-Hp', '-tfilesystem', '-oname,mountpoint'] # ) # if parsed is None: # return None # filesystems = [] # for fs in parsed: # filesystems.append( # ZFSFilesystem( # fs[0], # fs[1] # ) # ) # return filesystems # # @classmethod # def get_snapshots(cls, refresh=False): # """ # Gets a list of snapshots # :return: A list of `ZFSSnapshot` # :rtype: list # """ # cached = cache.get('zfs-snapshots') # if not refresh and cached is not None: # logger.info('Returning cached list') # return cached # parsed = _parse_cmd_output( # ['zfs', 'list', '-Hp', '-tsnap', '-oname,creation'] # ) # if parsed is None: # return None # snaps = [] # for snap in parsed: # ts = datetime.fromtimestamp(int(snap[1])) # ts = pytz.timezone(cls.timezone_name).localize(ts) # snaps.append( # ZFSSnapshot( # snap[0], # ts # ) # ) # cache.set('zfs-snapshots', snaps, 43200) # logger.info('Refreshed list of snapshots {}'.format(snaps)) # return snaps # # @classmethod # def get_filesystem(cls, fs_name): # """ # Gets a filesystem by name # :param fs_name: Name of the filesystem to get # :type fs_name: basestring # :return: A `ZFSFilesystem` # :rtype: `nasman.snapshots.zfs.ZFSFilesystem` # """ # parsed = _parse_cmd_output( # ['zfs', # 'list', # '-Hp', # '-tfilesystem', # '-oname,mountpoint', # fs_name] # ) # if parsed is None: # return None # return ZFSFilesystem(parsed[0][0], parsed[0][1]) # # @classmethod # def get_snapshot(cls, snap_name): # """ # Gets a snapshot by name # :param snap_name: Name of the snapshot to get # :type snap_name: basestring # :return: A `ZFSSnapshot` # :rtype: `nasman.snapshots.zfs.ZFSSnapshot` # """ # parsed = _parse_cmd_output( # ['zfs', # 'list', # '-Hp', # '-tsnap', # '-oname,creation', # snap_name] # ) # if parsed is None: # return None # return ZFSSnapshot(parsed[0][0], parsed[0][1]) # # @classmethod # def create_snapshot(cls, snap_name, fs_name, recurse): # """ # Creates a snapshot # :param snap_name: Name of the snapshot to create # :type snap_name: str # :param fs_name: Name of the filesystem to take snapshot of # :type fs_name: str # :param recurse: Whether to recurse filesystems # :type recurse: bool # :return: The snapshot just created # :rtype: `nasman.snapshots.zfs.ZFSSnapshot` # """ # cache.delete('zfs-snapshots') # full_name = '{0}@{1}'.format( # fs_name, # snap_name # ) # cmd = ['zfs', # 'snapshot', # full_name # ] # if recurse: # cmd.append('-r') # parsed = _parse_cmd_output(cmd) # if parsed is None: # return None # return cls.get_snapshot(full_name) # # Path: nasman/snapshots/views/base.py # class BaseView(SetHeadlineMixin): # pass , which may include functions, classes, or code. Output only the next line.
context['object_list'] = ZFSUtil.get_filesystems()
Given the code snippet: <|code_start|> def mount(self): """ If this file system is not already mounted, mount it using ZFS """ try: _parse_cmd_output( ['zfs', 'mount', self.name] ) except CalledProcessError as e: if 'already mounted' in str(e.output): return True raise return True def unmount(self): """ If this filesystem is mounted, unmount it using ZFS """ if not self.is_mounted: return True parsed = _parse_cmd_output( ['zfs', 'unmount', self.name] ) return True def __repr__(self): return self.name <|code_end|> , generate the next line using the imports in this file: from datetime import datetime from subprocess import check_output, CalledProcessError, STDOUT from pathlib import Path from django.core.cache import cache from .base import BaseUtil, BaseFilesystem, BaseSnapshot import logging import pytz and context (functions, classes, or occasionally code) from other files: # Path: nasman/snapshots/utils/base.py # class BaseUtil(metaclass=abc.ABCMeta): # timezone_name = get_default_timezone_name() # # @classmethod # @abc.abstractmethod # def get_filesystems(cls): # """ # Gets a list of filesystems # :return: A list of `BaseFilesystem` objects # :rtype: list # """ # # @classmethod # @abc.abstractmethod # def get_snapshots(cls): # """ # Gets a list of snapshots # :return: A list of `BaseSnapshot` # :rtype: list # """ # # class BaseFilesystem(metaclass=abc.ABCMeta): # # def __init__(self, name, mountpoint=''): # self._name = name # self._mountpoint = mountpoint # # @property # @abc.abstractmethod # def name(self): # """ # :return: The name of the filesystem # :rtype: basestring # """ # # @property # @abc.abstractmethod # def mountpoint(self): # """ # :return: The mountpoint of the filesystem # :rtype: basestring # """ # # class BaseSnapshot(metaclass=abc.ABCMeta): # # def __init__(self, name, timestamp=None, filesystem=None): # self._name = name # self._filesystem = filesystem # if timestamp is not None: # self._timestamp = timestamp # else: # self._timestamp = now() # # @property # @abc.abstractmethod # def name(self): # """ # :return: The name of the snapshot # :rtype: basestring # """ # # @property # @abc.abstractmethod # def timestamp(self): # """ # :return: The creation time of this snapshot # :rtype: `datetime.datetime` # """ # # @property # @abc.abstractmethod # def filesystem(self): # """ # :return: The parent filesystem of this snapshot # :rtype: `BaseFilesystem` # """ . Output only the next line.
class ZFSUtil(BaseUtil):
Given the following code snippet before the placeholder: <|code_start|> def mount(self): """ If this snapshot is not already mounted, mount it under /tmp """ if self.is_mounted: return True mountpoint = self.mountpoint if not mountpoint.exists(): self.mountpoint.mkdir(parents=True) parsed = _parse_cmd_output( ['mount', '-tzfs', self.name, str(mountpoint)] ) return True def unmount(self): """ If this snapshot it mounted, unmount it """ if not self.is_mounted: return True mountpoint = self.mountpoint parsed = _parse_cmd_output( ['umount', str(mountpoint)] ) return True def __repr__(self): return self.name <|code_end|> , predict the next line using imports from the current file: from datetime import datetime from subprocess import check_output, CalledProcessError, STDOUT from pathlib import Path from django.core.cache import cache from .base import BaseUtil, BaseFilesystem, BaseSnapshot import logging import pytz and context including class names, function names, and sometimes code from other files: # Path: nasman/snapshots/utils/base.py # class BaseUtil(metaclass=abc.ABCMeta): # timezone_name = get_default_timezone_name() # # @classmethod # @abc.abstractmethod # def get_filesystems(cls): # """ # Gets a list of filesystems # :return: A list of `BaseFilesystem` objects # :rtype: list # """ # # @classmethod # @abc.abstractmethod # def get_snapshots(cls): # """ # Gets a list of snapshots # :return: A list of `BaseSnapshot` # :rtype: list # """ # # class BaseFilesystem(metaclass=abc.ABCMeta): # # def __init__(self, name, mountpoint=''): # self._name = name # self._mountpoint = mountpoint # # @property # @abc.abstractmethod # def name(self): # """ # :return: The name of the filesystem # :rtype: basestring # """ # # @property # @abc.abstractmethod # def mountpoint(self): # """ # :return: The mountpoint of the filesystem # :rtype: basestring # """ # # class BaseSnapshot(metaclass=abc.ABCMeta): # # def __init__(self, name, timestamp=None, filesystem=None): # self._name = name # self._filesystem = filesystem # if timestamp is not None: # self._timestamp = timestamp # else: # self._timestamp = now() # # @property # @abc.abstractmethod # def name(self): # """ # :return: The name of the snapshot # :rtype: basestring # """ # # @property # @abc.abstractmethod # def timestamp(self): # """ # :return: The creation time of this snapshot # :rtype: `datetime.datetime` # """ # # @property # @abc.abstractmethod # def filesystem(self): # """ # :return: The parent filesystem of this snapshot # :rtype: `BaseFilesystem` # """ . Output only the next line.
class ZFSFilesystem(BaseFilesystem):
Given the code snippet: <|code_start|> logger = logging.getLogger(__name__) def _parse_cmd_output(cmd): """ Run the given arguments as a subprocess, and spilt the output into lines and columns :param cmd: The command arguments to run :type cmd: list :return: The parsed output :rtype: list """ try: output = check_output(cmd, stderr=STDOUT) except CalledProcessError as e: logger.error('Failed to pass command %s', ' '.join(cmd)) logger.error('Output was %s', e.output) raise return [x.split() for x in output.decode('utf-8').splitlines()] <|code_end|> , generate the next line using the imports in this file: from datetime import datetime from subprocess import check_output, CalledProcessError, STDOUT from pathlib import Path from django.core.cache import cache from .base import BaseUtil, BaseFilesystem, BaseSnapshot import logging import pytz and context (functions, classes, or occasionally code) from other files: # Path: nasman/snapshots/utils/base.py # class BaseUtil(metaclass=abc.ABCMeta): # timezone_name = get_default_timezone_name() # # @classmethod # @abc.abstractmethod # def get_filesystems(cls): # """ # Gets a list of filesystems # :return: A list of `BaseFilesystem` objects # :rtype: list # """ # # @classmethod # @abc.abstractmethod # def get_snapshots(cls): # """ # Gets a list of snapshots # :return: A list of `BaseSnapshot` # :rtype: list # """ # # class BaseFilesystem(metaclass=abc.ABCMeta): # # def __init__(self, name, mountpoint=''): # self._name = name # self._mountpoint = mountpoint # # @property # @abc.abstractmethod # def name(self): # """ # :return: The name of the filesystem # :rtype: basestring # """ # # @property # @abc.abstractmethod # def mountpoint(self): # """ # :return: The mountpoint of the filesystem # :rtype: basestring # """ # # class BaseSnapshot(metaclass=abc.ABCMeta): # # def __init__(self, name, timestamp=None, filesystem=None): # self._name = name # self._filesystem = filesystem # if timestamp is not None: # self._timestamp = timestamp # else: # self._timestamp = now() # # @property # @abc.abstractmethod # def name(self): # """ # :return: The name of the snapshot # :rtype: basestring # """ # # @property # @abc.abstractmethod # def timestamp(self): # """ # :return: The creation time of this snapshot # :rtype: `datetime.datetime` # """ # # @property # @abc.abstractmethod # def filesystem(self): # """ # :return: The parent filesystem of this snapshot # :rtype: `BaseFilesystem` # """ . Output only the next line.
class ZFSSnapshot(BaseSnapshot):
Here is a snippet: <|code_start|> logger = logging.getLogger(__name__) class SnapshotCreate(MessageMixin, BaseView, FormView): headline = 'Create new snapshot' <|code_end|> . Write the next line using the current file imports: import logging from subprocess import CalledProcessError from braces.views import MessageMixin, JSONResponseMixin, AjaxResponseMixin from django.contrib.humanize.templatetags.humanize import naturaltime from django.core.urlresolvers import reverse_lazy from django.shortcuts import redirect from django.views.generic import View from vanilla import FormView, ListView from ..forms import SnapshotForm from .base import BaseView from .. import tasks from ..utils.zfs import ZFSUtil and context from other files: # Path: nasman/snapshots/forms.py # class SnapshotForm(forms.Form): # name = forms.CharField( # label='Snapshot name', # max_length=120, # required=True, # widget=BootstrapTextWidget, # ) # filesystem = forms.TypedChoiceField( # label='Parent filesystem', # choices=filesystem_choices, # widget=BootstrapSelectWidget, # ) # recursive = forms.BooleanField( # label='Recurse filesystems?', # widget=BootstrapCheckboxWidget, # required=False, # ) # # Path: nasman/snapshots/views/base.py # class BaseView(SetHeadlineMixin): # pass # # Path: nasman/snapshots/utils/zfs.py # class ZFSUtil(BaseUtil): # """ # Helper utility for accessing ZFS features # """ # # @classmethod # def get_filesystems(cls): # """ # Gets a list of filesystems # :return: A list of `ZFSFilesystem` objects # :rtype: list # """ # parsed = _parse_cmd_output( # ['zfs', 'list', '-Hp', '-tfilesystem', '-oname,mountpoint'] # ) # if parsed is None: # return None # filesystems = [] # for fs in parsed: # filesystems.append( # ZFSFilesystem( # fs[0], # fs[1] # ) # ) # return filesystems # # @classmethod # def get_snapshots(cls, refresh=False): # """ # Gets a list of snapshots # :return: A list of `ZFSSnapshot` # :rtype: list # """ # cached = cache.get('zfs-snapshots') # if not refresh and cached is not None: # logger.info('Returning cached list') # return cached # parsed = _parse_cmd_output( # ['zfs', 'list', '-Hp', '-tsnap', '-oname,creation'] # ) # if parsed is None: # return None # snaps = [] # for snap in parsed: # ts = datetime.fromtimestamp(int(snap[1])) # ts = pytz.timezone(cls.timezone_name).localize(ts) # snaps.append( # ZFSSnapshot( # snap[0], # ts # ) # ) # cache.set('zfs-snapshots', snaps, 43200) # logger.info('Refreshed list of snapshots {}'.format(snaps)) # return snaps # # @classmethod # def get_filesystem(cls, fs_name): # """ # Gets a filesystem by name # :param fs_name: Name of the filesystem to get # :type fs_name: basestring # :return: A `ZFSFilesystem` # :rtype: `nasman.snapshots.zfs.ZFSFilesystem` # """ # parsed = _parse_cmd_output( # ['zfs', # 'list', # '-Hp', # '-tfilesystem', # '-oname,mountpoint', # fs_name] # ) # if parsed is None: # return None # return ZFSFilesystem(parsed[0][0], parsed[0][1]) # # @classmethod # def get_snapshot(cls, snap_name): # """ # Gets a snapshot by name # :param snap_name: Name of the snapshot to get # :type snap_name: basestring # :return: A `ZFSSnapshot` # :rtype: `nasman.snapshots.zfs.ZFSSnapshot` # """ # parsed = _parse_cmd_output( # ['zfs', # 'list', # '-Hp', # '-tsnap', # '-oname,creation', # snap_name] # ) # if parsed is None: # return None # return ZFSSnapshot(parsed[0][0], parsed[0][1]) # # @classmethod # def create_snapshot(cls, snap_name, fs_name, recurse): # """ # Creates a snapshot # :param snap_name: Name of the snapshot to create # :type snap_name: str # :param fs_name: Name of the filesystem to take snapshot of # :type fs_name: str # :param recurse: Whether to recurse filesystems # :type recurse: bool # :return: The snapshot just created # :rtype: `nasman.snapshots.zfs.ZFSSnapshot` # """ # cache.delete('zfs-snapshots') # full_name = '{0}@{1}'.format( # fs_name, # snap_name # ) # cmd = ['zfs', # 'snapshot', # full_name # ] # if recurse: # cmd.append('-r') # parsed = _parse_cmd_output(cmd) # if parsed is None: # return None # return cls.get_snapshot(full_name) , which may include functions, classes, or code. Output only the next line.
form_class = SnapshotForm
Given snippet: <|code_start|> logger = logging.getLogger(__name__) class SnapshotCreate(MessageMixin, BaseView, FormView): headline = 'Create new snapshot' form_class = SnapshotForm template_name = 'snapshot_form.html' success_url = reverse_lazy('nasman:snapshots') def form_valid(self, form): snap_name = form.cleaned_data['name'] fs_name = form.cleaned_data['filesystem'] recurse = form.cleaned_data['recursive'] try: <|code_end|> , continue by predicting the next line. Consider current file imports: import logging from subprocess import CalledProcessError from braces.views import MessageMixin, JSONResponseMixin, AjaxResponseMixin from django.contrib.humanize.templatetags.humanize import naturaltime from django.core.urlresolvers import reverse_lazy from django.shortcuts import redirect from django.views.generic import View from vanilla import FormView, ListView from ..forms import SnapshotForm from .base import BaseView from .. import tasks from ..utils.zfs import ZFSUtil and context: # Path: nasman/snapshots/forms.py # class SnapshotForm(forms.Form): # name = forms.CharField( # label='Snapshot name', # max_length=120, # required=True, # widget=BootstrapTextWidget, # ) # filesystem = forms.TypedChoiceField( # label='Parent filesystem', # choices=filesystem_choices, # widget=BootstrapSelectWidget, # ) # recursive = forms.BooleanField( # label='Recurse filesystems?', # widget=BootstrapCheckboxWidget, # required=False, # ) # # Path: nasman/snapshots/views/base.py # class BaseView(SetHeadlineMixin): # pass # # Path: nasman/snapshots/utils/zfs.py # class ZFSUtil(BaseUtil): # """ # Helper utility for accessing ZFS features # """ # # @classmethod # def get_filesystems(cls): # """ # Gets a list of filesystems # :return: A list of `ZFSFilesystem` objects # :rtype: list # """ # parsed = _parse_cmd_output( # ['zfs', 'list', '-Hp', '-tfilesystem', '-oname,mountpoint'] # ) # if parsed is None: # return None # filesystems = [] # for fs in parsed: # filesystems.append( # ZFSFilesystem( # fs[0], # fs[1] # ) # ) # return filesystems # # @classmethod # def get_snapshots(cls, refresh=False): # """ # Gets a list of snapshots # :return: A list of `ZFSSnapshot` # :rtype: list # """ # cached = cache.get('zfs-snapshots') # if not refresh and cached is not None: # logger.info('Returning cached list') # return cached # parsed = _parse_cmd_output( # ['zfs', 'list', '-Hp', '-tsnap', '-oname,creation'] # ) # if parsed is None: # return None # snaps = [] # for snap in parsed: # ts = datetime.fromtimestamp(int(snap[1])) # ts = pytz.timezone(cls.timezone_name).localize(ts) # snaps.append( # ZFSSnapshot( # snap[0], # ts # ) # ) # cache.set('zfs-snapshots', snaps, 43200) # logger.info('Refreshed list of snapshots {}'.format(snaps)) # return snaps # # @classmethod # def get_filesystem(cls, fs_name): # """ # Gets a filesystem by name # :param fs_name: Name of the filesystem to get # :type fs_name: basestring # :return: A `ZFSFilesystem` # :rtype: `nasman.snapshots.zfs.ZFSFilesystem` # """ # parsed = _parse_cmd_output( # ['zfs', # 'list', # '-Hp', # '-tfilesystem', # '-oname,mountpoint', # fs_name] # ) # if parsed is None: # return None # return ZFSFilesystem(parsed[0][0], parsed[0][1]) # # @classmethod # def get_snapshot(cls, snap_name): # """ # Gets a snapshot by name # :param snap_name: Name of the snapshot to get # :type snap_name: basestring # :return: A `ZFSSnapshot` # :rtype: `nasman.snapshots.zfs.ZFSSnapshot` # """ # parsed = _parse_cmd_output( # ['zfs', # 'list', # '-Hp', # '-tsnap', # '-oname,creation', # snap_name] # ) # if parsed is None: # return None # return ZFSSnapshot(parsed[0][0], parsed[0][1]) # # @classmethod # def create_snapshot(cls, snap_name, fs_name, recurse): # """ # Creates a snapshot # :param snap_name: Name of the snapshot to create # :type snap_name: str # :param fs_name: Name of the filesystem to take snapshot of # :type fs_name: str # :param recurse: Whether to recurse filesystems # :type recurse: bool # :return: The snapshot just created # :rtype: `nasman.snapshots.zfs.ZFSSnapshot` # """ # cache.delete('zfs-snapshots') # full_name = '{0}@{1}'.format( # fs_name, # snap_name # ) # cmd = ['zfs', # 'snapshot', # full_name # ] # if recurse: # cmd.append('-r') # parsed = _parse_cmd_output(cmd) # if parsed is None: # return None # return cls.get_snapshot(full_name) which might include code, classes, or functions. Output only the next line.
ZFSUtil.create_snapshot(snap_name, fs_name, recurse)
Here is a snippet: <|code_start|> @admin.register(File) class FileAdmin(admin.ModelAdmin): list_display = ('original_path', 'snapshot_name') list_display_links = ('original_path',) form = FileForm readonly_fields = ('path_encoding', 'search_index') <|code_end|> . Write the next line using the current file imports: from django.contrib import admin from django.utils.translation import ugettext_lazy as _ from sitetree.admin import TreeItemAdmin, override_item_admin from .models import File, IconMapping from .forms import FileForm and context from other files: # Path: nasman/snapshots/models.py # class File(models.Model): # """ # Model representing a file/directory/etc on the filesystem # """ # snapshot_path = models.TextField( # 'snapshot path', # help_text='The path to the file when the relevant snapshot is mounted') # original_path = models.TextField( # 'original path', # help_text='The original path on the filesystem when the snapshot was ' # 'taken' # ) # snapshot_name = models.TextField( # 'snapshot name', # help_text='Name of the snapshot' # ) # path_encoding = models.TextField( # 'path encoding', # help_text='The filesystem encoding for this file', # blank=True # ) # search_index = VectorField() # # objects = SearchManager( # fields=('snapshot_path', 'original_path'), # config='pg_catalog.english', # search_field='search_index', # auto_update_search_field=True # ) # # class Meta: # app_label = 'snapshots' # # class IconMapping(models.Model): # """ # Model to manage icon mapping to mimetypes # """ # icon = IconField( # 'icon', # default='fa-file-o' # ) # mime_type = models.CharField( # 'mime-type', # max_length=255, # primary_key=True, # db_index=True # ) # # class Meta: # app_label = 'snapshots' # # def __str__(self): # return self.mime_type # # Path: nasman/snapshots/forms.py # class FileForm(forms.ModelForm): # snapshot_name = forms.ChoiceField( # choices=snapshot_choices # ) # # class Meta: # model = File # fields = ( # 'snapshot_path', # 'original_path', # 'snapshot_name', # ) # widgets = { # 'snapshot_path': forms.TextInput(), # 'original_path': forms.TextInput(), # 'search_index': forms.Textarea(), # } , which may include functions, classes, or code. Output only the next line.
@admin.register(IconMapping)
Continue the code snippet: <|code_start|> @admin.register(File) class FileAdmin(admin.ModelAdmin): list_display = ('original_path', 'snapshot_name') list_display_links = ('original_path',) <|code_end|> . Use current file imports: from django.contrib import admin from django.utils.translation import ugettext_lazy as _ from sitetree.admin import TreeItemAdmin, override_item_admin from .models import File, IconMapping from .forms import FileForm and context (classes, functions, or code) from other files: # Path: nasman/snapshots/models.py # class File(models.Model): # """ # Model representing a file/directory/etc on the filesystem # """ # snapshot_path = models.TextField( # 'snapshot path', # help_text='The path to the file when the relevant snapshot is mounted') # original_path = models.TextField( # 'original path', # help_text='The original path on the filesystem when the snapshot was ' # 'taken' # ) # snapshot_name = models.TextField( # 'snapshot name', # help_text='Name of the snapshot' # ) # path_encoding = models.TextField( # 'path encoding', # help_text='The filesystem encoding for this file', # blank=True # ) # search_index = VectorField() # # objects = SearchManager( # fields=('snapshot_path', 'original_path'), # config='pg_catalog.english', # search_field='search_index', # auto_update_search_field=True # ) # # class Meta: # app_label = 'snapshots' # # class IconMapping(models.Model): # """ # Model to manage icon mapping to mimetypes # """ # icon = IconField( # 'icon', # default='fa-file-o' # ) # mime_type = models.CharField( # 'mime-type', # max_length=255, # primary_key=True, # db_index=True # ) # # class Meta: # app_label = 'snapshots' # # def __str__(self): # return self.mime_type # # Path: nasman/snapshots/forms.py # class FileForm(forms.ModelForm): # snapshot_name = forms.ChoiceField( # choices=snapshot_choices # ) # # class Meta: # model = File # fields = ( # 'snapshot_path', # 'original_path', # 'snapshot_name', # ) # widgets = { # 'snapshot_path': forms.TextInput(), # 'original_path': forms.TextInput(), # 'search_index': forms.Textarea(), # } . Output only the next line.
form = FileForm
Given snippet: <|code_start|> urlpatterns = patterns( '', url(r'^$', DashboardView.as_view(), name='dashboard'), <|code_end|> , continue by predicting the next line. Consider current file imports: from django.conf.urls import patterns, url from .views.base import DashboardView from .views.filesystems import FileBrowser, FilesystemList from .views import snapshots as snaps and context: # Path: nasman/snapshots/views/base.py # class DashboardView(BaseView, # TemplateView): # """ # View for the homepage # """ # http_method_names = ['get'] # template_name = 'dashboard.html' # headline = 'NASMan Dashboard' # # Path: nasman/snapshots/views/filesystems.py # class FileBrowser(BaseView, FormView): # """ # Browse live filesystem using python os stdlib # """ # template_name = 'file_list.html' # headline = 'File Browser' # form_class = FileBrowserForm # success_url = reverse_lazy('nasman:file-browser') # # def get_context_data(self, **kwargs): # """ # Build the context data for the file browser # """ # context = super(FileBrowser, self).get_context_data(**kwargs) # form = context['form'] # filesystem = None # snapshot = None # if form.is_bound: # form.is_valid() # filesystem = form.cleaned_data.get('filesystem') # snapshot = form.cleaned_data.get('snapshot') # if 'path' in form.changed_data: # path = form.cleaned_data['path'] # elif 'filesystem' in form.changed_data: # filesystem.mount() # path = Path(filesystem.mountpoint) # elif 'snapshot' in form.changed_data: # snapshot.mount() # path = Path(snapshot.mountpoint) # else: # path = Path('/') # root = path.root # icon_mapping = defaultdict( # lambda: 'fa-file-o', # {x.mime_type: x.icon # for x in IconMapping.objects.all()}) # # # The file list/browser # object_list = [] # for x in path.iterdir(): # try: # mime_type = magic.from_file(str(x), mime=True).decode('utf8') # except OSError as e: # logger.warn('Unable to get mime_type of %s', str(x)) # mime_type = None # object_list.append({ # 'name': x.name, # 'full_path': x, # 'directory': x.is_dir(), # 'mime_type': mime_type, # 'modified': datetime.fromtimestamp(x.lstat().st_mtime), # 'size': x.lstat().st_size, # 'icon': icon_mapping[mime_type], # }) # object_list.sort(key=lambda k: (not k['directory'], k['name'])) # # # Path breadcrumbs # breadcrumbs = sorted(path.parents) + [path] # # # The up one '..' link # up_one = None # if path != root: # up_one = path.parent # # # TODO: context relevant snapshot list # context.update({ # 'up_one': up_one, # 'files_list': object_list, # 'path': breadcrumbs, # 'browser_title': breadcrumbs[-1], # }) # return context # # def form_valid(self, form): # return self.form_invalid(form) # # class FilesystemList(BaseView, TemplateView): # template_name = 'filesystem_list.html' # headline = 'ZFS Filesystems' # # def get_context_data(self, **kwargs): # context = super(FilesystemList, self).get_context_data() # context['object_list'] = ZFSUtil.get_filesystems() # return context # # Path: nasman/snapshots/views/snapshots.py # class SnapshotCreate(MessageMixin, BaseView, FormView): # class SnapshotList(JSONResponseMixin, AjaxResponseMixin, BaseView, ListView): # class SnapshotReindex(MessageMixin, View): # class SnapshotMount(MessageMixin, View): # def form_valid(self, form): # def get_ajax(self, request, *args, **kwargs): # def get_queryset(self): # def get(self, request, name=None): # def get(self, request, name=None): which might include code, classes, or functions. Output only the next line.
url(r'^file-browser$', FileBrowser.as_view(), name='file-browser'),
Here is a snippet: <|code_start|> urlpatterns = patterns( '', url(r'^$', DashboardView.as_view(), name='dashboard'), url(r'^file-browser$', FileBrowser.as_view(), name='file-browser'), <|code_end|> . Write the next line using the current file imports: from django.conf.urls import patterns, url from .views.base import DashboardView from .views.filesystems import FileBrowser, FilesystemList from .views import snapshots as snaps and context from other files: # Path: nasman/snapshots/views/base.py # class DashboardView(BaseView, # TemplateView): # """ # View for the homepage # """ # http_method_names = ['get'] # template_name = 'dashboard.html' # headline = 'NASMan Dashboard' # # Path: nasman/snapshots/views/filesystems.py # class FileBrowser(BaseView, FormView): # """ # Browse live filesystem using python os stdlib # """ # template_name = 'file_list.html' # headline = 'File Browser' # form_class = FileBrowserForm # success_url = reverse_lazy('nasman:file-browser') # # def get_context_data(self, **kwargs): # """ # Build the context data for the file browser # """ # context = super(FileBrowser, self).get_context_data(**kwargs) # form = context['form'] # filesystem = None # snapshot = None # if form.is_bound: # form.is_valid() # filesystem = form.cleaned_data.get('filesystem') # snapshot = form.cleaned_data.get('snapshot') # if 'path' in form.changed_data: # path = form.cleaned_data['path'] # elif 'filesystem' in form.changed_data: # filesystem.mount() # path = Path(filesystem.mountpoint) # elif 'snapshot' in form.changed_data: # snapshot.mount() # path = Path(snapshot.mountpoint) # else: # path = Path('/') # root = path.root # icon_mapping = defaultdict( # lambda: 'fa-file-o', # {x.mime_type: x.icon # for x in IconMapping.objects.all()}) # # # The file list/browser # object_list = [] # for x in path.iterdir(): # try: # mime_type = magic.from_file(str(x), mime=True).decode('utf8') # except OSError as e: # logger.warn('Unable to get mime_type of %s', str(x)) # mime_type = None # object_list.append({ # 'name': x.name, # 'full_path': x, # 'directory': x.is_dir(), # 'mime_type': mime_type, # 'modified': datetime.fromtimestamp(x.lstat().st_mtime), # 'size': x.lstat().st_size, # 'icon': icon_mapping[mime_type], # }) # object_list.sort(key=lambda k: (not k['directory'], k['name'])) # # # Path breadcrumbs # breadcrumbs = sorted(path.parents) + [path] # # # The up one '..' link # up_one = None # if path != root: # up_one = path.parent # # # TODO: context relevant snapshot list # context.update({ # 'up_one': up_one, # 'files_list': object_list, # 'path': breadcrumbs, # 'browser_title': breadcrumbs[-1], # }) # return context # # def form_valid(self, form): # return self.form_invalid(form) # # class FilesystemList(BaseView, TemplateView): # template_name = 'filesystem_list.html' # headline = 'ZFS Filesystems' # # def get_context_data(self, **kwargs): # context = super(FilesystemList, self).get_context_data() # context['object_list'] = ZFSUtil.get_filesystems() # return context # # Path: nasman/snapshots/views/snapshots.py # class SnapshotCreate(MessageMixin, BaseView, FormView): # class SnapshotList(JSONResponseMixin, AjaxResponseMixin, BaseView, ListView): # class SnapshotReindex(MessageMixin, View): # class SnapshotMount(MessageMixin, View): # def form_valid(self, form): # def get_ajax(self, request, *args, **kwargs): # def get_queryset(self): # def get(self, request, name=None): # def get(self, request, name=None): , which may include functions, classes, or code. Output only the next line.
url(r'^filesystems$', FilesystemList.as_view(), name='filesystems'),
Given snippet: <|code_start|> urlpatterns = patterns( '', url(r'^$', DashboardView.as_view(), name='dashboard'), url(r'^file-browser$', FileBrowser.as_view(), name='file-browser'), url(r'^filesystems$', FilesystemList.as_view(), name='filesystems'), # url(r'^filesystem/add$', FilesystemCreate.as_view(), name='filesystems'), <|code_end|> , continue by predicting the next line. Consider current file imports: from django.conf.urls import patterns, url from .views.base import DashboardView from .views.filesystems import FileBrowser, FilesystemList from .views import snapshots as snaps and context: # Path: nasman/snapshots/views/base.py # class DashboardView(BaseView, # TemplateView): # """ # View for the homepage # """ # http_method_names = ['get'] # template_name = 'dashboard.html' # headline = 'NASMan Dashboard' # # Path: nasman/snapshots/views/filesystems.py # class FileBrowser(BaseView, FormView): # """ # Browse live filesystem using python os stdlib # """ # template_name = 'file_list.html' # headline = 'File Browser' # form_class = FileBrowserForm # success_url = reverse_lazy('nasman:file-browser') # # def get_context_data(self, **kwargs): # """ # Build the context data for the file browser # """ # context = super(FileBrowser, self).get_context_data(**kwargs) # form = context['form'] # filesystem = None # snapshot = None # if form.is_bound: # form.is_valid() # filesystem = form.cleaned_data.get('filesystem') # snapshot = form.cleaned_data.get('snapshot') # if 'path' in form.changed_data: # path = form.cleaned_data['path'] # elif 'filesystem' in form.changed_data: # filesystem.mount() # path = Path(filesystem.mountpoint) # elif 'snapshot' in form.changed_data: # snapshot.mount() # path = Path(snapshot.mountpoint) # else: # path = Path('/') # root = path.root # icon_mapping = defaultdict( # lambda: 'fa-file-o', # {x.mime_type: x.icon # for x in IconMapping.objects.all()}) # # # The file list/browser # object_list = [] # for x in path.iterdir(): # try: # mime_type = magic.from_file(str(x), mime=True).decode('utf8') # except OSError as e: # logger.warn('Unable to get mime_type of %s', str(x)) # mime_type = None # object_list.append({ # 'name': x.name, # 'full_path': x, # 'directory': x.is_dir(), # 'mime_type': mime_type, # 'modified': datetime.fromtimestamp(x.lstat().st_mtime), # 'size': x.lstat().st_size, # 'icon': icon_mapping[mime_type], # }) # object_list.sort(key=lambda k: (not k['directory'], k['name'])) # # # Path breadcrumbs # breadcrumbs = sorted(path.parents) + [path] # # # The up one '..' link # up_one = None # if path != root: # up_one = path.parent # # # TODO: context relevant snapshot list # context.update({ # 'up_one': up_one, # 'files_list': object_list, # 'path': breadcrumbs, # 'browser_title': breadcrumbs[-1], # }) # return context # # def form_valid(self, form): # return self.form_invalid(form) # # class FilesystemList(BaseView, TemplateView): # template_name = 'filesystem_list.html' # headline = 'ZFS Filesystems' # # def get_context_data(self, **kwargs): # context = super(FilesystemList, self).get_context_data() # context['object_list'] = ZFSUtil.get_filesystems() # return context # # Path: nasman/snapshots/views/snapshots.py # class SnapshotCreate(MessageMixin, BaseView, FormView): # class SnapshotList(JSONResponseMixin, AjaxResponseMixin, BaseView, ListView): # class SnapshotReindex(MessageMixin, View): # class SnapshotMount(MessageMixin, View): # def form_valid(self, form): # def get_ajax(self, request, *args, **kwargs): # def get_queryset(self): # def get(self, request, name=None): # def get(self, request, name=None): which might include code, classes, or functions. Output only the next line.
url(r'^snapshots$', snaps.SnapshotList.as_view(), name='snapshots'),
Predict the next line after this snippet: <|code_start|> def filesystem_choices(): """ A callable for use by forms that allow choosing a ZFS Filesystem :return: The list of ZFS filesystems on the system :rtype: tuple """ <|code_end|> using the current file's imports: from pathlib import Path from .models import File from .utils.zfs import ZFSUtil from .widgets import ( SmallSelectWidget, BootstrapCheckboxWidget, BootstrapTextWidget, BootstrapSelectWidget ) import floppyforms.__future__ as forms and any relevant context from other files: # Path: nasman/snapshots/models.py # class File(models.Model): # """ # Model representing a file/directory/etc on the filesystem # """ # snapshot_path = models.TextField( # 'snapshot path', # help_text='The path to the file when the relevant snapshot is mounted') # original_path = models.TextField( # 'original path', # help_text='The original path on the filesystem when the snapshot was ' # 'taken' # ) # snapshot_name = models.TextField( # 'snapshot name', # help_text='Name of the snapshot' # ) # path_encoding = models.TextField( # 'path encoding', # help_text='The filesystem encoding for this file', # blank=True # ) # search_index = VectorField() # # objects = SearchManager( # fields=('snapshot_path', 'original_path'), # config='pg_catalog.english', # search_field='search_index', # auto_update_search_field=True # ) # # class Meta: # app_label = 'snapshots' # # Path: nasman/snapshots/utils/zfs.py # class ZFSUtil(BaseUtil): # """ # Helper utility for accessing ZFS features # """ # # @classmethod # def get_filesystems(cls): # """ # Gets a list of filesystems # :return: A list of `ZFSFilesystem` objects # :rtype: list # """ # parsed = _parse_cmd_output( # ['zfs', 'list', '-Hp', '-tfilesystem', '-oname,mountpoint'] # ) # if parsed is None: # return None # filesystems = [] # for fs in parsed: # filesystems.append( # ZFSFilesystem( # fs[0], # fs[1] # ) # ) # return filesystems # # @classmethod # def get_snapshots(cls, refresh=False): # """ # Gets a list of snapshots # :return: A list of `ZFSSnapshot` # :rtype: list # """ # cached = cache.get('zfs-snapshots') # if not refresh and cached is not None: # logger.info('Returning cached list') # return cached # parsed = _parse_cmd_output( # ['zfs', 'list', '-Hp', '-tsnap', '-oname,creation'] # ) # if parsed is None: # return None # snaps = [] # for snap in parsed: # ts = datetime.fromtimestamp(int(snap[1])) # ts = pytz.timezone(cls.timezone_name).localize(ts) # snaps.append( # ZFSSnapshot( # snap[0], # ts # ) # ) # cache.set('zfs-snapshots', snaps, 43200) # logger.info('Refreshed list of snapshots {}'.format(snaps)) # return snaps # # @classmethod # def get_filesystem(cls, fs_name): # """ # Gets a filesystem by name # :param fs_name: Name of the filesystem to get # :type fs_name: basestring # :return: A `ZFSFilesystem` # :rtype: `nasman.snapshots.zfs.ZFSFilesystem` # """ # parsed = _parse_cmd_output( # ['zfs', # 'list', # '-Hp', # '-tfilesystem', # '-oname,mountpoint', # fs_name] # ) # if parsed is None: # return None # return ZFSFilesystem(parsed[0][0], parsed[0][1]) # # @classmethod # def get_snapshot(cls, snap_name): # """ # Gets a snapshot by name # :param snap_name: Name of the snapshot to get # :type snap_name: basestring # :return: A `ZFSSnapshot` # :rtype: `nasman.snapshots.zfs.ZFSSnapshot` # """ # parsed = _parse_cmd_output( # ['zfs', # 'list', # '-Hp', # '-tsnap', # '-oname,creation', # snap_name] # ) # if parsed is None: # return None # return ZFSSnapshot(parsed[0][0], parsed[0][1]) # # @classmethod # def create_snapshot(cls, snap_name, fs_name, recurse): # """ # Creates a snapshot # :param snap_name: Name of the snapshot to create # :type snap_name: str # :param fs_name: Name of the filesystem to take snapshot of # :type fs_name: str # :param recurse: Whether to recurse filesystems # :type recurse: bool # :return: The snapshot just created # :rtype: `nasman.snapshots.zfs.ZFSSnapshot` # """ # cache.delete('zfs-snapshots') # full_name = '{0}@{1}'.format( # fs_name, # snap_name # ) # cmd = ['zfs', # 'snapshot', # full_name # ] # if recurse: # cmd.append('-r') # parsed = _parse_cmd_output(cmd) # if parsed is None: # return None # return cls.get_snapshot(full_name) # # Path: nasman/snapshots/widgets.py # class SmallSelectWidget(BootstrapClassesMixin, forms.Select): # classes = ['input-sm', 'form-control'] # # class BootstrapCheckboxWidget(BootstrapClassesMixin, forms.CheckboxInput): # classes = ['checkbox'] # # class BootstrapTextWidget(BootstrapClassesMixin, forms.TextInput): # pass # # class BootstrapSelectWidget(BootstrapClassesMixin, forms.Select): # pass . Output only the next line.
filesystems = [x.name for x in ZFSUtil.get_filesystems()]
Predict the next line after this snippet: <|code_start|>#!/usr/bin/env python ''' simple shortcut for running nosetests via python replacement for *.bat or *.sh wrappers ''' app_path = dirname(realpath(__file__)) <|code_end|> using the current file's imports: import sys import os import logging import nose import re from os.path import dirname, realpath, join from gap.utils.setup import fix_sys_path, setup_testbed and any relevant context from other files: # Path: gap/utils/setup.py # def fix_sys_path(app_src=None): # global _PATH_FIXED # if not _PATH_FIXED: # gae_path = find_gae_runtime_path() # sys.path.insert(0, gae_path) # # sys.path.insert(0, join(gae_path, 'lib')) # import dev_appserver # dev_appserver.fix_sys_path() # _PATH_FIXED = 1 # # if app_src and _PATH_FIXED < 2: # sys.path.insert(0, app_src) # _PATH_FIXED = 2 # # def setup_testbed(stubs=DEFAULT_TESTBEDS, env={}): # from google.appengine.ext import testbed # t = testbed.Testbed() # if env: # t.setup_env(**env) # t.activate() # for stub in stubs: # if stub == 'datastore': # stub = 'datastore_v3' # getattr(t, 'init_%s_stub' % stub)() # if stub == 'urlfetch': # t.urlfetch_stub = t.get_stub('urlfetch') # elif stub == 'mail': # t.mail_stub = t.get_stub(testbed.MAIL_SERVICE_NAME) # import app # return t . Output only the next line.
fix_sys_path()
Predict the next line for this snippet: <|code_start|>#!/usr/bin/env python ''' simple shortcut for running nosetests via python replacement for *.bat or *.sh wrappers ''' extra_plugins=[] app_path = join(dirname(dirname(realpath(__file__))), 'src') <|code_end|> with the help of current file imports: import sys import os import logging import re import nose import webtest import pip import nose import webtest from copy import copy from os.path import dirname, realpath, join from gap.utils.setup import fix_sys_path from nosegae import NoseGAE from nosegae import NoseGAE from nose.config import Config from nose.plugins import DefaultPluginManager from rednose import RedNose and context from other files: # Path: gap/utils/setup.py # def fix_sys_path(app_src=None): # global _PATH_FIXED # if not _PATH_FIXED: # gae_path = find_gae_runtime_path() # sys.path.insert(0, gae_path) # # sys.path.insert(0, join(gae_path, 'lib')) # import dev_appserver # dev_appserver.fix_sys_path() # _PATH_FIXED = 1 # # if app_src and _PATH_FIXED < 2: # sys.path.insert(0, app_src) # _PATH_FIXED = 2 , which may contain function names, class names, or code. Output only the next line.
fix_sys_path(app_path)
Continue the code snippet: <|code_start|># -*- coding: utf-8 -*- # Copyright 2007 Robin Gottfried <google@kebet.cz> and Lukas Lukovsky # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # @author Lukas Lukovsky # # part of gap project (https://github.com/czervenka/gap) __author__ = 'Lukas Lukovsky' DEFAULT = object() class TestBase(TestCase): testbed = None <|code_end|> . Use current file imports: import json import app import webtest import webapp2 import random import string from unittest import TestCase from gap.utils import setup from os import environ as env from os import environ as env from app import handler from datetime import date, datetime, timedelta from pprint import pprint from google.appengine.ext import ndb and context (classes, functions, or code) from other files: # Path: gap/utils/setup.py # GAE_APP_ROOT = 'src' # GAE_RUNTIME_ROOT = None # _PATH_FIXED = 0 # _PATH_FIXED = 1 # _PATH_FIXED = 2 # DEFAULT_TESTBEDS = ( # 'datastore', # 'app_identity', # 'memcache', # 'files', # 'urlfetch', # 'mail', # 'search', # ) # def find_gae_runtime_path(): # def fix_sys_path(app_src=None): # def read_yaml(app_src): # def setup_stubs(app_src): # def setup_testbed(stubs=DEFAULT_TESTBEDS, env={}): . Output only the next line.
_gae_stubs = setup.DEFAULT_TESTBEDS
Predict the next line for this snippet: <|code_start|># Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # @author Robin Gottfried <google@kebet.cz> # part of gap project (https://github.com/czervenka/gap) __author = 'google@kebet.cz' def defer(callback, *args, **kwargs): if '_queue_name' in kwargs: queue_name = kwargs['_queue_name'] del kwargs['_queue_name'] else: queue_name = 'utils-defer' callback = "%s.%s" % (callback.__module__, callback.__name__) taskqueue.add( url='/utils/defer/%s/%s' % (queue_name, callback,), params={'args': json.dumps(args), 'kwargs': json.dumps(kwargs)}, queue_name=queue_name, ) class _Defer(webapp2.RequestHandler): def post(self, queue_name, callback): request = self.request <|code_end|> with the help of current file imports: import json import webapp2 from google.appengine.api import taskqueue from gap.utils.imports import import_class and context from other files: # Path: gap/utils/imports.py # def import_class(class_name): # """ # imports and returns class by its path # # USAGE: # myclass = import_class('StringIO.StringIO') # # or # from StringIO import StringIO # myclass = import_class(StringIO) # """ # if isinstance(class_name, StringTypes): # from importlib import import_module # module_name, class_name = class_name.rsplit('.', 1) # module = import_module(module_name) # return getattr(module, class_name) # else: # return class_name , which may contain function names, class names, or code. Output only the next line.
callback = import_class(callback)
Continue the code snippet: <|code_start|> def args_wrap(self, *args, **kwargs): exception = None self.response.headers['Content-Type'] = 'application/json; charset=utf-8' try: data = fn(self, *args, **kwargs) if data is not None: self.response.write(dumps(data, indent=4)) except JsonException, exception: self.response.clear() self.response.status = exception.code data = { 'error': { 'code': exception.code, 'message': exception.message, }, } except Exception, exception: logging.exception(exception) self.response.clear() self.response.status = 500 data = { 'error': { 'code': 500, 'message': 'Internal Server Error', }, } if exception: <|code_end|> . Use current file imports: import logging import json import time from gap.conf import settings from datetime import datetime, date from httplib import responses from traceback import format_exc and context (classes, functions, or code) from other files: # Path: gap/conf.py # DEFAULT_SETTINGS = {} # KEY = 'app_settings' # class AppSettings(ndb.Expando): # class LazyAppSettings(object): # class SettingsDict(object): # def get_key(cls): # def put(self, *args, **kwargs): # def get_uuid(cls): # def set_uuid(cls): # def __get__(self, instance, owner=None): # def _set_settings(self, dict_data): # def __getitem__(self, key): # def new_setter(obj, key, value): # def __setitem__(self, key, value): # def add_setting(self, key, value): # def save(self): # def reload(self): # def del_setting(self, key): # def __hasitem__(self, key): # def __contains__(self, key): # def keys(self): # def items(self): # def values(self): # def __iter__(self): . Output only the next line.
if settings['DEBUG']:
Given the following code snippet before the placeholder: <|code_start|>""" Implement doc templates using objective templates and vars """ def objective_doc_templater(doc_dict=None, doc_errors=True): """ Return doc_templater class generator for klasses with objective docs Check for specific case where class being decorated has attributes ``object_template`` and ``objective_vars``. Set new entry ``objective`` into class ``doc_dict`` using these class attributes. Then continue decorating as for ``doct_templater``. """ if doc_dict is None: doc_dict = {} def obj_kdec(klass): if (hasattr(klass, 'objective_template') and hasattr(klass, 'objective_vars')): doc_dict['objective'] = (klass.objective_template % klass.objective_vars) for k, v in klass.objective_vars.items(): doc_dict[k] = v <|code_end|> , predict the next line using imports from the current file: from .doctemplates import doc_templater and context including class names, function names, and sometimes code from other files: # Path: code/regreg/doctemplates.py # def doc_templater(doc_dict=None, doc_error=True): # """ Return class decorator to record and provide doc templates # # Parameters # ---------- # doc_dict : dict # Extra key / value pairs for this class to fill template docstrings. # Parameters in this input dict override parameters from inherited # classes. # doc_error : {True, False}, optional # Whether to raise error in case of non-empty docstring that will be # thrown away by using docstring template, where the docstring has not # itself been marked for use as a template. # # Returns # ------- # kdec : function # Class decorator # """ # if doc_dict is None: # doc_dict = {} # def kdec(klass): # if hasattr(klass, '_doc_templates'): # inherited # klass._doc_templates = klass._doc_templates.copy() # else: # klass._doc_templates = {} # if hasattr(klass, '_doc_dict'): # inherited # klass_doc_dict = klass._doc_dict.copy() # klass_doc_dict.update(doc_dict) # else: # klass_doc_dict = doc_dict # for obj in klass.__dict__.values(): # if hasattr(obj, '_doc_template') and hasattr(obj, 'func_name'): # klass._doc_templates[obj.func_name] = obj._doc_template # if hasattr(obj, '_uses_doc_template') and hasattr(obj, 'func_name'): # if doc_error and not obj.func_doc is None: # raise ValueError("Refusing to discard unexpected docstring for %s" % repr(obj) + # " - set `doc_error` to False if you want " + # "to allow this") # template = klass._doc_templates[obj.func_name] # obj.func_doc = template % klass_doc_dict # klass._doc_dict = klass_doc_dict # return klass # return kdec . Output only the next line.
return doc_templater(doc_dict, doc_errors)(klass)