mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Whitespace normalization, via reindent.py.
This commit is contained in:
parent
e6ddc8b20b
commit
182b5aca27
453 changed files with 31318 additions and 31452 deletions
|
@ -11,7 +11,7 @@ class cStringIO(Module):
|
|||
generality of StringIO, but it provides enough for most
|
||||
applications and is especially useful in conjunction with the
|
||||
pickle module.
|
||||
|
||||
|
||||
Usage:
|
||||
|
||||
from cStringIO import StringIO
|
||||
|
@ -20,7 +20,7 @@ class cStringIO(Module):
|
|||
an_output_stream.write(some_stuff)
|
||||
...
|
||||
value = an_output_stream.getvalue()
|
||||
|
||||
|
||||
an_input_stream = StringIO(a_string)
|
||||
spam = an_input_stream.readline()
|
||||
spam = an_input_stream.read(5)
|
||||
|
@ -36,7 +36,7 @@ class cStringIO(Module):
|
|||
|
||||
class InputType(Type):
|
||||
"Simple type for treating strings as input file streams"
|
||||
|
||||
|
||||
abbrev = "input"
|
||||
|
||||
struct = """\
|
||||
|
@ -121,7 +121,6 @@ class cStringIO(Module):
|
|||
|
||||
def writelines(self, lines):
|
||||
"""Write each string in lines."""
|
||||
|
||||
|
||||
|
||||
cStringIO.gen()
|
||||
|
||||
|
|
|
@ -4,5 +4,3 @@ The basic ideas is the same as modulator, but the code generates code
|
|||
using many of the new features introduced in Python 2.2. It also
|
||||
takes a more declarative approach to generating code.
|
||||
"""
|
||||
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ class ModuleMetaclass(BaseMetaclass):
|
|||
self.__types[name] = obj
|
||||
if obj.has_members():
|
||||
self.__members = True
|
||||
|
||||
|
||||
def initvars(self):
|
||||
v = self.__vars = {}
|
||||
filename = getattr(self, "__file__", None)
|
||||
|
@ -83,7 +83,7 @@ class ModuleMetaclass(BaseMetaclass):
|
|||
if self.__members:
|
||||
p(template.member_include)
|
||||
print >> f
|
||||
|
||||
|
||||
if self.__doc__:
|
||||
p(template.module_doc)
|
||||
|
||||
|
@ -98,7 +98,7 @@ class ModuleMetaclass(BaseMetaclass):
|
|||
p(template.module_init_start)
|
||||
for name, type in sortitems(self.__types):
|
||||
type.dump_init(f)
|
||||
|
||||
|
||||
p("}")
|
||||
|
||||
class Module:
|
||||
|
@ -121,7 +121,7 @@ class TypeMetaclass(BaseMetaclass):
|
|||
|
||||
for name, func in sortitems(self.__methods):
|
||||
func.dump(f)
|
||||
|
||||
|
||||
self.dump_methoddef(f, self.__methods, self.__vars)
|
||||
self.dump_memberdef(f)
|
||||
self.dump_slots(f)
|
||||
|
@ -199,7 +199,7 @@ class TypeMetaclass(BaseMetaclass):
|
|||
print >> f, templ % vars
|
||||
|
||||
if self.struct:
|
||||
p(template.dealloc_func, {"name" : self.__slots[TP_DEALLOC]})
|
||||
p(template.dealloc_func, {"name" : self.__slots[TP_DEALLOC]})
|
||||
|
||||
p(template.type_struct_start)
|
||||
for s in Slots[:-5]: # XXX
|
||||
|
@ -218,4 +218,3 @@ class TypeMetaclass(BaseMetaclass):
|
|||
|
||||
class Type:
|
||||
__metaclass__ = TypeMetaclass
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ class _ArgumentList(object):
|
|||
|
||||
def dump_decls(self, f):
|
||||
pass
|
||||
|
||||
|
||||
class NoArgs(_ArgumentList):
|
||||
|
||||
def __init__(self, args):
|
||||
|
@ -67,7 +67,7 @@ class NoArgs(_ArgumentList):
|
|||
return "PyObject *self"
|
||||
|
||||
class OneArg(_ArgumentList):
|
||||
|
||||
|
||||
def __init__(self, args):
|
||||
assert len(args) == 1
|
||||
super(OneArg, self).__init__(args)
|
||||
|
@ -139,7 +139,7 @@ class Function:
|
|||
|
||||
if self.__doc__:
|
||||
p(template.docstring)
|
||||
|
||||
|
||||
d = {"name" : self.vars["CName"],
|
||||
"args" : self.args.c_args(),
|
||||
}
|
||||
|
@ -149,13 +149,13 @@ class Function:
|
|||
|
||||
if self.args.ml_meth == METH_VARARGS:
|
||||
p(template.varargs)
|
||||
|
||||
|
||||
p(template.funcdef_end)
|
||||
|
||||
def analyze(self):
|
||||
self.__doc__ = self._func.__doc__
|
||||
self.args = ArgumentList(self._func, self.method)
|
||||
|
||||
|
||||
def initvars(self):
|
||||
v = self.vars = {}
|
||||
v["PythonName"] = self._func.__name__
|
||||
|
|
|
@ -35,7 +35,7 @@ def parse(s):
|
|||
line = line.strip()
|
||||
if line.startswith("}"):
|
||||
break
|
||||
|
||||
|
||||
assert line.endswith(";")
|
||||
line = line[:-1]
|
||||
words = line.split()
|
||||
|
|
|
@ -29,7 +29,7 @@ def parse(s):
|
|||
line = line.strip()
|
||||
if line.startswith("}"):
|
||||
break
|
||||
|
||||
|
||||
assert line.endswith(";")
|
||||
line = line[:-1]
|
||||
words = line.split()
|
||||
|
|
|
@ -20,11 +20,11 @@ static struct PyMethodDef %(MethodDefName)s[] = {"""
|
|||
|
||||
methoddef_def = """\
|
||||
{"%(PythonName)s", (PyCFunction)%(CName)s, %(MethType)s},"""
|
||||
|
||||
|
||||
methoddef_def_doc = """\
|
||||
{"%(PythonName)s", (PyCFunction)%(CName)s, %(MethType)s,
|
||||
%(DocstringVar)s},"""
|
||||
|
||||
|
||||
methoddef_end = """\
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
@ -96,7 +96,7 @@ module_add_type = """\
|
|||
type_struct_start = """\
|
||||
static PyTypeObject %(CTypeName)s = {
|
||||
PyObject_HEAD_INIT(0)"""
|
||||
|
||||
|
||||
type_struct_end = """\
|
||||
};
|
||||
"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue