{'x': 1, 'y': 2}
## but actual is: {'x': 0}
Python: 2.7.3
OS: MacOS X
--
regards,
makoto kuwata
--
http://mail.python.org/mailman/listinfo/python-list
e object taken from a function which
> uses a different a bytecode (STORE_FAST instead of STORE_NAME):
>
Is there any way to use STORE_FAST instead of STORE_NAME?
exec("string", ...) is not a solution for me.
# What is different between fn.func_code and compile("string")?
--
regards,
makoto kuwata
--
http://mail.python.org/mailman/listinfo/python-list
'tenjin.JS_FUNC' to run client-side code.
How to use it::
pp = [ tenjin.JavaScriptPreprocessor() ]
engine = tenjin.Engine(pp=pp)
output = engine.render('example.pyhtml', {})
print(html)
* [Enhance] Now supports Jython 2.5.2. (thanks to Lars Hupfeldt Nielsen)
* [Enhance] Now supports PyPy 1.7 or later officially.
* [Change] Template#convert() now converts "\r\n" into "\\r\n".
This is necessary to follow change of language specification on
Python 2.7 and 3.2.
Have fun!
--
makoto kuwata
--
http://mail.python.org/mailman/listinfo/python-list
-prefix or --install-scripts options, but it is
too troublesome for me to specify them in command line every time.
--
regards,
makoto kuwata
--
http://mail.python.org/mailman/listinfo/python-list
On Sun, Jun 10, 2012 at 11:55 AM, Ned Deily wrote:
> In article
> ,
> Makoto Kuwata wrote:
>
>> Hi,
>>
>> "setup.py install" command supports options such as --prefix,
>> --install-scripts, and so on.
>> For example:
>>
>> $ py
stutils script, unless it
> is overridden by a $PWD/setup.cfg file with an [install] section.
Thank you Ned, I'm clear.
You mean that there is no environment variable equivarent to options,
therefore I should create configuration file of distutils.
I'll try it. Thank you.
--
regards,
makoto kuwata
--
http://mail.python.org/mailman/listinfo/python-list
x27;ok(str1) == str2' displays diff if text1 != text2, even when using
with unittest module.
* Assertion ``raises()`` supports regular expression to check error message.
* Helper functions in oktest.dummy module are now available as decorator.
* 'AssertionObject.expected' is rename
I published presentation slide about Oktest.
If you have interested in testing, check it out.
http://www.slideshare.net/kwatch/oktest-a-new-style-testing-library-for-python
--
regards,
makoto kuwata
On Sat, Aug 27, 2011 at 9:37 PM, Makoto Kuwata wrote:
> Hi,
>
> I released Okt
Hi,
I have a trouble around __import__().
The following sample code works well on Python <= 3.3,
but it raises ImportError on Python >= 3.4.
## importtest.py
import sys, os, shutil
def test(name):
try:
## create 'foo/__init__.py' file
os.mkdir(name)
On Thu, Jun 2, 2016 at 11:15 PM, Michael Selik
wrote:
>
>
> On Thu, Jun 2, 2016 at 10:06 AM Makoto Kuwata wrote:
>
>> os.mkdir(name)
>> with open(name + "/__init__.py", 'w') as f:
>> f.write("X=1&
On Sat, Jun 4, 2016 at 3:15 AM, MRAB wrote:
> On 2016-06-03 06:48, Makoto Kuwata wrote:
>
> On Fri, Jun 3, 2016 at 9:31 AM, MRAB > pyt...@mrabarnett.plus.com>> wrote:
>>
>> On 2016-06-02 15:04, Makoto Kuwata wrote:
>>
>> Hi,
>&g
On Tue, Jun 7, 2016 at 7:28 AM, Michael Selik
wrote:
> On Thu, Jun 2, 2016 at 10:06 AM Makoto Kuwata wrote:
>
>> I have a trouble around __import__().
>>
>
> The docs for __import__ strongly recommend that you use importlib instead
> https://docs.python.org
On Wed, Jun 8, 2016 at 10:24 PM, Michael Selik
wrote:
> By the way, why choose to write, import, and delete modules? I'd think
> exec'ing code would be sufficient.
>
>
In order to test my own framework for web application.
It loads controller classes lazily. In other words, it loads python module
Hi, folks.
I know that it is not possible to change local vars via `locals()` (except
in module-level).
```
import sys
def f1():
x = 1
d = locals()
d['x'] = 2
print(x) #=> 1 (not changed)
f1()
```
But I found that it is possible in class definition.
```
import sys
class Foo
todo decorator now supports fixture injection. ::
@test('example')
@todo # error on previous version but not on this release
def _(self, x):
assert False
You can see all enhancements and changes. See
http://www.kuwata-lab.com/oktest/oktest-py_CHANGES.txt
Have fun!
--
regards,
makoto kuwata
--
https://mail.python.org/mailman/listinfo/python-list
x27;, '/')
ok (resp).is_response(200).json({"message": "Hello!"})
## or
status, headers, body = http.GET('/') # or http('GET',
'/')
ok (status) == '200 OK'
ok (headers) == [('Content-Type', 'application/json')]
ok (body)== [b'''{"message":"Hello!"}''']
if __name__ == '__main__':
oktest.main()
--
regars,
makoto kuwata
--
https://mail.python.org/mailman/listinfo/python-list
0.3674 (= 0.4009 - 0.0335)
concat 0.4192 (= 0.4527 - 0.0335)
format 0.4765 (= 0.5100 - 0.0335)
=======
See http://pythonhosted.org/Benchmarker/ for details.
Have fun!
--
regards,
makoto kuwata
--
https://mail.python.org/mailman/listinfo/python-list
o parse user-defined properties in command-line.
* Add description about user-defined properties.
* Fix example code to work on Python 2.6.
* Fix test script.
--
regards,
makoto kuwata
On Mon, Dec 15, 2014 at 9:43 PM, Makoto Kuwata wrote:
>
> I released Benchmarker ver 4.0.0
> http://pyp
info[0] == 3
if 0 and python3:
from beaker.crypto import hmac as HMAC, hmac_sha1 as SHA1
from beaker.session import SignedCookie
def value_encode(self, val):
#sig = HMAC.new(self.secret, val.encode('UTF-8'), SHA1).hexdigest()
sig = HMAC.new(self.secret, val, SHA1).hex
Congrat!
By the way, I can't find Python-3.3.4.tar.bz2 in:
http://www.python.org/ftp/python/3.3.4/
Python-3.3.{1,2,3}.tar.bz2 and Python-3.4.0.tar.bz2 are provided,
but Python-3.3.4.tar.bz2 is not. Why?
# I hope that Python-3.3.4.tar.bz2 is also provided.
--
regards,
makoto kuwata
O
is added.
It is convenient to test complex data structure.
Example::
from oktest.validator import Validator as V
ok (resp.body_json) == {
"status": "OK",
"member": {
"name": "Haruhi",
"gen
turn n * func(*args, **kwargs)
return newfunc
@multiply 4 # ex: @decorator arg1, arg2, arg3
def f1(x, y):
return x+y
How do you think about this idea?
--
regards,
makoto kuwata
--
https://mail.python.org/mailman/listinfo/python-list
ython 2.7.
http://bugs.python.org/issue16611
My question: Is there any plan to backport the fix to Python 2.7?
--
regards,
makoto kuwata
--
https://mail.python.org/mailman/listinfo/python-list
Sorry, I failed to post reply:
-- Forwarded message --
From: Makoto Kuwata
Date: Wed, Jun 18, 2014 at 5:32 PM
Subject: Re: Backport fix on #16611 to Python 2.7
To: Terry Reedy
On Wed, Jun 18, 2014 at 12:31 PM, Terry Reedy wrote:
>
> Do you have any plan to upgrade to 3
):
File "hoge.py", line 7, in
obj = Foo()
TypeError: Required argument 'year' (pos 1) not found
It seems to be failed to override datetime.__init__() in subclass.
--
regards,
makoto kuwata
--
https://mail.python.org/mailman/listinfo/python-list
t;
> Maybe that helps, maybe it doesn't, but the issue you're seeing is
> specific to that class.
>
Got it! Thank you!
--
regards,
makoto kuwata
--
https://mail.python.org/mailman/listinfo/python-list
options.
* [bugfix] oktest.web.WSGITest now works on Python 3.4.
* [bugfix] fix oktest.web.WSGITest class to encode urlpath when multibyte.
See http://www.kuwata-lab.com/oktest/oktest-py_CHANGES.txt for details.
--
regards,
makoto kuwata
--
https://mail.python.org/mailman/listinfo/python-list
Question about 'yield from'.
I understand that::
yield from xs
is syntax suger of::
for x in xs:
yield x
And::
val = yield from xs
is same as::
for x in xs:
ret = yield x
val = ret
Is it true? Do I understand correctly?
quote from
https://docs.python.org/3
On Thu, Aug 14, 2014 at 6:38 PM, Chris Angelico wrote:
> On Thu, Aug 14, 2014 at 7:35 PM, Makoto Kuwata wrote:
> > I understand that::
> >
> > yield from xs
> >
> > is syntax suger of::
> >
> > for x in xs:
> > yield x
>
>
On Thu, Aug 14, 2014 at 7:02 PM, Chris Angelico wrote:
> On Thu, Aug 14, 2014 at 7:59 PM, Makoto Kuwata wrote:
> > I understand that 'val = yield from xs' is completely different from::
> >
> >for x in xs:
> > ret = yield x
> >va
need to install pyKook at all.
* Argument description is available.
* Private spice option is available.
* New command 'pushd()' provided.
See http://www.kuwata-lab.com/kook/pykook-CHANGES.txt for details.
Have fun!
--
regards,
makoto kuwata
--
http://mail.python.org/mailman/listinfo/python-list
quot;Good Bye!")
print("*** type(Greeting.hello)=%r" % type(Greeting.hello)
#=>
print("*** type(Greeting.goodbye)=%r" % type(Greeting.goodbye)
#=>
Could you give me advice?
--
regards,
makoto kuwata
--
http://mail.python.org/mailman/listinfo/python-list
ethod(v))
> return class_
>
> @FuncGroup
> class Greeting(object):
> def hello():
> print("Hello!")
>
> # Python 2.5
> class Greeting(object):
> def hello():
> print("Hello!")
> Greeting = FuncGroup(Greeting)
This is so good method.
Thank you, Ian.
--
regards,
makoto kuwata
--
http://mail.python.org/mailman/listinfo/python-list
) == staticmethod
from types import FunctionType
assert type(apache.start) == FuntionType
This makes execution of other recipes in category easier::
class apache(Category):
@recipe
def start(c):
...
@recipe
def stop(c):
...
@recipe
def restart(c):
apache.start(c)# execute other recipe
apache.stop(c) # execute other recipe
* (internal) kook.config.stdout and kook.config.stderr are removed.
See http://www.kuwata-lab.com/kook/pykook-CHANGES.txt for details.
Have fun!
--
regards,
makoto kuwata
--
http://mail.python.org/mailman/listinfo/python-list
ef _(self):
...
@test("spec2")
def _(self):
...
with situation("else:"):
@test("spec3")
def _(self):
...
Output exmple::
$ python test/example_test.py
* class 'Sample'
+ method1()
+ when condition:
- [ok] spec1
- [ok] spec2
+ else:
- [ok] spec3
## total:3, passed:3, failed:0, error:0, skipped:0 (elapsed 0.000)
--
regards,
makoto kuwata
--
http://mail.python.org/mailman/listinfo/python-list
e.py' correctly.
* foobar.egg created by 'easy_install bdist' doesn't contain
'foobar/data/template.py' file.
Question: how can I enforce easy_install command to
install 'foobar/data/template.py' (or non-package *.py file)?
--
regars,
makoto kuwata
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, Nov 9, 2011 at 4:09 AM, Terry Reedy wrote:
> On 11/7/2011 11:32 PM, Makoto Kuwata wrote:
>>
>> I got trouble about easy_install command.
>>
>> My package:
>>
>> README.rst
>> setup.py
>> foobar/
>> foobar/__init__.py
&g
On Thu, Nov 10, 2011 at 9:58 AM, Makoto Kuwata wrote:
> On Wed, Nov 9, 2011 at 4:09 AM, Terry Reedy wrote:
>> On 11/7/2011 11:32 PM, Makoto Kuwata wrote:
>>>
>>> I got trouble about easy_install command.
>>>
>>> My package:
>>>
>>>
(python setup.py install) or using pip, so be sure to test both
> ways.
'package_data' is the solution for my trouble.
Thank you very much, Jonathan.
--
regards,
makoto kuwata
--
http://mail.python.org/mailman/listinfo/python-list
/*.py' into .egg file
--regads,makoto kuwata
On Sat, Nov 5, 2011 at 3:06 PM, Makoto Kuwata wrote:
> Hi,
>
> I have released pyKook 0.7.0.
> http://pypi.python.org/pypi/Kook/
> http://www.kuwata-lab.com/kook/
> http://www.kuwata-lab.com/kook/pykook-users-guide.html
>
st.py # or python -m picotest example_test.py
example_test.py
* type 'str'
* operator '*'
- [passed] repeats string N times.
- [passed] returns empty string when N is negative.
## total:2, passed:2, failed:0, error:0, skipped:0, todo:0
See http://pypi.python.org/pypi/PicoTest for details.
--
regards,
makoto kuwata
--
http://mail.python.org/mailman/listinfo/python-list
Is it possible to specify PREFIX directory for pip command by
environment variable?
I found that 'pip install --install-option=--prefix=PREFIX' works well,
but I don't want to specify '--install-option=--prefix=PREFIX' every time.
I prefer to specify it by environment variable such as::
expor
On Tue, Nov 15, 2011 at 11:33 PM, Marc Christiansen
wrote:
>
> I'd try
> export PIP_INSTALL_OPTION=--prefix=$PWD/local
It works very well. Thank you.
--
regards,
makoto
>
> using a config file is also possible. See
> http://www.pip-installer.org/en/latest/configuration.html
>
> Ciao
> Marc
> -
I released Oktest.py 0.11.0.
http://pypi.python.org/pypi/Oktest/
http://packages.python.org/Oktest/
Oktest.py is a new-style testing library for Python.
::
from oktest import ok, NG
ok (x) > 0 # same as assertTrue(x > 0)
ok (s) == 'foo'# same as assertEqual
ormed at:
http://www.kuwata-lab.com/support/
Release 0.6.1:
[Enhancements]
* Benchmark script ('benchmark/bench.py') is rewrited.
* Benchmark supports Genshi, Mako, and Templetor.
* Add examples.
[Bugfix]
* Typo in User's Guide is fixed.
--
makoto kuwata
--
http://mai
bed in the above web page.
Could you help me why the above error happen?
Is it required to set registered name (Tenjin) and
package name (pyTenjin) into same name?
--
makoto kuwata
--
http://mail.python.org/mailman/listinfo/python-list
.kuwata-lab.com/tenjin/pytenjin-examples.html
--
regards,
makoto kuwata
--
http://mail.python.org/mailman/listinfo/python-list
On 2008-02-25, Richard Jones <[EMAIL PROTECTED]> wrote:
> makoto kuwata wrote:
> > Is it required to set registered name (Tenjin) and
> > package name (pyTenjin) into same name?
>
> Yes.
>
Thank you, Richard.
Your answer helps me very much.
> How did you upload
e = 'pyTenjin'
> +name = 'Tenjin'
> version = '0.6.1'
> author = 'makoto kuwata'
> email = '[EMAIL PROTECTED]'
>
> ---END PATCH---
Thank you, Vsevolod.
Your patch shows that both project name (Tenjin) and package name
ails.
New release of pyTenjin will be informed at:
http://www.kuwata-lab.com/support/
Release 0.6.2:
[Changes]
* When '-S', '-a retrieve', '-X', or '-a statements' specified,
pytenjin command replaces text before expressions into spaces
and p
tr[0]) == [obj, 'm1', (1,), {}, 100]
ok (tr[1]) == [obj, 'm2', (2,), {}, 200]
Example to fake function call::
def f(x):
return x*2
## fake a function
def dummy(original_func, x):
#return original_func(x)
return 'x=%s' % repr(x)
from oktest.tracer import Tracer
tr = Tracer()
f = tr.fake_func(f, dummy)
## call function
ok (f(3)) == 'x=3'
## check results
ok (tr[0]) == [None, 'f', (3,), {}, 'x=3']
Have a nice weekend!
--
regards,
makoto kuwata
--
http://mail.python.org/mailman/listinfo/python-list
quot;"
* fix 'oktest.tracer.Call#__repr__()' to change output according to
whether '==' is called or not. This is aimed to make output of
'ok(tr[0]) == [...]' to be more readable.
* change 'Runner#run()' to skip AssertionError if it is raised by
'assert ' and not 'ok() == ...'.
* fix example code for some helper functions.
--
regards,
makoto kuwata
--
http://mail.python.org/mailman/listinfo/python-list
cond) format. ::
import benchmarker
benchmarker.format.label_with = 30
benchmarker.format.time = '%9.4f'
* Followings are removed.
* Benchmark.stat
* Benchmark.compared_matrix()
* Benchmark.print_compared_matrix()
Have fun!
--
regards,
makoto kuwata
--
http://mail.python.org/mailman/listinfo/python-list
est, run
class StrTest(object):
def test_upper(self):
if spec("returns upper case string"):
ok ("sos".upper()) == "SOS"
if spec("doesn't change non-alphabetics"):
ok ("sos123<>".upper()) == "SOS123<>"
if __name__ == "__main__":
run()
## terminal
$ SPEC="returns upper case string" python test1.py
* fix ``oktest.run()`` to print correct traceback if ok() is called from
nested function.
* fix content of README.txt.
--
regards,
makoto kuwata
--
http://mail.python.org/mailman/listinfo/python-list
on decorator syntax.
Why does this limitation exist?
I want to chain methods as a certain DSL, just like:
@recipe().product('*.html').ingreds('$(1).rst')
def file_html(c):
system(c%"rst2html.py $(ingred) > $(product)")
If you know the reason of
ere any technical reason? Or Ideological reason?
--
regards,
makoto kuwata
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, Feb 17, 2011 at 11:40 AM, MRAB wrote:
> On 17/02/2011 01:55, Makoto Kuwata wrote:
>>
>> Thank you MRAB,
>>
>> On Thu, Feb 17, 2011 at 8:49 AM, MRAB wrote:
>>>
>>> You may want to read the discussion at:
>>>
>>>
>&g
quot;'" into "'".
* new_cycle() is moved from tenjin.helpers.html module to tenjin.helpers
module because it is not only for HTML.
* In GAE environment, Tenjin uses '1.1' as dummy value of CURRENT_VERSION_ID
when it is not provided. This prevents error when using GAE and tenjin
on test environment.
* Python 2.3 is now unsupported. (Python 2.4 is still supported because
CentOS uses Python 2.4).
* (internal) Tenjin.escape_expr_and_escapeflag() is changed to
Tenjin.escape_expr_and_flags().
* (internal) Tenjin.add_expr() is changed to take 'flags' argument.
* (internal) 'tenjin.__release__' is renamed to 'tenjin.__version__'.
Bugfixes
* Cache file saving was failed on Windows because existing file should be
removed before renaming file. (patched by elishowk, thank you!)
Thank you.
--
regards,
makoto kuwata
--
http://mail.python.org/mailman/listinfo/python-list
;f.exception' after 'ok (f).raises(Exception)'
to get raised exception object. For example::
def f():
int('foobar')
ok (f).raises(ValueError)
ok (f.exception.message) == "invalid literal for int() with base
10: 'foobar'"
* C
o '*.o'""" # recipe description
system(c%"$(CC) $(CFLAGS) -c $(ingred)")
example of command-line:
~/tmp> kk all
### ** hello.o (recipe=file_o)
$ gcc -g -O2 -c hello.c
### * all (recipe=task_all)
--
regards,
makoto kuwata
--
http://mail.python.org/mailman/listinfo/python-list
ple:
#('fib(34)', 4.37, 0.02, 4.39, 4.9449)
#('fib(35)', 7.15, 0.05, 7.20, 8.0643)
* Time format is changed from '%10.4f' to '%9.3f'
* Changed to run full-GC for each benchmarks
--
regards,
makoto kuwata
--
http://mail.python.org/mailman/listinfo/python-list
Terry,
Thank you for trying Benchmarker.
On Sun, Jun 27, 2010 at 7:15 AM, Terry Reedy wrote:
> On 6/26/2010 1:09 PM, Makoto Kuwata wrote:
>>
>> I released Benchmarker 1.1.0.
>> http://pypi.python.org/pypi/Benchmarker/
>>
>> Benchmarker is a small utility to benc
# invoke tests
if __name__ == '__main__':
from oktest import run
run(Example1Test, Example2Test)
## or
#run('.*Test$') # specify class names by regular expression
Changes in release 0.4.0
* enhanced to support 'ok (x).in_delta(y, d)' which raises assertion exception
unless y-d < x < y+d.
* change test script to support Python 2.7 and 3.x.
* fixed a few bugs.
Have fun!
--
regards,
makoto kuwata
--
http://mail.python.org/mailman/listinfo/python-list
'doc/faq.html' is integrated into 'doc/users-guide.html'.
* All test scripts are changed to import oktest instead of unittest.
Bug fixes
-
* Fixed to set correct file path of template object which is loaded
from cache.
* Fixed a bug that 'pytenjin -sbN' didn't trim line number on the last line
Have fun!
--
regards,
makoto kuwata
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
Is there any *just right* python code to refactor?
In other words, I'm finding bad code example in python.
(background)
I'm teaching Python to some novice programmer, and
want to show refactoring example to them.
(required)
* not good code
* not too large (for novice programmer)
* not too co
ithub, but didn't find bad Python code.
--
regards,
makoto kuwata
On Wed, Feb 15, 2017 at 3:28 PM, Steven D'Aprano
wrote:
> On Wed, 15 Feb 2017 07:44:03 +0900, Makoto Kuwata wrote:
>
> > Hi,
> >
> > Is there any *just right* python code to refactor?
> > In o
elf._cars:
print('-' * car.position)
def run(self, n_rounds=5):
self.report()
for _ in range(n_rounds):
self.round()
self.report()
if __name__ == '__main__':
Race(3).run(5)
--
regards,
makoto kuwata
--
https://mail.python.org/mailman/listinfo/python-list
s will be shown to my students.
https://github.com/dotancohen/burton/pull/20/files
I hope you favor this PR.
--
regards,
makoto kuwata
--
https://mail.python.org/mailman/listinfo/python-list
68 matches
Mail list logo