def handler (self, cmd) : i_enc = cmd.input_encoding tfmt = self.time_fmt = cmd.time_format for arg in cmd.argv : if arg == "-" : arg = "STDIN" output = Filename (".pdf", cmd.Output or arg).name if arg == "STDIN" : file_time = time.localtime () fn = output txt_in = sys.stdin.read () else : file_time = time.localtime (sos.path.getmtime (arg)) fn = self._display_filename (cmd, arg) with open (arg, "rb") as fi : txt_in = fi.read () txt = Untabified \ (pyk.decoded (txt_in, i_enc).lstrip ("\n\f").rstrip ()) ft = time.strftime (tfmt, file_time) options = self._pdf_opts (cmd, arg, fn, ft, output) if cmd.show_options : from _TFL.formatted_repr import formatted_repr print (formatted_repr (options)) ofn = options ["output"] pdf_doc = PDF_Doc (txt, ** options) if cmd.Display : subprocess.run ([cmd.display_program, ofn]) elif cmd.Print : subprocess.run ([cmd.print_program, ofn]) if cmd.purge_pdf and (cmd.Display or cmd.Print) : sos.unlink (ofn) elif cmd.verbose : print ("Created file", ofn)
def _new2cur (self, m) : join = sos.path.join path = self.path s = join (path, "new", m.name) t = m.path = join (path, "cur", m.name) sos.link (s, t) sos.unlink (s) m.email._pma_dir = "cur"
def delete_subbox (self, subbox) : """Delete this subbox and all messages contained inthis subbox.""" subbox.delete () self.change_list.append (PMA.SCM.Remove_Subbox (subbox)) self.change_count += 1 if subbox.supports_status and sos.path.isfile (subbox.status_fn) : ### a newly created mailbox without closing the application has no ### status file sos.unlink (subbox.status_fn) del self._box_dict [subbox.name]
def delete (self, * messages) : try : deleted = [] for m in messages : sos.unlink (m.path) del self._msg_dict [m.name] deleted.append (m) finally : self._messages = None self.change_list.append (PMA.SCM.Remove_Messages (* deleted)) self.change_count += len (messages)
def delete_database(cls, db_url): uri = db_url.path try: sos.unlink(uri) except OSError: pass x_uri = MOM.DBW.HPS.Store.X_Uri(uri).name try: sos.rmdir(x_uri, True) except OSError: pass
def delete_database (cls, db_url) : uri = db_url.path try : sos.unlink (uri) except OSError : pass x_uri = MOM.DBW.HPS.Store.X_Uri (uri).name try : sos.rmdir (x_uri, True) except OSError : pass
def download_pop (self, server, mdir) : md_name = PMA._Mailbox_.md_name result = 0 for msg_no, msg_size in self.pop_list (server) : email = self._new_email ("\n".join (server.retr (msg_no) [1])) name = md_name () tname = sos.path.join (mdir.path, "tmp", name) nname = sos.path.join (mdir.path, "new", name) PMA.save (tname, email.as_string ()) sos.link (tname, nname) sos.unlink (tname) server.dele (msg_no) result += 1 if self.finish : break return result
def delete_database(cls, db_url, manager): try: sos.unlink(db_url.path) except OSError: pass
def delete_file(self, name): full_name = sos.path.join(self.name, name) if self.last_file and self.last_file.name == full_name: self.closefile() self._remove_file(name) sos.unlink(full_name)
def _clear_dir (self) : for fod in sos.listdir_full (self.media_dir) : if sos.path.isdir (fod) : sos.rmdir (fod, True) else : sos.unlink (fod)
def delete_file (self, name) : full_name = sos.path.join (self.name, name) if self.last_file and self.last_file.name == full_name : self.closefile () self._remove_file (name) sos.unlink (full_name)
def delete_database (cls, db_url, manager) : try : sos.unlink (db_url.path) except OSError : pass