From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on sa.int.altlinux.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00 autolearn=ham version=3.2.5 Message-ID: <4AC08415.8000401@mmedia2.kemsu.ru> Date: Mon, 28 Sep 2009 17:38:29 +0800 From: REAL User-Agent: Thunderbird 2.0.0.21 (X11/20090302) MIME-Version: 1.0 To: ALT Linux Team development discussions Content-Type: multipart/mixed; boundary="------------080802040305070500070901" Subject: [devel] python-module-gnuplot X-BeenThere: devel@lists.altlinux.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: ALT Linux Team development discussions List-Id: ALT Linux Team development discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Sep 2009 09:22:46 -0000 Archived-At: List-Archive: List-Post: This is a multi-part message in MIME format. --------------080802040305070500070901 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Привет! Возник вопрос при сборке модуля для python 2.6. Там есть поле, имя которого является зарезервированным словом, и его приходится переименовывать (см. вложение): with. Я, недолго думая (вообще, забавно видеть такие "содержательные" названия полей ;) ), переименовал его в with_, но это, конечно, как-то несуразно. Какое имя ему лучше придумать? Дело в том, что в сизифе уже сидят пакеты, которые я собираю с учётом и python 2.5, и python 2.6, и которые зависят от python2.x(gnuplot), поэтому хорошо бы заранее договориться об именованиях. -- REAL aka Евгений Ростовцев, программист ЦНИТ КемГУ --------------080802040305070500070901 Content-Type: text/x-patch; name="python-module-gnuplot.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="python-module-gnuplot.patch" diff --git a/gnuplot-py/PlotItems.py b/gnuplot-py/PlotItems.py index aa94e16..7dfd12e 100755 --- a/gnuplot-py/PlotItems.py +++ b/gnuplot-py/PlotItems.py @@ -85,8 +85,8 @@ class PlotItem: _option_list = { 'axes' : lambda self, axes: self.set_string_option( 'axes', axes, None, 'axes %s'), - 'with' : lambda self, with: self.set_string_option( - 'with', with, None, 'with %s'), + 'with_' : lambda self, with_: self.set_string_option( + 'with_', with_, None, 'with_ %s'), 'title' : lambda self, title: self.set_string_option( 'title', title, 'notitle', 'title "%s"'), } @@ -95,7 +95,7 @@ class PlotItem: _option_sequence = [ 'binary', 'index', 'every', 'thru', 'using', 'smooth', - 'axes', 'title', 'with' + 'axes', 'title', 'with_' ] def __init__(self, **keyw): @@ -103,8 +103,8 @@ class PlotItem: Keyword options: - 'with=' -- choose how item will be plotted, e.g., - with='points 3 3'. + 'with_=' -- choose how item will be plotted, e.g., + with_='points 3 3'. 'title=' -- set the title to be associated with the item in the plot legend. @@ -217,7 +217,7 @@ class Func(PlotItem): into gnuplot itself. The argument to the contructor is a string that should be a mathematical expression. Example:: - g.plot(Func('sin(x)', with='line 3')) + g.plot(Func('sin(x)', with_='line 3')) As shorthand, a string passed to the plot method of a Gnuplot object is also treated as a Func:: diff --git a/gnuplot-py/demo.py b/gnuplot-py/demo.py index 706ad63..89bb3c7 100755 --- a/gnuplot-py/demo.py +++ b/gnuplot-py/demo.py @@ -47,7 +47,7 @@ def demo(): # written to a temporary file once. d = Gnuplot.Data(x, y1, title='calculated by python', - with='points 3 3') + with_='points 3 3') g.title('Data can be computed by python or gnuplot') g.xlabel('x') g.ylabel('x squared') diff --git a/gnuplot-py/test.py b/gnuplot-py/test.py index 0da15ed..99a46d4 100755 --- a/gnuplot-py/test.py +++ b/gnuplot-py/test.py @@ -70,7 +70,7 @@ def main(): g.replot() wait('Style linespoints') - g.plot(Gnuplot.Func('sin(x)', with='linespoints')) + g.plot(Gnuplot.Func('sin(x)', with_='linespoints')) wait('title=None') g.plot(Gnuplot.Func('sin(x)', title=None)) wait('title="Sine of x"') @@ -83,7 +83,7 @@ def main(): wait('Original') g.plot(f) wait('Style linespoints') - f.set_option(with='linespoints') + f.set_option(with_='linespoints') g.plot(f) wait('title=None') f.set_option(title=None) @@ -100,20 +100,20 @@ def main(): g.plot(Gnuplot.File(filename1)) wait('Style lines') - g.plot(Gnuplot.File(filename1, with='lines')) + g.plot(Gnuplot.File(filename1, with_='lines')) wait('using=1, using=(1,)') - g.plot(Gnuplot.File(filename1, using=1, with='lines'), - Gnuplot.File(filename1, using=(1,), with='points')) + g.plot(Gnuplot.File(filename1, using=1, with_='lines'), + Gnuplot.File(filename1, using=(1,), with_='points')) wait('using=(1,2), using="1:3"') g.plot(Gnuplot.File(filename1, using=(1,2)), Gnuplot.File(filename1, using='1:3')) wait('every=5, every=(5,)') - g.plot(Gnuplot.File(filename1, every=5, with='lines'), - Gnuplot.File(filename1, every=(5,), with='points')) + g.plot(Gnuplot.File(filename1, every=5, with_='lines'), + Gnuplot.File(filename1, every=(5,), with_='points')) wait('every=(10,None,0), every="10::5"') - g.plot(Gnuplot.File(filename1, with='lines'), + g.plot(Gnuplot.File(filename1, with_='lines'), Gnuplot.File(filename1, every=(10,None,0)), Gnuplot.File(filename1, every='10::5')) @@ -127,7 +127,7 @@ def main(): wait('Original') g.plot(f) wait('Style linespoints') - f.set_option(with='linespoints') + f.set_option(with_='linespoints') g.plot(f) wait('using=(1,3)') f.set_option(using=(1,3)) @@ -154,8 +154,8 @@ def main(): g.plot(Gnuplot.Data(d, inline=0)) wait('Same thing, inline data') g.plot(Gnuplot.Data(d, inline=1)) - wait('with="lp 4 4"') - g.plot(Gnuplot.Data(d, with='lp 4 4')) + wait('with_="lp 4 4"') + g.plot(Gnuplot.Data(d, with_='lp 4 4')) wait('cols=0') g.plot(Gnuplot.Data(d, cols=0)) wait('cols=(0,1), cols=(0,2)') @@ -179,13 +179,13 @@ def main(): g.plot(Gnuplot.funcutils.compute_Data(x, lambda x: math.cos(x), inline=0)) wait('Same thing, inline data') g.plot(Gnuplot.funcutils.compute_Data(x, math.cos, inline=1)) - wait('with="lp 4 4"') - g.plot(Gnuplot.funcutils.compute_Data(x, math.cos, with='lp 4 4')) + wait('with_="lp 4 4"') + g.plot(Gnuplot.funcutils.compute_Data(x, math.cos, with_='lp 4 4')) print '############### test hardcopy ###############################' print '******** Generating postscript file "gp_test.ps" ********' wait() - g.plot(Gnuplot.Func('cos(0.5*x*x)', with='linespoints 2 2', + g.plot(Gnuplot.Func('cos(0.5*x*x)', with_='linespoints 2 2', title='cos(0.5*x^2)')) g.hardcopy('gp_test.ps') @@ -229,9 +229,9 @@ def main(): print '############### test splot ##################################' wait('a 3-d curve') - g.splot(Gnuplot.Data(d, with='linesp', inline=0)) + g.splot(Gnuplot.Data(d, with_='linesp', inline=0)) wait('Same thing, inline data') - g.splot(Gnuplot.Data(d, with='linesp', inline=1)) + g.splot(Gnuplot.Data(d, with_='linesp', inline=1)) print '############### test GridData and compute_GridData ##########' # set up x and y values at which the function will be tabulated: --------------080802040305070500070901--