rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
f = reports.pdf.generate_pdf(REPORTS_OUTPUT_BASE, end_date, | f = reports.pdf.generate_pdf(reports_output_base, end_date, | def write_cutoff_date(date): sql_helper.run_sql("""\ |
def run_sql(sql, args=None, connection=None, auto_commit=True, force_propagate=False): | def run_sql(sql, args=None, connection=None, auto_commit=True, force_propagate=False, debug=False): | def run_sql(sql, args=None, connection=None, auto_commit=True, force_propagate=False): if not connection: connection = get_connection() try: curs = connection.cursor() if args: curs.execute(sql, args) else: curs.execute(sql) if auto_commit: connection.commit() except Exception, e: if force_propagate: if auto_commit:... |
files = sorted( list( set( files ) ) ) source = ','.join (files) + '\n' | fileSet = set() uniqueFiles = [] for filename in files: if filename in fileSet: continue fileSet.add (filename) uniqueFiles.append (filename) source = ','.join (uniqueFiles) + '\n' | def setupCrabDict (options): crab = {} base = options.base crab['runEvent'] = '%s_runEvents.txt' % base crab['copyPickMerge'] = fullCPMpath() crab['output'] = '%s.root' % base crab['crabcfg'] = '%s_crab.config' % base crab['json'] = '%s.json' % base crab['dataset'] = Event.dataset crab[... |
if options.runInteractive: | if options.runInteractive and not options.printInteractive: | def setupCrabDict (options): crab = {} base = options.base crab['runEvent'] = '%s_runEvents.txt' % base crab['copyPickMerge'] = fullCPMpath() crab['output'] = '%s.root' % base crab['crabcfg'] = '%s_crab.config' % base crab['json'] = '%s.json' % base crab['dataset'] = Event.dataset crab[... |
locale.setlocale(locale.LC_ALL, 'en_US') | locale.setlocale(locale.LC_ALL, '') | def OnInit(self): """wxWindows calls this method to initialize the application.""" |
opts = SCons.Options.Options() | opts = SCons.Variables.Variables() | def Initialize(klass, default_message=None, opts=None): settings = klass() help = settings.__doc__ if default_message is None: default_message = 'No targets specified; try scons -h for help.' |
has_build_dir = 'build_dir' in kw | has_variant_dir = 'variant_dir' in kw | def ReadPackages(env, packages, **kw): ''' Helper for loading sconscript build definitions in subdirectories. This method is added to the scons environment. Similar to the build-in SConstruct() function, but by default sets the build dir to '.bin' in each subdirectory, disables source duplication, and exports both 'en... |
if not has_build_dir: kw['build_dir'] = '%s/.bin' % package | if not has_variant_dir: kw['variant_dir'] = '%s/.bin' % package | def ReadPackages(env, packages, **kw): ''' Helper for loading sconscript build definitions in subdirectories. This method is added to the scons environment. Similar to the build-in SConstruct() function, but by default sets the build dir to '.bin' in each subdirectory, disables source duplication, and exports both 'en... |
def extractData(self): | def extractData(self, setErrors=True): | def extractData(self): return {}, () |
hexMsg = HexDumpFormat(msg) | hexMsg = _HexDumpFormat(msg) | def DebugHex(module, txt, msg): """Print a debug text and a hexdump of a message MODULE = string Name of the module that is printing the debug text TXT = string The text to print as debugging message MSG = string The message to hexdump Returns: void Throws: nothing Prints a debugging text. The text is printed i... |
return False | return None | def wait_for_default_route(maxTries=10): """Wait for default route to appear. Returns default_route on success, None on failure. maxTries is number of second to wait before returning False. Called after interface bounced.""" defaultRoute = getDefaultRoute() while defaultRoute is None: maxTries -= 1 if maxTries == 0: p... |
% (failures * 100 / totalRuns, failures, totalRuns) | % (float(failures) * 100 / float(totalRuns), failures, totalRuns) | def main(argv=None): # Do argv default this way, as doing it in the functional # declaration sets it at compile time. if argv is None: argv = sys.argv parser = OptionParser( usage="%prog [<options>] <some arg>", # printed with -h/--help version="%prog 1.0" # automatically generates --version ) parser.add_option("-c", "... |
m["informational"] = self.informational | def rest(self, base_url): """ Return a Python object representing this model""" m = {} m["sid"] = self.sid() | |
td["start_date"] = format_date_time(start_stamp)[:-4] td["end_date"] = format_date_time(end_stamp)[:-4] | td["start_date"] = start_date td["end_date"] = end_date td["start_date_stamp"] = format_date_time(start_stamp)[:-4] td["end_date_stamp"] = format_date_time(end_stamp)[:-4] | def get(self, service_slug, year=None, month=None, day=None): user = users.get_current_user() logging.debug("ServiceHandler#get") service = Service.get_by_slug(service_slug) if not service: self.render({}, "404.html") return try: if day: start_date = date(int(year),int(month),int(day)) end_date = start_date + timede... |
low = Status.lowest_severity() | low = Status.default() | def create_events(): for service in Service.all(): low = Status.lowest_severity() day = datetime.today() - timedelta(days=2) e = Event(service=service, status=low, message="This service is operating fine", start=day) e.put() |
self.error(400, "Description is required" % service_slug) | self.error(400, "Description is required" % description) | def post(self, version, status_slug): description = self.request.get('description', default_value=None) host = self.request.headers.get('host', 'nohost') if (self.valid_version(version)): if description: status = Status.get_by_slug(status_slug) if status: status.description = description status.put() self.json(status.... |
if not self.poss.emetteur.msg_validation: | if not self.poss.emetteur.code_validation: | def entrer(self): """Méthode appelée quand emt entre dans le contexte""" if not self.poss.emetteur.msg_validation: # Le message de validation n'a pas été envoyé # Génération du code de validation code = generer_code() self.poss.emetteur.code_validation = code destinateur = "info" destinataire = self.poss.emetteur.adres... |
module = getattr(getattr(package, nom), \ nom.capitalize()) | module = getattr(getattr(package, nom), "Module") | def charger_module(self, m_type, nom): """Méthode permettant de charger un module en fonction de son type et de son nom. Si le module est déjà chargé, on ne fait rien. |
logger.enregistrer_fil_attente() | logger.enregistrer_file_attente() | def config(self, anaconf, parser_cmd): """Configuration du manager""" global REP_LOGS config_globale = anaconf.get_config("globale") # Si le chemin est précisé dans la configuration globale if config_globale.chemin_logs: REP_LOGS = config_globale.chemin_logs # Si le chemin est précisé en argument de la ligne de comman... |
if fr and fr!=self.jid: | if fr and fr != self.jid and fr != self.jid.bare(): | def __roster_push(self,iq): """Process a "roster push" (change notification) received. |
xmlnode.setProp("label", self.label.encode("utf-8")) | if self.label is not None: xmlnode.setProp("label", self.label.encode("utf-8")) | def complete_xml_element(self, xmlnode, doc): """Complete the XML node with `self` content. |
xmlnode.setProp("type", self.type) | if self.type is not None: xmlnode.setProp("type", self.type) | def complete_xml_element(self, xmlnode, doc): """Complete the XML node with `self` content. |
typ=="normal" | typ = "normal" | def set_message_handler(self, typ, handler, namespace=None, priority=100): """Set a handler for <message/> stanzas. |
def databaseOpened(event): """Start the queue processing services based on the settings in zope.conf""" log.info('handling event IDatabaseOpenedEvent') root_folder = getRootFolder(event) | def startServices(root_folder): | def databaseOpened(event): """Start the queue processing services based on the settings in zope.conf""" log.info('handling event IDatabaseOpenedEvent') root_folder = getRootFolder(event) configuration = getTaskqueueConfiguration() startSpecifications = getStartSpecifications(configuration) for siteName, serviceName ... |
storeDBReference(event) | storeDBReference(event.database) | def databaseOpened(event): """Start the queue processing services based on the settings in zope.conf""" log.info('handling event IDatabaseOpenedEvent') storeDBReference(event) root_folder = getRootFolder(event) startServices(root_folder) |
utils.system("start tcsd", ignore_status=True) raise error.TestError("expecting %s = %s, receiving %s = %s" % | raise error.TestError("expecting %s = %s, observing %s = %s" % | def expect(d, key, value): if (d[key] != value): utils.system("start tcsd", ignore_status=True) raise error.TestError("expecting %s = %s, receiving %s = %s" % (key, value, key, d[key])) |
utils.system("stop tcsd", ignore_status=True) | def run_once(self): utils.system("stop tcsd", ignore_status=True) | |
d = dict_from_command("tpmc getvf"); expect(d, "deactivated", "0") expect(d, "physicalPresence", "0") expect(d, "physicalPresenceLock", "1") expect(d, "bGlobalLock", "1") | if old_or_missing_firmware_version(): logging.warning("skipping test because firmware " + "version missing or deemed too old") return | def run_once(self): utils.system("stop tcsd", ignore_status=True) |
d = dict_from_command("tpmc getpf"); expect(d, "disable", "0") expect(d, "ownership", "1") expect(d, "deactivated", "0") expect(d, "physicalPresenceHWEnable", "0") expect(d, "physicalPresenceCMDEnable", "1") expect(d, "physicalPresenceLifetimeLock", "1") expect(d, "nvLocked", "1") | try: utils.system("stop tcsd", ignore_status=True) | def run_once(self): utils.system("stop tcsd", ignore_status=True) |
utils.system("start tcsd", ignore_status=True) | d = dict_from_command("tpmc getvf"); expect(d, "deactivated", "0") expect(d, "physicalPresence", "0") expect(d, "physicalPresenceLock", "1") expect(d, "bGlobalLock", "1") d = dict_from_command("tpmc getpf"); expect(d, "disable", "0") expect(d, "ownership", "1") expect(d, "deactivated", "0") expect(d, "physicalPresenc... | def run_once(self): utils.system("stop tcsd", ignore_status=True) |
mk_data["$main"] = os.path.join("$(%s_SRC_PATH)" %project_info.info("PROJECT_NAME"), "main.c") | mk_data["$main"] = "/".join("$(%s_SRC_PATH)" %project_info.info("PROJECT_NAME"), "main.c") | def userMkGenerator(project_info): makefile = open(os.path.join(const.DATA_DIR, "mktemplates/template_user.mk"), "r").read() destination = os.path.join(project_info.prjdir, os.path.basename(project_info.prjdir) + "_user.mk") # Deadly performances loss was here :( mk_data = {} mk_data["$pname"] = os.path.basename(projec... |
self.validateToolchain(i) | data = qvariant_converter.getStringDict(self.pageContent.toolchainList.item(i).data(Qt.UserRole)) self.validateToolchain(data["path"]) self._populateToolchainList() | def validateAllToolchains(self): """ Slot called when the user clicks on the validate button. It starts the toolchain validation procedure for all the toolchains. """ try: QApplication.instance().setOverrideCursor(Qt.WaitCursor) for i in range(self.pageContent.toolchainList.count()): self.validateToolchain(i) finally: ... |
sel_toolchain = self.projectInfo("TOOLCHAIN") | toolchain_dict = { 'valid': [], 'non-valid': [], 'unknown': [], 'unverified': [], } | def _populateToolchainList(self): """ Fills the toolchain list with the toolchains stored in the QSettings. """ self.pageContent.toolchainList.clear() self._valid_items = [] toolchains = self._toolchain_manager.predefined_toolchains + self._toolchain_manager.toolchains sel_toolchain = self.projectInfo("TOOLCHAIN") for ... |
item = QListWidgetItem(key) | def _populateToolchainList(self): """ Fills the toolchain list with the toolchains stored in the QSettings. """ self.pageContent.toolchainList.clear() self._valid_items = [] toolchains = self._toolchain_manager.predefined_toolchains + self._toolchain_manager.toolchains sel_toolchain = self.projectInfo("TOOLCHAIN") for ... | |
item.setData(Qt.UserRole, qvariant_converter.convertStringDict(item_data)) self.pageContent.toolchainList.addItem(item) if sel_toolchain and sel_toolchain["path"] == key: self.pageContent.toolchainList.setCurrentItem(item) | def _populateToolchainList(self): """ Fills the toolchain list with the toolchains stored in the QSettings. """ self.pageContent.toolchainList.clear() self._valid_items = [] toolchains = self._toolchain_manager.predefined_toolchains + self._toolchain_manager.toolchains sel_toolchain = self.projectInfo("TOOLCHAIN") for ... | |
self.validateToolchain(self.pageContent.toolchainList.row(item)) | k, data = self.validateToolchain(key) item_data.update(data) toolchain_dict[k].append(item_data) else: toolchain_dict["unverified"].append(item_data) self._processItems(toolchain_dict["valid"], self._validItem) self._processItems(toolchain_dict["non-valid"], self._invalidItem) self._processItems(toolchain_dict["unknown... | def _populateToolchainList(self): """ Fills the toolchain list with the toolchains stored in the QSettings. """ self.pageContent.toolchainList.clear() self._valid_items = [] toolchains = self._toolchain_manager.predefined_toolchains + self._toolchain_manager.toolchains sel_toolchain = self.projectInfo("TOOLCHAIN") for ... |
def _validItem(self, index, infos): | def _validItem(self, item): | def _validItem(self, index, infos): """ Sets the item at index as a valid item and associates the given info to it. """ item = self.pageContent.toolchainList.item(index) new_data = qvariant_converter.getStringDict(self.pageContent.toolchainList.item(index).data(Qt.UserRole)) new_data.update(infos) item.setData(Qt.UserR... |
item = self.pageContent.toolchainList.item(index) new_data = qvariant_converter.getStringDict(self.pageContent.toolchainList.item(index).data(Qt.UserRole)) new_data.update(infos) item.setData(Qt.UserRole, qvariant_converter.convertStringDict(new_data)) needed = self.projectInfo("CPU_INFOS") if "target" in infos and inf... | data = qvariant_converter.getStringDict(item.data(Qt.UserRole)) item.setIcon(QIcon(":/images/ok.png")) self._valid_items.append(item) if "version" in data and "target" in data: item.setText("GCC " + data["version"] + " - " + data["target"].strip()) def _invalidItem(self, item): data = qvariant_converter.getStringDict(... | def _validItem(self, index, infos): """ Sets the item at index as a valid item and associates the given info to it. """ item = self.pageContent.toolchainList.item(index) new_data = qvariant_converter.getStringDict(self.pageContent.toolchainList.item(index).data(Qt.UserRole)) new_data.update(infos) item.setData(Qt.UserR... |
item.setIcon(QIcon(":/images/warning.png")) if "version" in infos and "target" in infos: item.setText("GCC " + infos["version"] + " - " + infos["target"].strip()) def _invalidItem(self, index): """ Sets the item at index as an invalid item. """ item = self.pageContent.toolchainList.item(index) item.setIcon(QIcon(":/im... | return 'unknown', {'path': filename} | def _validItem(self, index, infos): """ Sets the item at index as a valid item and associates the given info to it. """ item = self.pageContent.toolchainList.item(index) new_data = qvariant_converter.getStringDict(self.pageContent.toolchainList.item(index).data(Qt.UserRole)) new_data.update(infos) item.setData(Qt.UserR... |
configuration_info[configuration] = updateConfigurationValues(configuration_info[configuration], cfg_file_path) | configuration_info[configuration] = updateConfigurationValues(configuration_info[configuration], loadConfigurationInfos(cfg_file_path)) | def loadModuleData(self, edit=False): module_info_dict = {} list_info_dict = {} configuration_info_dict = {} file_dict = {} for filename, path in self.findDefinitions("*.h") + self.findDefinitions("*.c") + self.findDefinitions("*.s") + self.findDefinitions("*.S"): comment_list = getCommentList(open(path + "/" + filenam... |
try: self.project.loadModuleData() except ModuleDefineException, e: self.exceptionOccurred(self.tr("Error parsing line '%2' in file %1").arg(e.path).arg(e.line)) except EnumDefineException, e: self.exceptionOccurred(self.tr("Error parsing line '%2' in file %1").arg(e.path).arg(e.line)) except ConfigurationDefineExcepti... | if not self.project.edit: try: self.project.loadModuleData() except ModuleDefineException, e: self.exceptionOccurred(self.tr("Error parsing line '%2' in file %1").arg(e.path).arg(e.line)) except EnumDefineException, e: self.exceptionOccurred(self.tr("Error parsing line '%2' in file %1").arg(e.path).arg(e.line)) excep... | def loadModuleData(self): """ Loads the module data. """ # Load the module data every time so that if the user changed the cpu # the right configurations are picked up. try: self.project.loadModuleData() except ModuleDefineException, e: self.exceptionOccurred(self.tr("Error parsing line '%2' in file %1").arg(e.path).ar... |
configuration = self.projectInfo("MODULES")[module]["configuration"] | configuration = [] if module: configuration = self.projectInfo("MODULES")[module]["configuration"] | def configurations(self, module): """ Returns the configuration for the selected module. """ configuration = self.projectInfo("MODULES")[module]["configuration"] if len(configuration) > 0: return self.projectInfo("CONFIGURATIONS")[configuration] else: return {} |
self.tr("Error removing the destination directory. This directory or a file in it is in use by another user or application.\nClose the application that is using the directory and retry.")) | self.tr("Error removing the destination directory. This directory or a file in it is in use by another user or application.\nClose the application which is using the directory and retry.")) | def reloadData(self): """ Overload of the BWizardPage reloadData method. """ try: QApplication.instance().setOverrideCursor(Qt.WaitCursor) try: # This operation can throw WindowsError, if the directory is # locked. self.project.createBertosProject() except OSError, e: QMessageBox.critical( self, self.tr("Error removing... |
item.setToolTip(property) | tooltip = property description = configurations[property].get("description", None) if description: tooltip = tooltip + ": " + description item.setToolTip(tooltip) | def fillPropertyTable(self): """ Slot called when the user selects a module from the module tree. Fills the property table using the configuration parameters defined in the source tree. """ module = self.currentModule() if module: try: supported = bertos_utils.isSupported(self.project, module=module) except SupportedEx... |
version_file = open(os.path.join(const.DATA_DIR, "vtemplates/VERSION"), "r").read() open(filename, "w").write(versionFileGenerator(self, version_file)) | if not self.edit or self.old_srcdir: version_file = open(os.path.join(const.DATA_DIR, "vtemplates/VERSION"), "r").read() open(filename, "w").write(versionFileGenerator(self, version_file)) | def _writeVersionFile(self, filename): version_file = open(os.path.join(const.DATA_DIR, "vtemplates/VERSION"), "r").read() open(filename, "w").write(versionFileGenerator(self, version_file)) |
print definition | def loadCpuInfos(self): cpuInfos = [] for definition in self.findDefinitions(const.CPU_DEFINITION): print definition cpuInfos.append(getInfos(definition)) return cpuInfos | |
print cpu_info | def reloadCpuInfo(self): for cpu_info in self.loadCpuInfos(): if cpu_info["CPU_NAME"] == self.infos["CPU_NAME"]: self.infos["CPU_INFOS"] = cpu_info print cpu_info | |
bertos_path = os.path.abspath(preset_dir + "/" + bertos_path) hw_path = os.path.abspath(preset_dir + "/" + hw_path) src_path = os.path.relpath(preset_dir, bertos_path) hw_path = os.path.relpath(hw_path, bertos_path) | def findPath(start, target): pa = start while pa != "/": pa = os.path.abspath(pa + "/..") if os.path.exists(pa + "/" + target): return os.path.relpath(pa, start) | |
self.project.createBertosProject() | try: self.project.createBertosProject() except OSError, e: QMessageBox.critical(self, self.tr("Error removing destination directory"), self.tr("Close all the application using this directory and retry.")) self.wizard().back() return | def reloadData(self): """ Overload of the BWizardPage reloadData method. """ try: QApplication.instance().setOverrideCursor(Qt.WaitCursor) self.project.createBertosProject() finally: QApplication.instance().restoreOverrideCursor() self._plugin_dict = {} if os.name == "nt": output = self.projectInfo("OUTPUT") import win... |
mk_data["$main"] = "/".join("$(%s_SRC_PATH)" %project_info.info("PROJECT_NAME"), "main.c") | mk_data["$main"] = "/".join(["$(%s_SRC_PATH)" %project_info.info("PROJECT_NAME"), "main.c"]) | def userMkGenerator(project_info): makefile = open(os.path.join(const.DATA_DIR, "mktemplates/template_user.mk"), "r").read() destination = os.path.join(project_info.prjdir, os.path.basename(project_info.prjdir) + "_user.mk") # Deadly performances loss was here :( mk_data = {} mk_data["$pname"] = os.path.basename(projec... |
needed = self.projectInfo("CPU_INFOS") if "target" in infos and infos["target"].find(needed["TOOLCHAIN"]) != -1: item.setIcon(QIcon(":/images/ok.png")) self._valid_items.append(item) else: item.setIcon(QIcon(":/images/warning.png")) | item.setIcon(QIcon(":/images/ok.png")) self._valid_items.append(item) | def _validItem(self, index, infos): """ Sets the item at index as a valid item and associates the given info to it. """ item = self.pageContent.toolchainList.item(index) new_data = qvariant_converter.getStringDict(self.pageContent.toolchainList.item(index).data(Qt.UserRole)) new_data.update(infos) item.setData(Qt.UserR... |
else: self._invalidItem(i) | for i, info in enumerate(different_target): self._differentTargetItem(i + len(valid), info) for i, info in enumerate(invalid): self._invalidItem(i + len(valid) + len(different_target)) | def validateToolchain(self, i): """ Toolchain validation procedure. """ filename = qvariant_converter.getStringDict(self.pageContent.toolchainList.item(i).data(Qt.UserRole))["path"] info = self._toolchain_manager.validateToolchain(filename) |
if not self.project.edit: | if not self.project.edit and not self.project.from_preset: | def loadModuleData(self): """ Loads the module data. """ if not self.project.edit: # Load the module data every time so that if the user changed the cpu # the right configurations are picked up. try: self.project.loadModuleData() except ModuleDefineException, e: self.exceptionOccurred(self.tr("Error parsing line '%2' i... |
project_data["PROJECT_SRC_PATH"] = project_info.info("PROJECT_SRC_PATH") | project_src_relpath = relpath.relpath(project_info.info("PROJECT_SRC_PATH"), directory) project_data["PROJECT_SRC_PATH"] = project_src_relpath | def projectFileGenerator(project_info): directory = project_info.info("PROJECT_PATH") project_data = {} enabled_modules = [] for module, information in project_info.info("MODULES").items(): if information["enabled"]: enabled_modules.append(module) project_data["ENABLED_MODULES"] = enabled_modules if project_info.info("... |
mk_data["$ppath"] = os.path.basename(project_info.info("PROJECT_SRC_PATH")) mk_data["$main"] = os.path.basename(project_info.info("PROJECT_PATH")) + "/main.c" | mk_data["$ppath"] = relpath.relpath(project_info.info("PROJECT_SRC_PATH"), project_info.info("PROJECT_PATH")) mk_data["$main"] = os.path.join("$(%s_PROJECT_SRC_PATH)" %project_info.info("PROJECT_NAME"), "main.c") | def userMkGenerator(project_info): makefile = open(os.path.join(const.DATA_DIR, "mktemplates/template_user.mk"), "r").read() destination = os.path.join(project_info.prjdir, os.path.basename(project_info.prjdir) + "_user.mk") # Deadly performances loss was here :( mk_data = {} mk_data["$pname"] = os.path.basename(projec... |
mk_data["$ppath"] = os.path.basename(project_info.info("PROJECT_SRC_PATH")) | mk_data["$ppath"] = relpath.relpath(project_info.info("PROJECT_SRC_PATH"), project_info.info("PROJECT_PATH")) | def mkGenerator(project_info): """ Generates the mk file for the current project. """ makefile = open(os.path.join(const.DATA_DIR, "mktemplates/template.mk"), "r").read() destination = os.path.join(project_info.prjdir, os.path.basename(project_info.prjdir) + ".mk") mk_data = {} mk_data["$pname"] = project_info.info("PR... |
mk_data["$main"] = os.path.basename(project_info.info("PROJECT_PATH")) + "/main.c" | def mkGenerator(project_info): """ Generates the mk file for the current project. """ makefile = open(os.path.join(const.DATA_DIR, "mktemplates/template.mk"), "r").read() destination = os.path.join(project_info.prjdir, os.path.basename(project_info.prjdir) + ".mk") mk_data = {} mk_data["$pname"] = project_info.info("PR... | |
if os.name == 'posix': | if os.name == 'posix' and sys.version_info >= (2, 6): | def findSources(path): """ Analyzes the directory tree from path and return a dict with filename and path. """ if not path.endswith(os.sep): path += os.sep file_dict = {} # also follow all symlinks under POSIX OSes if os.name == 'posix': file_list = os.walk(path, followlinks=True) else: file_list = os.walk(path) for ro... |
version_list = [int(i) for i in version_string.split()[-1].split('.')] | version_list = [int(i) for i in version_string.split()[1].split('.')] | def findModuleFiles(module, project_info): # Find the files related to the selected module cfiles = [] sfiles = [] # .c files related to the module and the cpu architecture for filename, path in project_info.searchFiles(module + ".c"): path = path.replace(project_info.info("BERTOS_PATH") + os.sep, "") path = replaceSep... |
def foo(): print "qui" createBertosProject(self.module_page.project(), edit=True) import cProfile print "quo" cProfile.runctx("foo()", globals(), locals(), sort=1) | createBertosProject(self.module_page.project(), edit=True) | def foo(): print "qui" createBertosProject(self.module_page.project(), edit=True) |
self._loadToolchainStuff(project_data["TOOLCHAIN"]) | def loadProjectFromPreset(self, preset): """ Load a project from a preset. NOTE: this is a stub. """ project_file = os.path.join(preset, "project.bertos") project_data = pickle.loads(open(project_file, "r").read()) self.loadSourceTree() self._loadCpuStuff(project_data["CPU_NAME"], project_data["SELECTED_FREQ"]) self._l... | |
for dependency in information["depends"]: if not dependency in modules: if dependency in files: files[dependency] += 1 else: files[dependency] = 1 | if information["enabled"]: for dependency in information["depends"]: if not dependency in modules: files[dependency] = files.get(dependency, 0) + 1 | def setEnabledModules(project_info, enabled_modules): modules = project_info.info("MODULES") files = {} for module, information in modules.items(): information["enabled"] = module in enabled_modules for dependency in information["depends"]: if not dependency in modules: if dependency in files: files[dependency] += 1 el... |
self.showMessage(self.tr("Toolchain search result."), self.tr("%1 toolchains founded").arg(len(self._toolchain_manager.toolchains))) | self.showMessage(self.tr("Toolchain search result."), self.tr("%1 toolchains found").arg(len(self._toolchain_manager.toolchains))) | def _search(self): """ Searches for toolchains in the stored directories, and stores them in the QSettings. """ dir_list = self.searchDirList() if self.pathSearch(): dir_list += [element for element in bertos_utils.getSystemPath()] _toolchain_dict = self._toolchain_manager.storedToolchainDict() toolchain_list = bertos_... |
self._clearList() self.setupUi() self._populateToolchainList() if len(self._valid_items) >= 1: self.pageContent.toolchainList.setCurrentItem(self.pageContent.toolchainList.currentItem() or self._valid_items[0]) | if previous_id is None or previous_id < self.wizard().currentId(): self._clearList() self.setupUi() self._populateToolchainList() if len(self._valid_items) >= 1: self.pageContent.toolchainList.setCurrentItem(self.pageContent.toolchainList.currentItem() or self._valid_items[0]) | def reloadData(self, previous_id=None): """ Overload of the BWizard reloadData method. """ self._clearList() self.setupUi() self._populateToolchainList() if len(self._valid_items) >= 1: self.pageContent.toolchainList.setCurrentItem(self.pageContent.toolchainList.currentItem() or self._valid_items[0]) |
for filename, path in project_info.searchFiles(module + ".c") + \ project_info.searchFiles(module + "_" + project_info.info("CPU_INFOS")["TOOLCHAIN"] + ".c"): | for filename, path in project_info.searchFiles(module + ".c"): | def findModuleFiles(module, project_info): # Find the files related to the selected module cfiles = [] sfiles = [] # .c files related to the module and the cpu architecture for filename, path in project_info.searchFiles(module + ".c") + \ project_info.searchFiles(module + "_" + project_info.info("CPU_INFOS")["TOOLCHAIN... |
project_info.searchFiles(module + "_" + project_info.info("CPU_INFOS")["TOOLCHAIN"] + ".s") + \ project_info.searchFiles(module + ".S") + \ project_info.searchFiles(module + "_" + project_info.info("CPU_INFOS")["TOOLCHAIN"] + ".S"): | project_info.searchFiles(module + ".S"): | def findModuleFiles(module, project_info): # Find the files related to the selected module cfiles = [] sfiles = [] # .c files related to the module and the cpu architecture for filename, path in project_info.searchFiles(module + ".c") + \ project_info.searchFiles(module + "_" + project_info.info("CPU_INFOS")["TOOLCHAIN... |
for tag in project_info.info("CPU_INFOS")["CPU_TAGS"]: | tags = project_info.info("CPU_INFOS")["CPU_TAGS"] try version_string = bertosVersion(project_info.info("SOURCES_PATH")) version_list = [int(i) for i in version_string.split()[-1].split('.')] if version_list < [2, 5]: tags.append(project_info.info("CPU_INFOS")["TOOLCHAIN"]) except ValueError: pass for tag in tags: | def findModuleFiles(module, project_info): # Find the files related to the selected module cfiles = [] sfiles = [] # .c files related to the module and the cpu architecture for filename, path in project_info.searchFiles(module + ".c") + \ project_info.searchFiles(module + "_" + project_info.info("CPU_INFOS")["TOOLCHAIN... |
os.system("rcc -binary %s -o %s" %(qrc, rcc)) | os.system("rcc -binary \"%s\" -o \"%s\"" %(qrc, rcc)) | def main(): app = QApplication(sys.argv) app.settings = QSettings("Develer", "Bertos Configurator") # Development utility lines, to be removed for production datadir = DATA_DIR qrc, rcc = os.path.join(datadir, 'bertos.qrc'), os.path.join(datadir, 'bertos.rcc') if not (hasattr(sys, "frozen") and sys.frozen) and newer(qr... |
element = os.path.join(origin, element) if os.path.isdir(element): copytree.copytree(element, self.prjdir, ignore_list=const.IGNORE_LIST) | full_path = os.path.join(origin, element) if os.path.isdir(full_path): copytree.copytree(full_path, os.path.join(self.prjdir, element), ignore_list=const.IGNORE_LIST) | def _writeCustomSrcFiles(self): preset = self.infos["PRESET_PATH"] preset_name = self.infos["PRESET_NAME"] origin = os.path.join(preset, preset_name) project_related_stuff = ("cfg", "hw", self.infos["PROJECT_NAME"] + "_wiz.mk") + const.IGNORE_LIST for element in os.listdir(origin): if element not in project_related_stu... |
shutil.copy(element, self.prjdir) | shutil.copy(full_path, self.prjdir) | def _writeCustomSrcFiles(self): preset = self.infos["PRESET_PATH"] preset_name = self.infos["PRESET_NAME"] origin = os.path.join(preset, preset_name) project_related_stuff = ("cfg", "hw", self.infos["PROJECT_NAME"] + "_wiz.mk") + const.IGNORE_LIST for element in os.listdir(origin): if element not in project_related_stu... |
toolchains.append(toolchain) | if not os.path.isdir(toolchain): toolchains.append(toolchain) | def findToolchains(path_list): toolchains = [] for element in path_list: for toolchain in glob.glob(element+ "/" + const.GCC_NAME): toolchains.append(toolchain) return list(set(toolchains)) |
print pa | def findPath(start, target): pa = start while pa != "/": pa = os.path.abspath(pa + "/..") print pa if os.path.exists(pa + "/" + target): return os.path.relpath(pa, start) | |
preset_dir += pname + ".test" | preset_dir += pname | def findPath(start, target): pa = start while pa != "/": pa = os.path.abspath(pa + "/..") print pa if os.path.exists(pa + "/" + target): return os.path.relpath(pa, start) |
for root, dirs, files in os.walk(path, followlinks=True): | if os.name == 'posix': file_list = os.walk(path, followlinks=True) else: file_list = os.walk(path) for root, dirs, files in file_list: | def findSources(path): """ Analyzes the directory tree from path and return a dict with filename and path. """ if not path.endswith(os.sep): path += os.sep file_dict = {} for root, dirs, files in os.walk(path, followlinks=True): if root.find("svn") == -1: file_dict[root.replace(path, "")] = {"dirs": [], "files": []} fo... |
self.pageContent.codeliteCheckBox.setChecked("codelite" not in self.plugins()) | self.pageContent.codeliteCheckBox.setChecked(isinstance(self.plugins(), list) and "codelite" not in self.plugins()) | def setupUi(self): summary = self.pageContent.summaryTree summary.setHeaderHidden(True) summary.setColumnCount(1) self.pageContent.codeliteCheckBox.setChecked("codelite" not in self.plugins()) self.codelitePluginChanged() self.setButtonText(QWizard.NextButton, self.tr("Create")) |
description = qvariant_converter.getDict(self.pageContent.cpuList.currentItem().data(Qt.UserRole))["CPU_DESC"] description = qvariant_converter.getStringList(description) if not self.freq_modified: current_freq = qvariant_converter.getDict(self.pageContent.cpuList.currentItem().data(Qt.UserRole))["CPU_DEFAULT_FREQ"] c... | if self.pageContent.cpuList.currentItem(): description = qvariant_converter.getDict(self.pageContent.cpuList.currentItem().data(Qt.UserRole))["CPU_DESC"] description = qvariant_converter.getStringList(description) if not self.freq_modified: current_freq = qvariant_converter.getDict(self.pageContent.cpuList.currentItem... | def rowChanged(self): """ Slot called when the user select an entry from the cpu list. """ description = qvariant_converter.getDict(self.pageContent.cpuList.currentItem().data(Qt.UserRole))["CPU_DESC"] description = qvariant_converter.getStringList(description) if not self.freq_modified: # Retrieve the default cpu freq... |
enabled_modules = bertos_utils.enabledModules(dialog.version_page.project()) | enabled_modules = bertos_utils.enabledModules(dialog.version_page.project) | def changeBertosVersion(self): |
dialog.version_page.project().loadSourceTree() | dialog.version_page.project.loadSourceTree() | def changeBertosVersion(self): |
bertos_utils.setEnabledModules(dialog.version_page.project(), enabled_modules) | bertos_utils.setEnabledModules(dialog.version_page.project, enabled_modules) | def changeBertosVersion(self): |
createBertosProject(self.module_page.project(), edit=True) | createBertosProject(self.module_page.project, edit=True) | def apply(self): try: qApp.setOverrideCursor(QCursor(Qt.WaitCursor)) createBertosProject(self.module_page.project(), edit=True) finally: qApp.restoreOverrideCursor() self.accept() |
preset_tree = {} | preset_tree = {"children": []} | def loadProjectPresets(self): """ Load the default presets (into the const.PREDEFINED_BOARDS_DIR). """ # NOTE: this method does nothing (for now). preset_path = os.path.join(self.infos["BERTOS_PATH"], const.PREDEFINED_BOARDS_DIR) preset_tree = {} if os.path.exists(preset_path): preset_tree = self._loadProjectPresetTree... |
for root, dirs, files in os.walk(path): | for root, dirs, files in os.walk(path, followlinks=True): | def findSources(path): """ Analyzes the directory tree from path and return a dict with filename and path. """ if not path.endswith(os.sep): path += os.sep file_dict = {} for root, dirs, files in os.walk(path): if root.find("svn") == -1: file_dict[root.replace(path, "")] = {"dirs": [], "files": []} for dir in dirs: # T... |
configuration_info[configuration] = loadConfigurationInfos(self.infos["BERTOS_PATH"] + "/" + configuration) | cfg_file_path = os.path.join(self.bertos_srcdir, configuration) configuration_info[configuration] = loadConfigurationInfos(cfg_file_path) | def loadModuleData(self, edit=False): module_info_dict = {} list_info_dict = {} configuration_info_dict = {} file_dict = {} for filename, path in self.findDefinitions("*.h") + self.findDefinitions("*.c") + self.findDefinitions("*.s") + self.findDefinitions("*.S"): comment_list = getCommentList(open(path + "/" + filenam... |
user_configuration = loadConfigurationInfos(configuration.replace("bertos", path)) configuration_info[configuration] = updateConfigurationValues(configuration_info[configuration], user_configuration) | cfg_file_path = os.path.join(path, configuration) configuration_info[configuration] = updateConfigurationValues(configuration_info[configuration], cfg_file_path) | def loadModuleData(self, edit=False): module_info_dict = {} list_info_dict = {} configuration_info_dict = {} file_dict = {} for filename, path in self.findDefinitions("*.h") + self.findDefinitions("*.c") + self.findDefinitions("*.s") + self.findDefinitions("*.S"): comment_list = getCommentList(open(path + "/" + filenam... |
self._copySources(self.sources_dir, self.srcdir) | self._copySources(self.bertos_maindir, self.srcdir) | def _newBertosProject(self): for directory in (self.maindir, self.srcdir, self.prjdir, self.cfgdir, self.hwdir): self._createDirectory(directory) # Write the project file self._writeProjectFile(os.path.join(self.maindir, "project.bertos")) # VERSION file self._writeVersionFile(os.path.join(self.maindir, "VERSION")) # D... |
self._writeCfgFiles(self.sources_dir, self.cfgdir) | self._writeCfgFiles(self.bertos_srcdir, self.cfgdir) | def _newBertosProject(self): for directory in (self.maindir, self.srcdir, self.prjdir, self.cfgdir, self.hwdir): self._createDirectory(directory) # Write the project file self._writeProjectFile(os.path.join(self.maindir, "project.bertos")) # VERSION file self._writeVersionFile(os.path.join(self.maindir, "VERSION")) # D... |
self._writeHwFiles(self.sources_dir, self.hwdir) | self._writeHwFiles(self.bertos_srcdir, self.hwdir) | def _newCustomBertosProject(self): # Create/write/copy the common things self._newBertosProject() # Copy the clean hw files self._createDirectory(self.hwdir) # Copy all the hw files self._writeHwFiles(self.sources_dir, self.hwdir) # Destination user mk file self._writeUserMkFile() # Destination main.c file self._writeM... |
self._mergeSources(self.sources_dir, self.srcdir, self.old_srcdir) | self._mergeSources(self.bertos_maindir, self.srcdir, self.old_srcdir) | def _editBertosProject(self): # Write the project file self._writeProjectFile(os.path.join(self.maindir, "project.bertos")) if not self.is_preset: # Generate this files only if the project isn't a preset # VERSION file self._writeVersionFile(os.path.join(self.maindir, "VERSION")) # Destination makefile self._writeMakef... |
self._writeHwFiles(self.sources_dir, self.hwdir) | self._writeHwFiles(self.bertos_srcdir, self.hwdir) | def _editBertosProject(self): # Write the project file self._writeProjectFile(os.path.join(self.maindir, "project.bertos")) if not self.is_preset: # Generate this files only if the project isn't a preset # VERSION file self._writeVersionFile(os.path.join(self.maindir, "VERSION")) # Destination makefile self._writeMakef... |
self._writeCfgFiles(self.sources_dir, self.cfgdir) | self._writeCfgFiles(self.bertos_srcdir, self.cfgdir) | def _editBertosProject(self): # Write the project file self._writeProjectFile(os.path.join(self.maindir, "project.bertos")) if not self.is_preset: # Generate this files only if the project isn't a preset # VERSION file self._writeVersionFile(os.path.join(self.maindir, "VERSION")) # Destination makefile self._writeMakef... |
@property def sources_dir(self): | @property def bertos_maindir(self): | def old_srcdir(self): return self.infos.get("OLD_BERTOS_PATH", None) |
return self.sources_dir | return self.bertos_maindir | def src_hwdir(self): if self.from_preset: return os.path.join(self.infos["PRESET_PATH"], self.infos["PRESET_HW_PATH"]) else: return self.sources_dir |
for file_dependency in information["depends"]: if file_dependency in files: | for file_dependency in information["depends"] + tuple(files.keys()): | def csrcGenerator(project_info): modules = project_info.info("MODULES") files = project_info.info("FILES") if "harvard" in project_info.info("CPU_INFOS")["CPU_TAGS"]: harvard = True else: harvard = False # file to be included in CSRC variable csrc = [] # file to be included in PCSRC variable pcsrc = [] # files to be in... |
try | try: | def findModuleFiles(module, project_info): # Find the files related to the selected module cfiles = [] sfiles = [] # .c files related to the module and the cpu architecture for filename, path in project_info.searchFiles(module + ".c"): path = path.replace(project_info.info("SOURCES_PATH") + os.sep, "") path = replaceSe... |
The email address assoicated with the verification ID is | The email address associated with the verification ID is | def verify_emailAddress(self, verificationId): """Verify the email address associated with the verification ID ARGUMENTS verificationID: The verification code of the email address. RETURNS The email address associated with the verification ID. SIDE EFFECTS The email address assoicated with the verification ID is ver... |
email = r1['email'] s2 = uet.select() s2.append_whereclause(email == sa.func.lower(uet.c.email)) r2 = s2.execute().fetchone() if r2: return r2['user_id'] | return self.get_userIdByEmail(r1['email']) | def get_userIdByEmailVerificationId(self, verificationId): """Get the user ID from a email-verification ID """ da = self.zsqlalchemy uet = da.createTable('user_email') evt = da.createTable('email_verification') s1 = evt.select() s1.append_whereclause(evt.c.verification_id == verificationId) r1 = s1.execute().fetchone(... |
def __init__(self, name, screen, img_filename, position): | def __init__(self, name, screen, img, position): | def __init__(self, name, screen, img_filename, position): Sprite.__init__(self) self.name = name self.screen = screen self.pos = position self.image = pygame.image.load(img_filename).convert_alpha() # resize to fit screen self.image = adjust_image(self.image, self.screen) |
self.image = pygame.image.load(img_filename).convert_alpha() | self.image = img | def __init__(self, name, screen, img_filename, position): Sprite.__init__(self) self.name = name self.screen = screen self.pos = position self.image = pygame.image.load(img_filename).convert_alpha() # resize to fit screen self.image = adjust_image(self.image, self.screen) |
sprite = {} counter = 0 for continent, lst in countries.items(): for country in lst: filename = "images/" + country + ".png" img = pygame.image.load(filename).convert_alpha() sprite[country] = TerritorySprite(country, screen, filename, (0, 0)) texto = fonte.render(country, True, (255,255,255), (0, 0, 0)) pygame.draw.r... | sprite = loadCountries(countries) | def _point_is_inside(self, point): try: pix = self.image.get_at(point) return pix[3] > 0 except IndexError: return False |
if event.type == MOUSEBUTTONDOWN and pygame.mouse.get_pressed()[0]: | exit() elif event.type == MOUSEBUTTONDOWN and pygame.mouse.get_pressed()[0]: | def draw_screen(screen, territories, fundo, topo): screen.blit(fundo, (0, 0)) for country in territories.keys(): territories[country].blitme() screen.blit(topo, (0, 0)) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.