From: REAL <root@mmedia2.kemsu.ru>
To: ALT Linux Team development discussions <devel@lists.altlinux.org>
Subject: [devel] python-module-gnuplot
Date: Mon, 28 Sep 2009 17:38:29 +0800
Message-ID: <4AC08415.8000401@mmedia2.kemsu.ru> (raw)
[-- Attachment #1: Type: text/plain, Size: 1019 bytes --]
Привет!
Возник вопрос при сборке модуля для python 2.6. Там есть поле, имя
которого является зарезервированным словом, и его приходится
переименовывать (см. вложение): with. Я, недолго думая (вообще,
забавно видеть такие "содержательные" названия полей ;) ),
переименовал его в with_, но это, конечно, как-то несуразно. Какое имя
ему лучше придумать? Дело в том, что в сизифе уже сидят пакеты,
которые я собираю с учётом и python 2.5, и python 2.6, и которые
зависят от python2.x(gnuplot), поэтому хорошо бы заранее договориться
об именованиях.
--
REAL aka Евгений Ростовцев, программист ЦНИТ КемГУ
[-- Attachment #2: python-module-gnuplot.patch --]
[-- Type: text/x-patch, Size: 6251 bytes --]
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=<string>' -- choose how item will be plotted, e.g.,
- with='points 3 3'.
+ 'with_=<string>' -- choose how item will be plotted, e.g.,
+ with_='points 3 3'.
'title=<string>' -- 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:
next reply other threads:[~2009-09-28 9:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-28 9:38 REAL [this message]
2009-09-28 9:46 ` Sergei Epiphanov
2009-09-29 3:47 ` REAL
2009-09-28 15:35 ` Alexey Morsov
2009-09-29 3:47 ` REAL
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4AC08415.8000401@mmedia2.kemsu.ru \
--to=root@mmedia2.kemsu.ru \
--cc=devel@lists.altlinux.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
ALT Linux Team development discussions
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \
devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
public-inbox-index devel
Example config snippet for mirrors.
Newsgroup available over NNTP:
nntp://lore.altlinux.org/org.altlinux.lists.devel
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git