Python string.joinfields() Examples
The following are 23
code examples of string.joinfields().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
string
, or try the search function
.
Example #1
Source File: __init__.py From epdb with MIT License | 6 votes |
def do_mailstack(self, arg): tolist = arg.split() subject = '[Conary Stacktrace]' if 'stack' in self.__dict__: # when we're saving we always start from the top frame = self.stack[-1][0] else: frame = sys._getframe(1) while frame.f_globals['__name__'] in ('epdb', 'pdb', 'bdb', 'cmd'): frame = frame.f_back sender = os.environ['USER'] host = socket.getfqdn() extracontent = None if self._tb: lines = traceback.format_exception(self._exc_type, self._exc_msg, self._tb) extracontent = string.joinfields(lines, "") epdb_stackutil.mailStack(frame, tolist, sender + '@' + host, subject, extracontent) print("Mailed stack to %s" % tolist)
Example #2
Source File: __init__.py From conary with Apache License 2.0 | 6 votes |
def do_mailstack(self, arg): tolist = arg.split() subject = '[Conary Stacktrace]' if 'stack' in self.__dict__: # when we're saving we always # start from the top frame = self.stack[-1][0] else: frame = sys._getframe(1) while frame.f_globals['__name__'] in ('epdb', 'pdb', 'bdb', 'cmd'): frame = frame.f_back sender = os.environ['USER'] host = socket.getfqdn() extracontent = None if self._tb: lines = traceback.format_exception(self._exc_type, self._exc_msg, self._tb) extracontent = string.joinfields(lines, "") epdb_stackutil.mailStack(frame, tolist, sender + '@' + host, subject, extracontent) print "Mailed stack to %s" % tolist
Example #3
Source File: epdb_stackutil.py From conary with Apache License 2.0 | 5 votes |
def printTraceBack(tb=None, output=sys.stderr, exc_type=None, exc_msg=None): if isinstance(output, str): output = open(output, 'w') exc_info = sys.exc_info() if tb is None: tb = exc_info[2] if exc_type is None: exc_type = exc_info[0] if exc_msg is None: exc_msg = exc_info[1] if exc_type is not None: output.write('Exception: ') exc_info = '\n'.join(traceback.format_exception_only(exc_type, exc_msg)) output.write(exc_info) output.write('\n\n') lines = traceback.format_exception(exc_type, exc_msg, tb) output.write(string.joinfields(lines, "")) while tb: _printFrame(tb.tb_frame, output=output) tb = tb.tb_next
Example #4
Source File: PSDraw.py From keras-lambda with MIT License | 5 votes |
def text(self, xy, text): text = string.joinfields(string.splitfields(text, "("), "\\(") text = string.joinfields(string.splitfields(text, ")"), "\\)") xy = xy + (text,) self.fp.write("%d %d M (%s) S\n" % xy)
Example #5
Source File: javapath.py From CTFCrackTools with GNU General Public License v3.0 | 5 votes |
def normpath(path): """Normalize path, eliminating double slashes, etc.""" sep = os.sep if sep == '\\': path = path.replace("/", sep) curdir = os.curdir pardir = os.pardir import string # Treat initial slashes specially slashes = '' while path[:1] == sep: slashes = slashes + sep path = path[1:] comps = string.splitfields(path, sep) i = 0 while i < len(comps): if comps[i] == curdir: del comps[i] while i < len(comps) and comps[i] == '': del comps[i] elif comps[i] == pardir and i > 0 and comps[i-1] not in ('', pardir): del comps[i-1:i+1] i = i-1 elif comps[i] == '' and i > 0 and comps[i-1] <> '': del comps[i] else: i = i+1 # If the path is now empty, substitute '.' if not comps and not slashes: comps.append(curdir) return slashes + string.joinfields(comps, sep)
Example #6
Source File: javapath.py From CTFCrackTools with GNU General Public License v3.0 | 5 votes |
def normpath(path): """Normalize path, eliminating double slashes, etc.""" sep = os.sep if sep == '\\': path = path.replace("/", sep) curdir = os.curdir pardir = os.pardir import string # Treat initial slashes specially slashes = '' while path[:1] == sep: slashes = slashes + sep path = path[1:] comps = string.splitfields(path, sep) i = 0 while i < len(comps): if comps[i] == curdir: del comps[i] while i < len(comps) and comps[i] == '': del comps[i] elif comps[i] == pardir and i > 0 and comps[i-1] not in ('', pardir): del comps[i-1:i+1] i = i-1 elif comps[i] == '' and i > 0 and comps[i-1] <> '': del comps[i] else: i = i+1 # If the path is now empty, substitute '.' if not comps and not slashes: comps.append(curdir) return slashes + string.joinfields(comps, sep)
Example #7
Source File: dbrecio.py From PokemonGo-DesktopMap with MIT License | 5 votes |
def writelines(self, list): self.write(string.joinfields(list, ''))
Example #8
Source File: javapath.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
def normpath(path): """Normalize path, eliminating double slashes, etc.""" sep = os.sep if sep == '\\': path = path.replace("/", sep) curdir = os.curdir pardir = os.pardir import string # Treat initial slashes specially slashes = '' while path[:1] == sep: slashes = slashes + sep path = path[1:] comps = string.splitfields(path, sep) i = 0 while i < len(comps): if comps[i] == curdir: del comps[i] while i < len(comps) and comps[i] == '': del comps[i] elif comps[i] == pardir and i > 0 and comps[i-1] not in ('', pardir): del comps[i-1:i+1] i = i-1 elif comps[i] == '' and i > 0 and comps[i-1] <> '': del comps[i] else: i = i+1 # If the path is now empty, substitute '.' if not comps and not slashes: comps.append(curdir) return slashes + string.joinfields(comps, sep)
Example #9
Source File: javapath.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
def normpath(path): """Normalize path, eliminating double slashes, etc.""" sep = os.sep if sep == '\\': path = path.replace("/", sep) curdir = os.curdir pardir = os.pardir import string # Treat initial slashes specially slashes = '' while path[:1] == sep: slashes = slashes + sep path = path[1:] comps = string.splitfields(path, sep) i = 0 while i < len(comps): if comps[i] == curdir: del comps[i] while i < len(comps) and comps[i] == '': del comps[i] elif comps[i] == pardir and i > 0 and comps[i-1] not in ('', pardir): del comps[i-1:i+1] i = i-1 elif comps[i] == '' and i > 0 and comps[i-1] <> '': del comps[i] else: i = i+1 # If the path is now empty, substitute '.' if not comps and not slashes: comps.append(curdir) return slashes + string.joinfields(comps, sep)
Example #10
Source File: epdb_stackutil.py From epdb with MIT License | 5 votes |
def printTraceBack(tb=None, output=sys.stderr, exc_type=None, exc_msg=None): if isinstance(output, str): output = open(output, 'w') exc_info = sys.exc_info() if tb is None: tb = exc_info[2] if exc_type is None: exc_type = exc_info[0] if exc_msg is None: exc_msg = exc_info[1] if exc_type is not None: output.write('Exception: ') exc_info = '\n'.join(traceback.format_exception_only( exc_type, exc_msg)) output.write(exc_info) output.write('\n\n') lines = traceback.format_exception(exc_type, exc_msg, tb) output.write(string.joinfields(lines, "")) while tb: _printFrame(tb.tb_frame, output=output) tb = tb.tb_next
Example #11
Source File: action.py From conary with Apache License 2.0 | 5 votes |
def genExcepthook(self): def excepthook(type, exc_msg, tb): cfg = self.recipe.cfg sys.excepthook = sys.__excepthook__ if cfg.debugRecipeExceptions: lines = traceback.format_exception(type, exc_msg, tb) print string.joinfields(lines, "") if self.linenum is not None: prefix = "%s:%s:" % (self.file, self.linenum) prefix_len = len(prefix) if str(exc_msg)[:prefix_len] != prefix: exc_message = "%s:%s: %s: %s" % (self.file, self.linenum, type.__name__, exc_msg) print exc_message if self.recipe.buildinfo: try: buildinfo = self.recipe.buildinfo buildinfo.error = exc_message buildinfo.file = self.file buildinfo.lastline = self.linenum buildinfo.stop() except: log.warning("could not write out to buildinfo") if cfg.debugRecipeExceptions and self.recipe.isatty(): debugger.post_mortem(tb, type, exc_msg) else: sys.exit(1) return excepthook
Example #12
Source File: stackutil.py From conary with Apache License 2.0 | 5 votes |
def printTraceBack(tb=None, output=sys.stderr, exc_type=None, exc_msg=None): if isinstance(output, str): output = open(output, 'w') exc_info = sys.exc_info() if tb is None: tb = exc_info[2] if exc_type is None: exc_type = exc_info[0] if exc_msg is None: exc_msg = exc_info[1] if exc_type is not None: output.write('Exception: ') exc_info = '\n'.join(traceback.format_exception_only(exc_type, exc_msg)) output.write(exc_info) output.write('\n\n') lines = traceback.format_exception(exc_type, exc_msg, tb) output.write(string.joinfields(lines, "")) while tb: _printFrame(tb.tb_frame, output=output) tb = tb.tb_next
Example #13
Source File: wordnet.py From razzy-spinner with GNU General Public License v3.0 | 5 votes |
def __str__(self): """Return a human-readable representation. >>> str(N['dog'][0].synset) '{noun: dog, domestic dog, Canis familiaris}' """ return "{" + self.pos + ": " + string.joinfields(map(lambda sense:sense.form, self.getSenses()), ", ") + "}"
Example #14
Source File: PSDraw.py From CNCGToolKit with MIT License | 5 votes |
def text(self, xy, text): text = string.joinfields(string.splitfields(text, "("), "\\(") text = string.joinfields(string.splitfields(text, ")"), "\\)") xy = xy + (text,) self.fp.write("%d %d M (%s) S\n" % xy)
Example #15
Source File: javapath.py From medicare-demo with Apache License 2.0 | 5 votes |
def normpath(path): """Normalize path, eliminating double slashes, etc.""" sep = os.sep if sep == '\\': path = path.replace("/", sep) curdir = os.curdir pardir = os.pardir import string # Treat initial slashes specially slashes = '' while path[:1] == sep: slashes = slashes + sep path = path[1:] comps = string.splitfields(path, sep) i = 0 while i < len(comps): if comps[i] == curdir: del comps[i] while i < len(comps) and comps[i] == '': del comps[i] elif comps[i] == pardir and i > 0 and comps[i-1] not in ('', pardir): del comps[i-1:i+1] i = i-1 elif comps[i] == '' and i > 0 and comps[i-1] <> '': del comps[i] else: i = i+1 # If the path is now empty, substitute '.' if not comps and not slashes: comps.append(curdir) return slashes + string.joinfields(comps, sep)
Example #16
Source File: dbrecio.py From Splunking-Crime with GNU Affero General Public License v3.0 | 5 votes |
def writelines(self, list): self.write(string.joinfields(list, ''))
Example #17
Source File: codec010.py From qpid-python with Apache License 2.0 | 5 votes |
def write_map(self, m): sc = StringCodec() if m is not None: sc.write_uint32(len(m)) sc.write(string.joinfields(map(self._write_map_elem, m.keys(), m.values()), "")) self.write_vbin32(sc.encoded)
Example #18
Source File: PSDraw.py From mxnet-lambda with Apache License 2.0 | 5 votes |
def text(self, xy, text): text = string.joinfields(string.splitfields(text, "("), "\\(") text = string.joinfields(string.splitfields(text, ")"), "\\)") xy = xy + (text,) self.fp.write("%d %d M (%s) S\n" % xy)
Example #19
Source File: dbrecio.py From oss-ftp with MIT License | 5 votes |
def writelines(self, list): self.write(string.joinfields(list, ''))
Example #20
Source File: dbrecio.py From Computable with MIT License | 5 votes |
def writelines(self, list): self.write(string.joinfields(list, ''))
Example #21
Source File: dbrecio.py From BinderFilter with MIT License | 5 votes |
def writelines(self, list): self.write(string.joinfields(list, ''))
Example #22
Source File: dbrecio.py From ironpython2 with Apache License 2.0 | 5 votes |
def writelines(self, list): self.write(string.joinfields(list, ''))
Example #23
Source File: wordnet.py From razzy-spinner with GNU General Public License v3.0 | 5 votes |
def __str__(self): """Return a human-readable representation. >>> str(N['dog'][0].synset) '{noun: dog, domestic dog, Canis familiaris}' """ return "{" + self.pos + ": " + string.joinfields(map(lambda sense:sense.form, self.getSenses()), ", ") + "}"