summaryrefslogtreecommitdiff
path: root/pypers
diff options
context:
space:
mode:
authormichele.simionato <devnull@localhost>2007-12-02 11:16:46 +0000
committermichele.simionato <devnull@localhost>2007-12-02 11:16:46 +0000
commit8903a90556fc62d418c200c8eacd8de641c25c1d (patch)
tree692489aa9381cc8b94ef318ce2399c5f87166691 /pypers
parent20ce686b0193d67ea56823a30551140f88b3aee1 (diff)
downloadmicheles-8903a90556fc62d418c200c8eacd8de641c25c1d.tar.gz
Removed some cruft, as a test
Diffstat (limited to 'pypers')
-rwxr-xr-xpypers/nre.html123
-rwxr-xr-xpypers/x.txt213
-rwxr-xr-xpypers/xx.txt1
3 files changed, 0 insertions, 337 deletions
diff --git a/pypers/nre.html b/pypers/nre.html
deleted file mode 100755
index 035e8ff..0000000
--- a/pypers/nre.html
+++ /dev/null
@@ -1,123 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<meta name="generator" content="Docutils 0.2.9: http://docutils.sourceforge.net/" />
-<title>Module nre</title>
-<link rel="stylesheet" href="default.css" type="text/css" />
-</head>
-<body>
-<div class="document" id="module-nre">
-<h1 class="title">Module <tt class="literal"><span class="pre">nre</span></tt></h1>
-<p>nre - new style regular expressions</p>
-<p>The <tt class="literal"><span class="pre">nre</span></tt> module adopt an object-oriented approach to regular expressions.
-It provides only a class, <tt class="literal"><span class="pre">Regexp</span></tt>, which instances are regular expression
-objects, or reobj for short. It can be imported with</p>
-<blockquote>
-<pre class="doctest-block">
-&gt;&gt;&gt; from nre import Regexp
-</pre>
-</blockquote>
-<p>(notice that <tt class="literal"><span class="pre">from</span> <span class="pre">nre</span> <span class="pre">import</span> <span class="pre">*</span></tt> would have the same effect).</p>
-<div class="section" id="classes">
-<h1><a name="classes">Classes</a></h1>
-<p><tt class="literal"><span class="pre">class</span> <span class="pre">Regexp(object):</span></tt></p>
-<blockquote>
-<p>The class of regular expression objects. Instantiated with the signature</p>
-<p>reobj=Regexp(pattern,name=None,doc=None,isgroup=False)</p>
-<p>pattern is a (raw) string which can be associated with a valid
-regular expression; it the pattern contains an sequence ' #',
-only the chars on the left of ' #' are retained, whereas all
-the chars on the right of ' #' are assumed to be a comment.
-If you want to avoid this interpretation, you must escape #.
-Then the comment is stripped with the pattern and assigned with
-the docstring, unless an explicit docstring was already provided.
-if name is not None, associates a name to the reobj;
-if doc is not None, associates a docstring to the reobj;
-if isgroup is True, converts the regexp in a named group
-<tt class="literal"><span class="pre">(?P&lt;name&gt;regexp)</span></tt> or an numbered group <tt class="literal"><span class="pre">(regexp)</span></tt> if
-name is None.</p>
-<p>re-objects are callable. For instance</p>
-<pre class="doctest-block">
-&gt;&gt;&gt; a=Regexp('x # named group')('a')
-</pre>
-<p>returns a named group regular expression, whereas</p>
-<pre class="doctest-block">
-&gt;&gt;&gt; b=Regexp('x # numbered group')
-</pre>
-<p>returns a numbered group regexp.</p>
-<pre class="doctest-block">
-&gt;&gt;&gt; print a
-&gt;&gt;&gt; print b
-</pre>
-<p><tt class="literal"><span class="pre">compose(self,other,oper):</span></tt></p>
-<blockquote>
-Compose regular expression objects with strings or with themselves.
-<tt class="literal"><span class="pre">oper</span></tt> is one of the strings &quot;__add__&quot;, &quot;__radd__&quot;, &quot;__or__&quot;,
-&quot;__ror__&quot;.</blockquote>
-<p><tt class="literal"><span class="pre">__ror__(self,other):</span></tt></p>
-<blockquote>
-<p>Combines a regular expression object to a string
-or another reobj using <tt class="literal"><span class="pre">|</span></tt> . Works from the right. Example:</p>
-<pre class="doctest-block">
-&gt;&gt;&gt; print 'x' | Regexp('y')
-&lt;reobj '&lt;noname&gt;':x|y&gt;
-</pre>
-</blockquote>
-<p><tt class="literal"><span class="pre">__radd__(self,other):</span></tt></p>
-<blockquote>
-<p>Adds a regular expression object to a string or another
-reobj. Works from the right. Example:</p>
-<pre class="doctest-block">
-&gt;&gt;&gt; print 'x' + Regexp('y')
-&lt;reobj '&lt;noname&gt;':xy&gt;
-</pre>
-</blockquote>
-<p><tt class="literal"><span class="pre">__or__(self,other):</span></tt></p>
-<blockquote>
-<p>Combines a regular expression object to a string
-or to another reobj using <tt class="literal"><span class="pre">|</span></tt> . Works from the left. Example:</p>
-<pre class="doctest-block">
-&gt;&gt;&gt; print Regexp('x') | 'y'
-&lt;reobj '&lt;noname&gt;':x|y&gt;
-</pre>
-<p>Works well with named reobj too:</p>
-<pre class="doctest-block">
-&gt;&gt;&gt; a=Regexp('x',name='a')
-&gt;&gt;&gt; b=Regexp('y',name='b')
-&gt;&gt;&gt; print a|b
-&lt;reobj 'a__b':x|y&gt;
-</pre>
-</blockquote>
-<p><tt class="literal"><span class="pre">__add__(self,other):</span></tt></p>
-<blockquote>
-<p>Adds a regular expression object to a string or
-to another reobj. Works from the left. Example:</p>
-<pre class="doctest-block">
-&gt;&gt;&gt; print Regexp('x') + 'y'
-&lt;reobj '&lt;noname&gt;':xy&gt;
-</pre>
-<p>Works well with named reobj too:</p>
-<pre class="doctest-block">
-&gt;&gt;&gt; a=Regexp('x',name='a')
-&gt;&gt;&gt; b=Regexp('y',name='b')
-&gt;&gt;&gt; print a+b
-&lt;reobj 'a_b':xy&gt;
-</pre>
-</blockquote>
-<p><tt class="literal"><span class="pre">__call__(self,name=None):</span></tt></p>
-<blockquote>
-Returns a grouped regular expression object. The group is named
-if the regexp was already named or if an explicit name is passed.</blockquote>
-</blockquote>
-</div>
-</div>
-<hr class="footer"/>
-<div class="footer">
-<a class="reference" href="nre.rst">View document source</a>.
-Generated on: 2003-09-23 10:57 UTC.
-Generated by <a class="reference" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
-</div>
-</body>
-</html>
diff --git a/pypers/x.txt b/pypers/x.txt
deleted file mode 100755
index 35f3ffe..0000000
--- a/pypers/x.txt
+++ /dev/null
@@ -1,213 +0,0 @@
-
- ..
-
- M_A M_B
- : \ / :
- : \ / :
- A M_C B
- \ : /
- \ : /
- C
-
- co_firstlineno : int(x[, base]) -> integer
-
- Convert a string or number to an integer, if possible. A floating point
- argument will be truncated towards zero (this does not include a string
- representation of a floating point number!) When converting a string, use
- the optional base. It is an error to supply a base when converting a
- non-string. If the argument is outside the integer range a long object
- will be returned instead.
-
- co_code : str(object) -> string
-
- Return a nice string representation of the object.
- If the argument is a string, the return value is the same object.
-
- co_freevars : tuple() -> an empty tuple
- tuple(sequence) -> tuple initialized from sequence's items
-
- If the argument is a tuple, the return value is the same object.
-
- co_consts : tuple() -> an empty tuple
- tuple(sequence) -> tuple initialized from sequence's items
-
- If the argument is a tuple, the return value is the same object.
-
- co_name : str(object) -> string
-
- Return a nice string representation of the object.
- If the argument is a string, the return value is the same object.
-
- co_filename : str(object) -> string
-
- Return a nice string representation of the object.
- If the argument is a string, the return value is the same object.
-
- co_lnotab : str(object) -> string
-
- Return a nice string representation of the object.
- If the argument is a string, the return value is the same object.
-
- co_flags : int(x[, base]) -> integer
-
- Convert a string or number to an integer, if possible. A floating point
- argument will be truncated towards zero (this does not include a string
- representation of a floating point number!) When converting a string, use
- the optional base. It is an error to supply a base when converting a
- non-string. If the argument is outside the integer range a long object
- will be returned instead.
-
- co_nlocals : int(x[, base]) -> integer
-
- Convert a string or number to an integer, if possible. A floating point
- argument will be truncated towards zero (this does not include a string
- representation of a floating point number!) When converting a string, use
- the optional base. It is an error to supply a base when converting a
- non-string. If the argument is outside the integer range a long object
- will be returned instead.
-
- co_stacksize : int(x[, base]) -> integer
-
- Convert a string or number to an integer, if possible. A floating point
- argument will be truncated towards zero (this does not include a string
- representation of a floating point number!) When converting a string, use
- the optional base. It is an error to supply a base when converting a
- non-string. If the argument is outside the integer range a long object
- will be returned instead.
-
- co_argcount : int(x[, base]) -> integer
-
- Convert a string or number to an integer, if possible. A floating point
- argument will be truncated towards zero (this does not include a string
- representation of a floating point number!) When converting a string, use
- the optional base. It is an error to supply a base when converting a
- non-string. If the argument is outside the integer range a long object
- will be returned instead.
-
- co_cellvars : tuple() -> an empty tuple
- tuple(sequence) -> tuple initialized from sequence's items
-
- If the argument is a tuple, the return value is the same object.
-
- co_varnames : tuple() -> an empty tuple
- tuple(sequence) -> tuple initialized from sequence's items
-
- If the argument is a tuple, the return value is the same object.
-
- co_names : tuple() -> an empty tuple
- tuple(sequence) -> tuple initialized from sequence's items
-
- If the argument is a tuple, the return value is the same object.
-
-
- class Class(type):
- """Non-cooperative metaclass acting as a class factory. It accepts
- various kinds of objects and metaobjects as input (dictionaries, modules,
- classes etc). It automatically converts functions to static methods if
- the input object is not a class. If the first argument is a named object,
- the name of the created class is obtained by propending an underscore."""
-
- defaultname="InstanceOfClass"
- defaultbases=()
- defaultdic={}
-
- def __new__(meta, *args):
- metas=meta.__bases__[:-1]
- name=meta.defaultname
- bases=meta.defaultbases
- dic=meta.defaultdic
- # parse the arguments
- if not args:
- pass # do nothing
- elif len(args)==1:
- first=args[0]
- if isinstance(first,str): # is a name
- name=first
- elif hasattr(first,'__name__'): # has a name
- name=first.__name__+'_'
- if isinstance(first,tuple): # is a tuple
- bases+=first
- elif hasattr(first,'__bases__'): # is a class
- bases+=first.__bases__
- metas=type(first)+metas
- if isinstance(first,dict): # is a dict
- dic.update(first)
- elif hasattr(first,"__dict__"): # has a dict
- dic.update(first.__dict__)
- elif len(args)==2: # must be name,dic
- name,dic=args
- elif len(args)==3: # must be name,bases,dic
- name,bases,dic=args
- if not bases: # creating a class from a non-class
- condition=lambda name,attr: inspect.isfunction(attr)
- wrapdic(dic,staticmethod,condition)
- cls=child(*bases,**{'name':name,'dic':dic,'metas':metas})
- cls.__class__=meta; return cls
-
- class ClsFactory(object):
- "Bracket-callable non-cooperative class acting as a metaclass factory"
- class __metaclass__(type):
- def __getitem__(cls,*meta):
- meta+=(Class,) # base metaclasses
- name=''.join([m.__name__ for m in meta])
- return type(name,meta,{})
-
- #<oopp.py>
-
- class ClsFactory(object):
- """Bracket callable non-cooperative class acting as a factory of class
- factories.
-
- ClsFactory instances are class factories accepting 0,1,2 or 3 arguments.
- . It automatically converts functions to static methods
- if the input object is not a class. If an explicit name is not passed
- the name of the created class is obtained by adding an underscore to
- the name of the original object."""
-
- class __metaclass__(type):
- "Makes ClsFactory and its children bracket callable"
- def __getitem__(cls,metas):
- "Sets the default metaclass and returns a ClsFactory object"
- ClsFactory=cls() # a callable ClsFactory object
- ClsFactory.metas=metas
- return ClsFactory
-
- # customizable default attributes
- name="CreatedFromClsFactory"
- bases=()
- dict={}
-
- def __call__(self, *args):
- """Generates a new class using self.meta and avoiding conflicts.
- The first metaobject can be a dictionary, an object with a
- dictionary (except a class), or a simple name."""
- if len(args)==1:
- arg0=args[0]
- if isinstance(arg0,str): # is a name
- self.name=arg0
- elif hasattr(arg0,'__name__'): # has a name
- self.name=arg0.__name__+'_'
- self.setbasesdic(arg0)
- elif len(args)==2:
- self.name=args[0] # must be a name
- assert isinstance(name,str)
- self.setbasesdic(args[1])
- elif len(args)==3: # must be name,bases,dic
- self.name,self.bases,self,dic=args
- if len(args)<3 and not self.bases: # creating class from a non-class
- condition=lambda name,attr: inspect.isfunction(attr)
- wrapdic(self.dic,staticmethod,condition)
- return child(*bases,**vars(self))
-
- def setbasesdic(self,obj):
- if isinstance(obj,tuple): # is a tuple
- self.bases+=obj
- elif hasattr(obj,'__bases__'): # is a class
- self.bases+=obj.__bases__
- if isinstance(obj,dict): # is a dict
- self.dic.update(obj)
- elif hasattr(obj,"__dict__"): # has a dict
- self.dic.update(obj.__dict__)
-
-
- #</oopp.py>
diff --git a/pypers/xx.txt b/pypers/xx.txt
deleted file mode 100755
index a6582b0..0000000
--- a/pypers/xx.txt
+++ /dev/null
@@ -1 +0,0 @@
->>> execfile('psyco1.py',{})