FunctionDef('compile', arguments([arg('self', None), arg('sources', None), arg('output_dir', None), arg('macros', None), arg('include_dirs', None), arg('debug', None), arg('extra_preargs', None), arg('extra_postargs', None), arg('depends', None)], None, None, [], None, None, [Name('None'), Name('None'), Name('None'), Num(0), Name('None'), Name('None'), Name('None')], []), [If(UnaryOp(Not(), Attribute(Name('self'), 'initialized')), [Expr(Call(Attribute(Name('self'), 'initialize'), [], [], None, None))], []), Assign([Name('compile_info')], Call(Attribute(Name('self'), '_setup_compile'), [Name('output_dir'), Name('macros'), Name('include_dirs'), Name('sources'), Name('depends'), Name('extra_postargs')], [], None, None)), Assign([Tuple([Name('macros'), Name('objects'), Name('extra_postargs'), Name('pp_opts'), Name('build')])], Name('compile_info')), Assign([Name('compile_opts')], BoolOp(Or(), [Name('extra_preargs'), List([])])), Expr(Call(Attribute(Name('compile_opts'), 'append'), [Str('/c')], [], None, None)), If(Name('debug'), [Expr(Call(Attribute(Name('compile_opts'), 'extend'), [Attribute(Name('self'), 'compile_options_debug')], [], None, None))], [Expr(Call(Attribute(Name('compile_opts'), 'extend'), [Attribute(Name('self'), 'compile_options')], [], None, None))]), For(Name('obj'), Name('objects'), [TryExcept([Assign([Tuple([Name('src'), Name('ext')])], Subscript(Name('build'), Index(Name('obj'))))], [ExceptHandler(Name('KeyError'), None, [Continue()])], []), If(Name('debug'), [Assign([Name('src')], Call(Attribute(Attribute(Name('os'), 'path'), 'abspath'), [Name('src')], [], None, None))], []), If(Compare(Name('ext'), [In()], [Attribute(Name('self'), '_c_extensions')]), [Assign([Name('input_opt')], BinOp(Str('/Tc'), Add(), Name('src')))], [If(Compare(Name('ext'), [In()], [Attribute(Name('self'), '_cpp_extensions')]), [Assign([Name('input_opt')], BinOp(Str('/Tp'), Add(), Name('src')))], [If(Compare(Name('ext'), [In()], [Attribute(Name('self'), '_rc_extensions')]), [Assign([Name('input_opt')], Name('src')), Assign([Name('output_opt')], BinOp(Str('/fo'), Add(), Name('obj'))), TryExcept([Expr(Call(Attribute(Name('self'), 'spawn'), [BinOp(BinOp(BinOp(List([Attribute(Name('self'), 'rc')]), Add(), Name('pp_opts')), Add(), List([Name('output_opt')])), Add(), List([Name('input_opt')]))], [], None, None))], [ExceptHandler(Name('DistutilsExecError'), 'msg', [Raise(Call(Name('CompileError'), [Name('msg')], [], None, None), None)])], []), Continue()], [If(Compare(Name('ext'), [In()], [Attribute(Name('self'), '_mc_extensions')]), [Assign([Name('h_dir')], Call(Attribute(Attribute(Name('os'), 'path'), 'dirname'), [Name('src')], [], None, None)), Assign([Name('rc_dir')], Call(Attribute(Attribute(Name('os'), 'path'), 'dirname'), [Name('obj')], [], None, None)), TryExcept([Expr(Call(Attribute(Name('self'), 'spawn'), [BinOp(BinOp(List([Attribute(Name('self'), 'mc')]), Add(), List([Str('-h'), Name('h_dir'), Str('-r'), Name('rc_dir')])), Add(), List([Name('src')]))], [], None, None)), Assign([Tuple([Name('base'), Name('_')])], Call(Attribute(Attribute(Name('os'), 'path'), 'splitext'), [Call(Attribute(Attribute(Name('os'), 'path'), 'basename'), [Name('src')], [], None, None)], [], None, None)), Assign([Name('rc_file')], Call(Attribute(Attribute(Name('os'), 'path'), 'join'), [Name('rc_dir'), BinOp(Name('base'), Add(), Str('.rc'))], [], None, None)), Expr(Call(Attribute(Name('self'), 'spawn'), [BinOp(BinOp(List([Attribute(Name('self'), 'rc')]), Add(), List([BinOp(Str('/fo'), Add(), Name('obj'))])), Add(), List([Name('rc_file')]))], [], None, None))], [ExceptHandler(Name('DistutilsExecError'), 'msg', [Raise(Call(Name('CompileError'), [Name('msg')], [], None, None), None)])], []), Continue()], [Raise(Call(Name('CompileError'), [BinOp(Str("Don't know how to compile %s to %s"), Mod(), Tuple([Name('src'), Name('obj')]))], [], None, None), None)])])])]), Assign([Name('output_opt')], BinOp(Str('/Fo'), Add(), Name('obj'))), TryExcept([Expr(Call(Attribute(Name('self'), 'spawn'), [BinOp(BinOp(BinOp(BinOp(List([Attribute(Name('self'), 'cc')]), Add(), Name('compile_opts')), Add(), Name('pp_opts')), Add(), List([Name('input_opt'), Name('output_opt')])), Add(), Name('extra_postargs'))], [], None, None))], [ExceptHandler(Name('DistutilsExecError'), 'msg', [Raise(Call(Name('CompileError'), [Name('msg')], [], None, None), None)])], [])], []), Return(Name('objects'))], [], None)
1 |
455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 |
def compile(self, sources,
output_dir=None, macros=None, include_dirs=None, debug=0,
extra_preargs=None, extra_postargs=None, depends=None):
if not self.initialized:
self.initialize()
compile_info = self._setup_compile(output_dir, macros, include_dirs,
sources, depends, extra_postargs)
macros, objects, extra_postargs, pp_opts, build = compile_info
compile_opts = extra_preargs or []
compile_opts.append ('/c')
if debug:
compile_opts.extend(self.compile_options_debug)
else:
compile_opts.extend(self.compile_options)
for obj in objects:
try:
src, ext = build[obj]
except KeyError:
continue
if debug:
# pass the full pathname to MSVC in debug mode,
# this allows the debugger to find the source file
# without asking the user to browse for it
src = os.path.abspath(src)
if ext in self._c_extensions:
input_opt = "/Tc" + src
elif ext in self._cpp_extensions:
input_opt = "/Tp" + src
elif ext in self._rc_extensions:
# compile .RC to .RES file
input_opt = src
output_opt = "/fo" + obj
try:
self.spawn([self.rc] + pp_opts +
[output_opt] + [input_opt])
except DistutilsExecError as msg:
raise CompileError(msg)
continue
elif ext in self._mc_extensions:
# Compile .MC to .RC file to .RES file.
# * '-h dir' specifies the directory for the
# generated include file
# * '-r dir' specifies the target directory of the
# generated RC file and the binary message resource
# it includes
#
# For now (since there are no options to change this),
# we use the source-directory for the include file and
# the build directory for the RC file and message
# resources. This works at least for win32all.
h_dir = os.path.dirname(src)
rc_dir = os.path.dirname(obj)
try:
# first compile .MC to .RC and .H file
self.spawn([self.mc] +
['-h', h_dir, '-r', rc_dir] + [src])
base, _ = os.path.splitext (os.path.basename (src))
rc_file = os.path.join (rc_dir, base + '.rc')
# then compile .RC to .RES file
self.spawn([self.rc] +
["/fo" + obj] + [rc_file])
except DistutilsExecError as msg:
raise CompileError(msg)
continue
else:
# how to handle this file?
raise CompileError("Don't know how to compile %s to %s"
% (src, obj))
output_opt = "/Fo" + obj
try:
self.spawn([self.cc] + compile_opts + pp_opts +
[input_opt, output_opt] +
extra_postargs)
except DistutilsExecError as msg:
raise CompileError(msg)
return objects
|
2 |
340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 |
def compile(self, sources,
output_dir=None, macros=None, include_dirs=None, debug=0,
extra_preargs=None, extra_postargs=None, depends=None):
if not self.initialized:
self.initialize()
compile_info = self._setup_compile(output_dir, macros, include_dirs,
sources, depends, extra_postargs)
macros, objects, extra_postargs, pp_opts, build = compile_info
compile_opts = extra_preargs or []
compile_opts.append ('/c')
if debug:
compile_opts.extend(self.compile_options_debug)
else:
compile_opts.extend(self.compile_options)
for obj in objects:
try:
src, ext = build[obj]
except KeyError:
continue
if debug:
# pass the full pathname to MSVC in debug mode,
# this allows the debugger to find the source file
# without asking the user to browse for it
src = os.path.abspath(src)
if ext in self._c_extensions:
input_opt = "/Tc" + src
elif ext in self._cpp_extensions:
input_opt = "/Tp" + src
elif ext in self._rc_extensions:
# compile .RC to .RES file
input_opt = src
output_opt = "/fo" + obj
try:
self.spawn([self.rc] + pp_opts +
[output_opt] + [input_opt])
except DistutilsExecError as msg:
raise CompileError(msg)
continue
elif ext in self._mc_extensions:
# Compile .MC to .RC file to .RES file.
# * '-h dir' specifies the directory for the
# generated include file
# * '-r dir' specifies the target directory of the
# generated RC file and the binary message resource
# it includes
#
# For now (since there are no options to change this),
# we use the source-directory for the include file and
# the build directory for the RC file and message
# resources. This works at least for win32all.
h_dir = os.path.dirname(src)
rc_dir = os.path.dirname(obj)
try:
# first compile .MC to .RC and .H file
self.spawn([self.mc] +
['-h', h_dir, '-r', rc_dir] + [src])
base, _ = os.path.splitext (os.path.basename (src))
rc_file = os.path.join (rc_dir, base + '.rc')
# then compile .RC to .RES file
self.spawn([self.rc] +
["/fo" + obj] + [rc_file])
except DistutilsExecError as msg:
raise CompileError(msg)
continue
else:
# how to handle this file?
raise CompileError("Don't know how to compile %s to %s"
% (src, obj))
output_opt = "/Fo" + obj
try:
self.spawn([self.cc] + compile_opts + pp_opts +
[input_opt, output_opt] +
extra_postargs)
except DistutilsExecError as msg:
raise CompileError(msg)
return objects
|
For(Name('obj'), Name('objects'), [TryExcept([Assign([Tuple([Name('src'), Name('ext')])], Subscript(Name('build'), Index(Name('obj'))))], [ExceptHandler(Name('KeyError'), None, [Continue()])], []), If(Name('debug'), [Assign([Name('src')], Call(Attribute(Attribute(Name('os'), 'path'), 'abspath'), [Name('src')], [], None, None))], []), If(Compare(Name('ext'), [In()], [Attribute(Name('self'), '_c_extensions')]), [Assign([Name('input_opt')], BinOp(Str('/Tc'), Add(), Name('src')))], [If(Compare(Name('ext'), [In()], [Attribute(Name('self'), '_cpp_extensions')]), [Assign([Name('input_opt')], BinOp(Str('/Tp'), Add(), Name('src')))], [If(Compare(Name('ext'), [In()], [Attribute(Name('self'), '_rc_extensions')]), [Assign([Name('input_opt')], Name('src')), Assign([Name('output_opt')], BinOp(Str('/fo'), Add(), Name('obj'))), TryExcept([Expr(Call(Attribute(Name('self'), 'spawn'), [BinOp(BinOp(BinOp(List([Attribute(Name('self'), 'rc')]), Add(), Name('pp_opts')), Add(), List([Name('output_opt')])), Add(), List([Name('input_opt')]))], [], None, None))], [ExceptHandler(Name('DistutilsExecError'), 'msg', [Raise(Call(Name('CompileError'), [Name('msg')], [], None, None), None)])], []), Continue()], [If(Compare(Name('ext'), [In()], [Attribute(Name('self'), '_mc_extensions')]), [Assign([Name('h_dir')], Call(Attribute(Attribute(Name('os'), 'path'), 'dirname'), [Name('src')], [], None, None)), Assign([Name('rc_dir')], Call(Attribute(Attribute(Name('os'), 'path'), 'dirname'), [Name('obj')], [], None, None)), TryExcept([Expr(Call(Attribute(Name('self'), 'spawn'), [BinOp(BinOp(List([Attribute(Name('self'), 'mc')]), Add(), List([Str('-h'), Name('h_dir'), Str('-r'), Name('rc_dir')])), Add(), List([Name('src')]))], [], None, None)), Assign([Tuple([Name('base'), Name('_')])], Call(Attribute(Attribute(Name('os'), 'path'), 'splitext'), [Call(Attribute(Attribute(Name('os'), 'path'), 'basename'), [Name('src')], [], None, None)], [], None, None)), Assign([Name('rc_file')], Call(Attribute(Attribute(Name('os'), 'path'), 'join'), [Name('rc_dir'), BinOp(Name('base'), Add(), Str('.rc'))], [], None, None)), Expr(Call(Attribute(Name('self'), 'spawn'), [BinOp(BinOp(List([Attribute(Name('self'), 'rc')]), Add(), List([BinOp(Str('/fo'), Add(), Name('obj'))])), Add(), List([Name('rc_file')]))], [], None, None))], [ExceptHandler(Name('DistutilsExecError'), 'msg', [Raise(Call(Name('CompileError'), [Name('msg')], [], None, None), None)])], []), Continue()], [Raise(Call(Name('CompileError'), [BinOp(Str("Don't know how to compile %s to %s"), Mod(), Tuple([Name('src'), Name('obj')]))], [], None, None), None)])])])]), Assign([Name('output_opt')], BinOp(Str('/Fo'), Add(), Name('obj'))), TryExcept([Expr(Call(Attribute(Name('self'), 'spawn'), [BinOp(BinOp(BinOp(BinOp(List([Attribute(Name('self'), 'cc')]), Add(), Name('compile_opts')), Add(), Name('pp_opts')), Add(), List([Name('input_opt'), Name('output_opt')])), Add(), Name('extra_postargs'))], [], None, None))], [ExceptHandler(Name('DistutilsExecError'), 'msg', [Raise(Call(Name('CompileError'), [Name('msg')], [], None, None), None)])], [])], [])
1 |
472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 |
for obj in objects:
try:
src, ext = build[obj]
except KeyError:
continue
if debug:
# pass the full pathname to MSVC in debug mode,
# this allows the debugger to find the source file
# without asking the user to browse for it
src = os.path.abspath(src)
if ext in self._c_extensions:
input_opt = "/Tc" + src
elif ext in self._cpp_extensions:
input_opt = "/Tp" + src
elif ext in self._rc_extensions:
# compile .RC to .RES file
input_opt = src
output_opt = "/fo" + obj
try:
self.spawn([self.rc] + pp_opts +
[output_opt] + [input_opt])
except DistutilsExecError as msg:
raise CompileError(msg)
continue
elif ext in self._mc_extensions:
# Compile .MC to .RC file to .RES file.
# * '-h dir' specifies the directory for the
# generated include file
# * '-r dir' specifies the target directory of the
# generated RC file and the binary message resource
# it includes
#
# For now (since there are no options to change this),
# we use the source-directory for the include file and
# the build directory for the RC file and message
# resources. This works at least for win32all.
h_dir = os.path.dirname(src)
rc_dir = os.path.dirname(obj)
try:
# first compile .MC to .RC and .H file
self.spawn([self.mc] +
['-h', h_dir, '-r', rc_dir] + [src])
base, _ = os.path.splitext (os.path.basename (src))
rc_file = os.path.join (rc_dir, base + '.rc')
# then compile .RC to .RES file
self.spawn([self.rc] +
["/fo" + obj] + [rc_file])
except DistutilsExecError as msg:
raise CompileError(msg)
continue
else:
# how to handle this file?
raise CompileError("Don't know how to compile %s to %s"
% (src, obj))
output_opt = "/Fo" + obj
try:
self.spawn([self.cc] + compile_opts + pp_opts +
[input_opt, output_opt] +
extra_postargs)
except DistutilsExecError as msg:
raise CompileError(msg)
|
2 |
357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 |
for obj in objects:
try:
src, ext = build[obj]
except KeyError:
continue
if debug:
# pass the full pathname to MSVC in debug mode,
# this allows the debugger to find the source file
# without asking the user to browse for it
src = os.path.abspath(src)
if ext in self._c_extensions:
input_opt = "/Tc" + src
elif ext in self._cpp_extensions:
input_opt = "/Tp" + src
elif ext in self._rc_extensions:
# compile .RC to .RES file
input_opt = src
output_opt = "/fo" + obj
try:
self.spawn([self.rc] + pp_opts +
[output_opt] + [input_opt])
except DistutilsExecError as msg:
raise CompileError(msg)
continue
elif ext in self._mc_extensions:
# Compile .MC to .RC file to .RES file.
# * '-h dir' specifies the directory for the
# generated include file
# * '-r dir' specifies the target directory of the
# generated RC file and the binary message resource
# it includes
#
# For now (since there are no options to change this),
# we use the source-directory for the include file and
# the build directory for the RC file and message
# resources. This works at least for win32all.
h_dir = os.path.dirname(src)
rc_dir = os.path.dirname(obj)
try:
# first compile .MC to .RC and .H file
self.spawn([self.mc] +
['-h', h_dir, '-r', rc_dir] + [src])
base, _ = os.path.splitext (os.path.basename (src))
rc_file = os.path.join (rc_dir, base + '.rc')
# then compile .RC to .RES file
self.spawn([self.rc] +
["/fo" + obj] + [rc_file])
except DistutilsExecError as msg:
raise CompileError(msg)
continue
else:
# how to handle this file?
raise CompileError("Don't know how to compile %s to %s"
% (src, obj))
output_opt = "/Fo" + obj
try:
self.spawn([self.cc] + compile_opts + pp_opts +
[input_opt, output_opt] +
extra_postargs)
except DistutilsExecError as msg:
raise CompileError(msg)
|
If(Compare(Name('ext'), [In()], [Attribute(Name('self'), '_c_extensions')]), [Assign([Name('input_opt')], BinOp(Str('/Tc'), Add(), Name('src')))], [If(Compare(Name('ext'), [In()], [Attribute(Name('self'), '_cpp_extensions')]), [Assign([Name('input_opt')], BinOp(Str('/Tp'), Add(), Name('src')))], [If(Compare(Name('ext'), [In()], [Attribute(Name('self'), '_rc_extensions')]), [Assign([Name('input_opt')], Name('src')), Assign([Name('output_opt')], BinOp(Str('/fo'), Add(), Name('obj'))), TryExcept([Expr(Call(Attribute(Name('self'), 'spawn'), [BinOp(BinOp(BinOp(List([Attribute(Name('self'), 'rc')]), Add(), Name('pp_opts')), Add(), List([Name('output_opt')])), Add(), List([Name('input_opt')]))], [], None, None))], [ExceptHandler(Name('DistutilsExecError'), 'msg', [Raise(Call(Name('CompileError'), [Name('msg')], [], None, None), None)])], []), Continue()], [If(Compare(Name('ext'), [In()], [Attribute(Name('self'), '_mc_extensions')]), [Assign([Name('h_dir')], Call(Attribute(Attribute(Name('os'), 'path'), 'dirname'), [Name('src')], [], None, None)), Assign([Name('rc_dir')], Call(Attribute(Attribute(Name('os'), 'path'), 'dirname'), [Name('obj')], [], None, None)), TryExcept([Expr(Call(Attribute(Name('self'), 'spawn'), [BinOp(BinOp(List([Attribute(Name('self'), 'mc')]), Add(), List([Str('-h'), Name('h_dir'), Str('-r'), Name('rc_dir')])), Add(), List([Name('src')]))], [], None, None)), Assign([Tuple([Name('base'), Name('_')])], Call(Attribute(Attribute(Name('os'), 'path'), 'splitext'), [Call(Attribute(Attribute(Name('os'), 'path'), 'basename'), [Name('src')], [], None, None)], [], None, None)), Assign([Name('rc_file')], Call(Attribute(Attribute(Name('os'), 'path'), 'join'), [Name('rc_dir'), BinOp(Name('base'), Add(), Str('.rc'))], [], None, None)), Expr(Call(Attribute(Name('self'), 'spawn'), [BinOp(BinOp(List([Attribute(Name('self'), 'rc')]), Add(), List([BinOp(Str('/fo'), Add(), Name('obj'))])), Add(), List([Name('rc_file')]))], [], None, None))], [ExceptHandler(Name('DistutilsExecError'), 'msg', [Raise(Call(Name('CompileError'), [Name('msg')], [], None, None), None)])], []), Continue()], [Raise(Call(Name('CompileError'), [BinOp(Str("Don't know how to compile %s to %s"), Mod(), Tuple([Name('src'), Name('obj')]))], [], None, None), None)])])])])
1 |
483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 |
if ext in self._c_extensions:
input_opt = "/Tc" + src
elif ext in self._cpp_extensions:
input_opt = "/Tp" + src
elif ext in self._rc_extensions:
# compile .RC to .RES file
input_opt = src
output_opt = "/fo" + obj
try:
self.spawn([self.rc] + pp_opts +
[output_opt] + [input_opt])
except DistutilsExecError as msg:
raise CompileError(msg)
continue
elif ext in self._mc_extensions:
# Compile .MC to .RC file to .RES file.
# * '-h dir' specifies the directory for the
# generated include file
# * '-r dir' specifies the target directory of the
# generated RC file and the binary message resource
# it includes
#
# For now (since there are no options to change this),
# we use the source-directory for the include file and
# the build directory for the RC file and message
# resources. This works at least for win32all.
h_dir = os.path.dirname(src)
rc_dir = os.path.dirname(obj)
try:
# first compile .MC to .RC and .H file
self.spawn([self.mc] +
['-h', h_dir, '-r', rc_dir] + [src])
base, _ = os.path.splitext (os.path.basename (src))
rc_file = os.path.join (rc_dir, base + '.rc')
# then compile .RC to .RES file
self.spawn([self.rc] +
["/fo" + obj] + [rc_file])
except DistutilsExecError as msg:
raise CompileError(msg)
continue
else:
# how to handle this file?
raise CompileError("Don't know how to compile %s to %s"
% (src, obj))
|
2 |
368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 |
if ext in self._c_extensions:
input_opt = "/Tc" + src
elif ext in self._cpp_extensions:
input_opt = "/Tp" + src
elif ext in self._rc_extensions:
# compile .RC to .RES file
input_opt = src
output_opt = "/fo" + obj
try:
self.spawn([self.rc] + pp_opts +
[output_opt] + [input_opt])
except DistutilsExecError as msg:
raise CompileError(msg)
continue
elif ext in self._mc_extensions:
# Compile .MC to .RC file to .RES file.
# * '-h dir' specifies the directory for the
# generated include file
# * '-r dir' specifies the target directory of the
# generated RC file and the binary message resource
# it includes
#
# For now (since there are no options to change this),
# we use the source-directory for the include file and
# the build directory for the RC file and message
# resources. This works at least for win32all.
h_dir = os.path.dirname(src)
rc_dir = os.path.dirname(obj)
try:
# first compile .MC to .RC and .H file
self.spawn([self.mc] +
['-h', h_dir, '-r', rc_dir] + [src])
base, _ = os.path.splitext (os.path.basename (src))
rc_file = os.path.join (rc_dir, base + '.rc')
# then compile .RC to .RES file
self.spawn([self.rc] +
["/fo" + obj] + [rc_file])
except DistutilsExecError as msg:
raise CompileError(msg)
continue
else:
# how to handle this file?
raise CompileError("Don't know how to compile %s to %s"
% (src, obj))
|
If(Compare(Name('ext'), [In()], [Attribute(Name('self'), '_cpp_extensions')]), [Assign([Name('input_opt')], BinOp(Str('/Tp'), Add(), Name('src')))], [If(Compare(Name('ext'), [In()], [Attribute(Name('self'), '_rc_extensions')]), [Assign([Name('input_opt')], Name('src')), Assign([Name('output_opt')], BinOp(Str('/fo'), Add(), Name('obj'))), TryExcept([Expr(Call(Attribute(Name('self'), 'spawn'), [BinOp(BinOp(BinOp(List([Attribute(Name('self'), 'rc')]), Add(), Name('pp_opts')), Add(), List([Name('output_opt')])), Add(), List([Name('input_opt')]))], [], None, None))], [ExceptHandler(Name('DistutilsExecError'), 'msg', [Raise(Call(Name('CompileError'), [Name('msg')], [], None, None), None)])], []), Continue()], [If(Compare(Name('ext'), [In()], [Attribute(Name('self'), '_mc_extensions')]), [Assign([Name('h_dir')], Call(Attribute(Attribute(Name('os'), 'path'), 'dirname'), [Name('src')], [], None, None)), Assign([Name('rc_dir')], Call(Attribute(Attribute(Name('os'), 'path'), 'dirname'), [Name('obj')], [], None, None)), TryExcept([Expr(Call(Attribute(Name('self'), 'spawn'), [BinOp(BinOp(List([Attribute(Name('self'), 'mc')]), Add(), List([Str('-h'), Name('h_dir'), Str('-r'), Name('rc_dir')])), Add(), List([Name('src')]))], [], None, None)), Assign([Tuple([Name('base'), Name('_')])], Call(Attribute(Attribute(Name('os'), 'path'), 'splitext'), [Call(Attribute(Attribute(Name('os'), 'path'), 'basename'), [Name('src')], [], None, None)], [], None, None)), Assign([Name('rc_file')], Call(Attribute(Attribute(Name('os'), 'path'), 'join'), [Name('rc_dir'), BinOp(Name('base'), Add(), Str('.rc'))], [], None, None)), Expr(Call(Attribute(Name('self'), 'spawn'), [BinOp(BinOp(List([Attribute(Name('self'), 'rc')]), Add(), List([BinOp(Str('/fo'), Add(), Name('obj'))])), Add(), List([Name('rc_file')]))], [], None, None))], [ExceptHandler(Name('DistutilsExecError'), 'msg', [Raise(Call(Name('CompileError'), [Name('msg')], [], None, None), None)])], []), Continue()], [Raise(Call(Name('CompileError'), [BinOp(Str("Don't know how to compile %s to %s"), Mod(), Tuple([Name('src'), Name('obj')]))], [], None, None), None)])])])
1 |
485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 |
elif ext in self._cpp_extensions:
input_opt = "/Tp" + src
elif ext in self._rc_extensions:
# compile .RC to .RES file
input_opt = src
output_opt = "/fo" + obj
try:
self.spawn([self.rc] + pp_opts +
[output_opt] + [input_opt])
except DistutilsExecError as msg:
raise CompileError(msg)
continue
elif ext in self._mc_extensions:
# Compile .MC to .RC file to .RES file.
# * '-h dir' specifies the directory for the
# generated include file
# * '-r dir' specifies the target directory of the
# generated RC file and the binary message resource
# it includes
#
# For now (since there are no options to change this),
# we use the source-directory for the include file and
# the build directory for the RC file and message
# resources. This works at least for win32all.
h_dir = os.path.dirname(src)
rc_dir = os.path.dirname(obj)
try:
# first compile .MC to .RC and .H file
self.spawn([self.mc] +
['-h', h_dir, '-r', rc_dir] + [src])
base, _ = os.path.splitext (os.path.basename (src))
rc_file = os.path.join (rc_dir, base + '.rc')
# then compile .RC to .RES file
self.spawn([self.rc] +
["/fo" + obj] + [rc_file])
except DistutilsExecError as msg:
raise CompileError(msg)
continue
else:
# how to handle this file?
raise CompileError("Don't know how to compile %s to %s"
% (src, obj))
|
2 |
370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 |
elif ext in self._cpp_extensions:
input_opt = "/Tp" + src
elif ext in self._rc_extensions:
# compile .RC to .RES file
input_opt = src
output_opt = "/fo" + obj
try:
self.spawn([self.rc] + pp_opts +
[output_opt] + [input_opt])
except DistutilsExecError as msg:
raise CompileError(msg)
continue
elif ext in self._mc_extensions:
# Compile .MC to .RC file to .RES file.
# * '-h dir' specifies the directory for the
# generated include file
# * '-r dir' specifies the target directory of the
# generated RC file and the binary message resource
# it includes
#
# For now (since there are no options to change this),
# we use the source-directory for the include file and
# the build directory for the RC file and message
# resources. This works at least for win32all.
h_dir = os.path.dirname(src)
rc_dir = os.path.dirname(obj)
try:
# first compile .MC to .RC and .H file
self.spawn([self.mc] +
['-h', h_dir, '-r', rc_dir] + [src])
base, _ = os.path.splitext (os.path.basename (src))
rc_file = os.path.join (rc_dir, base + '.rc')
# then compile .RC to .RES file
self.spawn([self.rc] +
["/fo" + obj] + [rc_file])
except DistutilsExecError as msg:
raise CompileError(msg)
continue
else:
# how to handle this file?
raise CompileError("Don't know how to compile %s to %s"
% (src, obj))
|
If(Compare(Name('ext'), [In()], [Attribute(Name('self'), '_rc_extensions')]), [Assign([Name('input_opt')], Name('src')), Assign([Name('output_opt')], BinOp(Str('/fo'), Add(), Name('obj'))), TryExcept([Expr(Call(Attribute(Name('self'), 'spawn'), [BinOp(BinOp(BinOp(List([Attribute(Name('self'), 'rc')]), Add(), Name('pp_opts')), Add(), List([Name('output_opt')])), Add(), List([Name('input_opt')]))], [], None, None))], [ExceptHandler(Name('DistutilsExecError'), 'msg', [Raise(Call(Name('CompileError'), [Name('msg')], [], None, None), None)])], []), Continue()], [If(Compare(Name('ext'), [In()], [Attribute(Name('self'), '_mc_extensions')]), [Assign([Name('h_dir')], Call(Attribute(Attribute(Name('os'), 'path'), 'dirname'), [Name('src')], [], None, None)), Assign([Name('rc_dir')], Call(Attribute(Attribute(Name('os'), 'path'), 'dirname'), [Name('obj')], [], None, None)), TryExcept([Expr(Call(Attribute(Name('self'), 'spawn'), [BinOp(BinOp(List([Attribute(Name('self'), 'mc')]), Add(), List([Str('-h'), Name('h_dir'), Str('-r'), Name('rc_dir')])), Add(), List([Name('src')]))], [], None, None)), Assign([Tuple([Name('base'), Name('_')])], Call(Attribute(Attribute(Name('os'), 'path'), 'splitext'), [Call(Attribute(Attribute(Name('os'), 'path'), 'basename'), [Name('src')], [], None, None)], [], None, None)), Assign([Name('rc_file')], Call(Attribute(Attribute(Name('os'), 'path'), 'join'), [Name('rc_dir'), BinOp(Name('base'), Add(), Str('.rc'))], [], None, None)), Expr(Call(Attribute(Name('self'), 'spawn'), [BinOp(BinOp(List([Attribute(Name('self'), 'rc')]), Add(), List([BinOp(Str('/fo'), Add(), Name('obj'))])), Add(), List([Name('rc_file')]))], [], None, None))], [ExceptHandler(Name('DistutilsExecError'), 'msg', [Raise(Call(Name('CompileError'), [Name('msg')], [], None, None), None)])], []), Continue()], [Raise(Call(Name('CompileError'), [BinOp(Str("Don't know how to compile %s to %s"), Mod(), Tuple([Name('src'), Name('obj')]))], [], None, None), None)])])
1 |
487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 |
elif ext in self._rc_extensions:
# compile .RC to .RES file
input_opt = src
output_opt = "/fo" + obj
try:
self.spawn([self.rc] + pp_opts +
[output_opt] + [input_opt])
except DistutilsExecError as msg:
raise CompileError(msg)
continue
elif ext in self._mc_extensions:
# Compile .MC to .RC file to .RES file.
# * '-h dir' specifies the directory for the
# generated include file
# * '-r dir' specifies the target directory of the
# generated RC file and the binary message resource
# it includes
#
# For now (since there are no options to change this),
# we use the source-directory for the include file and
# the build directory for the RC file and message
# resources. This works at least for win32all.
h_dir = os.path.dirname(src)
rc_dir = os.path.dirname(obj)
try:
# first compile .MC to .RC and .H file
self.spawn([self.mc] +
['-h', h_dir, '-r', rc_dir] + [src])
base, _ = os.path.splitext (os.path.basename (src))
rc_file = os.path.join (rc_dir, base + '.rc')
# then compile .RC to .RES file
self.spawn([self.rc] +
["/fo" + obj] + [rc_file])
except DistutilsExecError as msg:
raise CompileError(msg)
continue
else:
# how to handle this file?
raise CompileError("Don't know how to compile %s to %s"
% (src, obj))
|
2 |
372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 |
elif ext in self._rc_extensions:
# compile .RC to .RES file
input_opt = src
output_opt = "/fo" + obj
try:
self.spawn([self.rc] + pp_opts +
[output_opt] + [input_opt])
except DistutilsExecError as msg:
raise CompileError(msg)
continue
elif ext in self._mc_extensions:
# Compile .MC to .RC file to .RES file.
# * '-h dir' specifies the directory for the
# generated include file
# * '-r dir' specifies the target directory of the
# generated RC file and the binary message resource
# it includes
#
# For now (since there are no options to change this),
# we use the source-directory for the include file and
# the build directory for the RC file and message
# resources. This works at least for win32all.
h_dir = os.path.dirname(src)
rc_dir = os.path.dirname(obj)
try:
# first compile .MC to .RC and .H file
self.spawn([self.mc] +
['-h', h_dir, '-r', rc_dir] + [src])
base, _ = os.path.splitext (os.path.basename (src))
rc_file = os.path.join (rc_dir, base + '.rc')
# then compile .RC to .RES file
self.spawn([self.rc] +
["/fo" + obj] + [rc_file])
except DistutilsExecError as msg:
raise CompileError(msg)
continue
else:
# how to handle this file?
raise CompileError("Don't know how to compile %s to %s"
% (src, obj))
|
FunctionDef('object_filenames', arguments([arg('self', None), arg('source_filenames', None), arg('strip_dir', None), arg('output_dir', None)], None, None, [], None, None, [Num(0), Str('')], []), [If(Compare(Name('output_dir'), [Is()], [Name('None')]), [Assign([Name('output_dir')], Str(''))], []), Assign([Name('obj_names')], List([])), For(Name('src_name'), Name('source_filenames'), [Assign([Tuple([Name('base'), Name('ext')])], Call(Attribute(Attribute(Name('os'), 'path'), 'splitext'), [Name('src_name')], [], None, None)), Assign([Name('base')], Subscript(Call(Attribute(Attribute(Name('os'), 'path'), 'splitdrive'), [Name('base')], [], None, None), Index(Num(1)))), Assign([Name('base')], Subscript(Name('base'), Slice(Call(Attribute(Attribute(Name('os'), 'path'), 'isabs'), [Name('base')], [], None, None), None, None))), If(Compare(Name('ext'), [NotIn()], [Attribute(Name('self'), 'src_extensions')]), [Raise(Call(Name('CompileError'), [BinOp(Str("Don't know how to compile %s"), Mod(), Name('src_name'))], [], None, None), None)], []), If(Name('strip_dir'), [Assign([Name('base')], Call(Attribute(Attribute(Name('os'), 'path'), 'basename'), [Name('base')], [], None, None))], []), If(Compare(Name('ext'), [In()], [Attribute(Name('self'), '_rc_extensions')]), [Expr(Call(Attribute(Name('obj_names'), 'append'), [Call(Attribute(Attribute(Name('os'), 'path'), 'join'), [Name('output_dir'), BinOp(Name('base'), Add(), Attribute(Name('self'), 'res_extension'))], [], None, None)], [], None, None))], [If(Compare(Name('ext'), [In()], [Attribute(Name('self'), '_mc_extensions')]), [Expr(Call(Attribute(Name('obj_names'), 'append'), [Call(Attribute(Attribute(Name('os'), 'path'), 'join'), [Name('output_dir'), BinOp(Name('base'), Add(), Attribute(Name('self'), 'res_extension'))], [], None, None)], [], None, None))], [Expr(Call(Attribute(Name('obj_names'), 'append'), [Call(Attribute(Attribute(Name('os'), 'path'), 'join'), [Name('output_dir'), BinOp(Name('base'), Add(), Attribute(Name('self'), 'obj_extension'))], [], None, None)], [], None, None))])])], []), Return(Name('obj_names'))], [], None)
1 |
424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 |
def object_filenames(self,
source_filenames,
strip_dir=0,
output_dir=''):
# Copied from ccompiler.py, extended to return .res as 'object'-file
# for .rc input file
if output_dir is None: output_dir = ''
obj_names = []
for src_name in source_filenames:
(base, ext) = os.path.splitext (src_name)
base = os.path.splitdrive(base)[1] # Chop off the drive
base = base[os.path.isabs(base):] # If abs, chop off leading /
if ext not in self.src_extensions:
# Better to raise an exception instead of silently continuing
# and later complain about sources and targets having
# different lengths
raise CompileError ("Don't know how to compile %s" % src_name)
if strip_dir:
base = os.path.basename (base)
if ext in self._rc_extensions:
obj_names.append (os.path.join (output_dir,
base + self.res_extension))
elif ext in self._mc_extensions:
obj_names.append (os.path.join (output_dir,
base + self.res_extension))
else:
obj_names.append (os.path.join (output_dir,
base + self.obj_extension))
return obj_names
|
2 |
309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 |
def object_filenames(self,
source_filenames,
strip_dir=0,
output_dir=''):
# Copied from ccompiler.py, extended to return .res as 'object'-file
# for .rc input file
if output_dir is None: output_dir = ''
obj_names = []
for src_name in source_filenames:
(base, ext) = os.path.splitext (src_name)
base = os.path.splitdrive(base)[1] # Chop off the drive
base = base[os.path.isabs(base):] # If abs, chop off leading /
if ext not in self.src_extensions:
# Better to raise an exception instead of silently continuing
# and later complain about sources and targets having
# different lengths
raise CompileError ("Don't know how to compile %s" % src_name)
if strip_dir:
base = os.path.basename (base)
if ext in self._rc_extensions:
obj_names.append (os.path.join (output_dir,
base + self.res_extension))
elif ext in self._mc_extensions:
obj_names.append (os.path.join (output_dir,
base + self.res_extension))
else:
obj_names.append (os.path.join (output_dir,
base + self.obj_extension))
return obj_names
|
If(Name('scheme'), [Assign([Name('url')], Call(Attribute(Call(Name('escape'), [Name('all')], [], None, None), 'replace'), [Str('"'), Str('"')], [], None, None)), Expr(Call(Attribute(Name('results'), 'append'), [BinOp(Str('<a href="%s">%s</a>'), Mod(), Tuple([Name('url'), Name('url')]))], [], None, None))], [If(Name('rfc'), [Assign([Name('url')], BinOp(Str('http://www.rfc-editor.org/rfc/rfc%d.txt'), Mod(), Call(Name('int'), [Name('rfc')], [], None, None))), Expr(Call(Attribute(Name('results'), 'append'), [BinOp(Str('<a href="%s">%s</a>'), Mod(), Tuple([Name('url'), Call(Name('escape'), [Name('all')], [], None, None)]))], [], None, None))], [If(Name('pep'), [Assign([Name('url')], BinOp(Str('http://www.python.org/dev/peps/pep-%04d/'), Mod(), Call(Name('int'), [Name('pep')], [], None, None))), Expr(Call(Attribute(Name('results'), 'append'), [BinOp(Str('<a href="%s">%s</a>'), Mod(), Tuple([Name('url'), Call(Name('escape'), [Name('all')], [], None, None)]))], [], None, None))], [If(Compare(Subscript(Name('text'), Slice(Name('end'), BinOp(Name('end'), Add(), Num(1)), None)), [Eq()], [Str('(')]), [Expr(Call(Attribute(Name('results'), 'append'), [Call(Attribute(Name('self'), 'namelink'), [Name('name'), Name('methods'), Name('funcs'), Name('classes')], [], None, None)], [], None, None))], [If(Name('selfdot'), [Expr(Call(Attribute(Name('results'), 'append'), [BinOp(Str('self.<strong>%s</strong>'), Mod(), Name('name'))], [], None, None))], [Expr(Call(Attribute(Name('results'), 'append'), [Call(Attribute(Name('self'), 'namelink'), [Name('name'), Name('classes')], [], None, None)], [], None, None))])])])])])
1 |
561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 |
if scheme:
url = escape(all).replace('"', '"')
results.append('<a href="%s">%s</a>' % (url, url))
elif rfc:
url = 'http://www.rfc-editor.org/rfc/rfc%d.txt' % int(rfc)
results.append('<a href="%s">%s</a>' % (url, escape(all)))
elif pep:
url = 'http://www.python.org/dev/peps/pep-%04d/' % int(pep)
results.append('<a href="%s">%s</a>' % (url, escape(all)))
elif text[end:end+1] == '(':
results.append(self.namelink(name, methods, funcs, classes))
elif selfdot:
results.append('self.<strong>%s</strong>' % name)
else:
results.append(self.namelink(name, classes))
|
2 |
725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 |
if scheme:
url = escape(all).replace('"', '"')
results.append('<a href="%s">%s</a>' % (url, url))
elif rfc:
url = 'http://www.rfc-editor.org/rfc/rfc%d.txt' % int(rfc)
results.append('<a href="%s">%s</a>' % (url, escape(all)))
elif pep:
url = 'http://www.python.org/dev/peps/pep-%04d/' % int(pep)
results.append('<a href="%s">%s</a>' % (url, escape(all)))
elif text[end:end+1] == '(':
results.append(self.namelink(name, methods, funcs, classes))
elif selfdot:
results.append('self.<strong>%s</strong>' % name)
else:
results.append(self.namelink(name, classes))
|
For(Name('src_name'), Name('source_filenames'), [Assign([Tuple([Name('base'), Name('ext')])], Call(Attribute(Attribute(Name('os'), 'path'), 'splitext'), [Name('src_name')], [], None, None)), Assign([Name('base')], Subscript(Call(Attribute(Attribute(Name('os'), 'path'), 'splitdrive'), [Name('base')], [], None, None), Index(Num(1)))), Assign([Name('base')], Subscript(Name('base'), Slice(Call(Attribute(Attribute(Name('os'), 'path'), 'isabs'), [Name('base')], [], None, None), None, None))), If(Compare(Name('ext'), [NotIn()], [Attribute(Name('self'), 'src_extensions')]), [Raise(Call(Name('CompileError'), [BinOp(Str("Don't know how to compile %s"), Mod(), Name('src_name'))], [], None, None), None)], []), If(Name('strip_dir'), [Assign([Name('base')], Call(Attribute(Attribute(Name('os'), 'path'), 'basename'), [Name('base')], [], None, None))], []), If(Compare(Name('ext'), [In()], [Attribute(Name('self'), '_rc_extensions')]), [Expr(Call(Attribute(Name('obj_names'), 'append'), [Call(Attribute(Attribute(Name('os'), 'path'), 'join'), [Name('output_dir'), BinOp(Name('base'), Add(), Attribute(Name('self'), 'res_extension'))], [], None, None)], [], None, None))], [If(Compare(Name('ext'), [In()], [Attribute(Name('self'), '_mc_extensions')]), [Expr(Call(Attribute(Name('obj_names'), 'append'), [Call(Attribute(Attribute(Name('os'), 'path'), 'join'), [Name('output_dir'), BinOp(Name('base'), Add(), Attribute(Name('self'), 'res_extension'))], [], None, None)], [], None, None))], [Expr(Call(Attribute(Name('obj_names'), 'append'), [Call(Attribute(Attribute(Name('os'), 'path'), 'join'), [Name('output_dir'), BinOp(Name('base'), Add(), Attribute(Name('self'), 'obj_extension'))], [], None, None)], [], None, None))])])], [])
1 |
432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 |
for src_name in source_filenames:
(base, ext) = os.path.splitext (src_name)
base = os.path.splitdrive(base)[1] # Chop off the drive
base = base[os.path.isabs(base):] # If abs, chop off leading /
if ext not in self.src_extensions:
# Better to raise an exception instead of silently continuing
# and later complain about sources and targets having
# different lengths
raise CompileError ("Don't know how to compile %s" % src_name)
if strip_dir:
base = os.path.basename (base)
if ext in self._rc_extensions:
obj_names.append (os.path.join (output_dir,
base + self.res_extension))
elif ext in self._mc_extensions:
obj_names.append (os.path.join (output_dir,
base + self.res_extension))
else:
obj_names.append (os.path.join (output_dir,
base + self.obj_extension))
|
2 |
317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 |
for src_name in source_filenames:
(base, ext) = os.path.splitext (src_name)
base = os.path.splitdrive(base)[1] # Chop off the drive
base = base[os.path.isabs(base):] # If abs, chop off leading /
if ext not in self.src_extensions:
# Better to raise an exception instead of silently continuing
# and later complain about sources and targets having
# different lengths
raise CompileError ("Don't know how to compile %s" % src_name)
if strip_dir:
base = os.path.basename (base)
if ext in self._rc_extensions:
obj_names.append (os.path.join (output_dir,
base + self.res_extension))
elif ext in self._mc_extensions:
obj_names.append (os.path.join (output_dir,
base + self.res_extension))
else:
obj_names.append (os.path.join (output_dir,
base + self.obj_extension))
|
If(Compare(Name('ext'), [In()], [Attribute(Name('self'), '_mc_extensions')]), [Assign([Name('h_dir')], Call(Attribute(Attribute(Name('os'), 'path'), 'dirname'), [Name('src')], [], None, None)), Assign([Name('rc_dir')], Call(Attribute(Attribute(Name('os'), 'path'), 'dirname'), [Name('obj')], [], None, None)), TryExcept([Expr(Call(Attribute(Name('self'), 'spawn'), [BinOp(BinOp(List([Attribute(Name('self'), 'mc')]), Add(), List([Str('-h'), Name('h_dir'), Str('-r'), Name('rc_dir')])), Add(), List([Name('src')]))], [], None, None)), Assign([Tuple([Name('base'), Name('_')])], Call(Attribute(Attribute(Name('os'), 'path'), 'splitext'), [Call(Attribute(Attribute(Name('os'), 'path'), 'basename'), [Name('src')], [], None, None)], [], None, None)), Assign([Name('rc_file')], Call(Attribute(Attribute(Name('os'), 'path'), 'join'), [Name('rc_dir'), BinOp(Name('base'), Add(), Str('.rc'))], [], None, None)), Expr(Call(Attribute(Name('self'), 'spawn'), [BinOp(BinOp(List([Attribute(Name('self'), 'rc')]), Add(), List([BinOp(Str('/fo'), Add(), Name('obj'))])), Add(), List([Name('rc_file')]))], [], None, None))], [ExceptHandler(Name('DistutilsExecError'), 'msg', [Raise(Call(Name('CompileError'), [Name('msg')], [], None, None), None)])], []), Continue()], [Raise(Call(Name('CompileError'), [BinOp(Str("Don't know how to compile %s to %s"), Mod(), Tuple([Name('src'), Name('obj')]))], [], None, None), None)])
1 |
497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 |
elif ext in self._mc_extensions:
# Compile .MC to .RC file to .RES file.
# * '-h dir' specifies the directory for the
# generated include file
# * '-r dir' specifies the target directory of the
# generated RC file and the binary message resource
# it includes
#
# For now (since there are no options to change this),
# we use the source-directory for the include file and
# the build directory for the RC file and message
# resources. This works at least for win32all.
h_dir = os.path.dirname(src)
rc_dir = os.path.dirname(obj)
try:
# first compile .MC to .RC and .H file
self.spawn([self.mc] +
['-h', h_dir, '-r', rc_dir] + [src])
base, _ = os.path.splitext (os.path.basename (src))
rc_file = os.path.join (rc_dir, base + '.rc')
# then compile .RC to .RES file
self.spawn([self.rc] +
["/fo" + obj] + [rc_file])
except DistutilsExecError as msg:
raise CompileError(msg)
continue
else:
# how to handle this file?
raise CompileError("Don't know how to compile %s to %s"
% (src, obj))
|
2 |
382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 |
elif ext in self._mc_extensions:
# Compile .MC to .RC file to .RES file.
# * '-h dir' specifies the directory for the
# generated include file
# * '-r dir' specifies the target directory of the
# generated RC file and the binary message resource
# it includes
#
# For now (since there are no options to change this),
# we use the source-directory for the include file and
# the build directory for the RC file and message
# resources. This works at least for win32all.
h_dir = os.path.dirname(src)
rc_dir = os.path.dirname(obj)
try:
# first compile .MC to .RC and .H file
self.spawn([self.mc] +
['-h', h_dir, '-r', rc_dir] + [src])
base, _ = os.path.splitext (os.path.basename (src))
rc_file = os.path.join (rc_dir, base + '.rc')
# then compile .RC to .RES file
self.spawn([self.rc] +
["/fo" + obj] + [rc_file])
except DistutilsExecError as msg:
raise CompileError(msg)
continue
else:
# how to handle this file?
raise CompileError("Don't know how to compile %s to %s"
% (src, obj))
|
If(Name('rfc'), [Assign([Name('url')], BinOp(Str('http://www.rfc-editor.org/rfc/rfc%d.txt'), Mod(), Call(Name('int'), [Name('rfc')], [], None, None))), Expr(Call(Attribute(Name('results'), 'append'), [BinOp(Str('<a href="%s">%s</a>'), Mod(), Tuple([Name('url'), Call(Name('escape'), [Name('all')], [], None, None)]))], [], None, None))], [If(Name('pep'), [Assign([Name('url')], BinOp(Str('http://www.python.org/dev/peps/pep-%04d/'), Mod(), Call(Name('int'), [Name('pep')], [], None, None))), Expr(Call(Attribute(Name('results'), 'append'), [BinOp(Str('<a href="%s">%s</a>'), Mod(), Tuple([Name('url'), Call(Name('escape'), [Name('all')], [], None, None)]))], [], None, None))], [If(Compare(Subscript(Name('text'), Slice(Name('end'), BinOp(Name('end'), Add(), Num(1)), None)), [Eq()], [Str('(')]), [Expr(Call(Attribute(Name('results'), 'append'), [Call(Attribute(Name('self'), 'namelink'), [Name('name'), Name('methods'), Name('funcs'), Name('classes')], [], None, None)], [], None, None))], [If(Name('selfdot'), [Expr(Call(Attribute(Name('results'), 'append'), [BinOp(Str('self.<strong>%s</strong>'), Mod(), Name('name'))], [], None, None))], [Expr(Call(Attribute(Name('results'), 'append'), [Call(Attribute(Name('self'), 'namelink'), [Name('name'), Name('classes')], [], None, None)], [], None, None))])])])])
1 |
564 565 566 567 568 569 570 571 572 573 574 575 |
elif rfc:
url = 'http://www.rfc-editor.org/rfc/rfc%d.txt' % int(rfc)
results.append('<a href="%s">%s</a>' % (url, escape(all)))
elif pep:
url = 'http://www.python.org/dev/peps/pep-%04d/' % int(pep)
results.append('<a href="%s">%s</a>' % (url, escape(all)))
elif text[end:end+1] == '(':
results.append(self.namelink(name, methods, funcs, classes))
elif selfdot:
results.append('self.<strong>%s</strong>' % name)
else:
results.append(self.namelink(name, classes))
|
2 |
728 729 730 731 732 733 734 735 736 737 738 739 |
elif rfc:
url = 'http://www.rfc-editor.org/rfc/rfc%d.txt' % int(rfc)
results.append('<a href="%s">%s</a>' % (url, escape(all)))
elif pep:
url = 'http://www.python.org/dev/peps/pep-%04d/' % int(pep)
results.append('<a href="%s">%s</a>' % (url, escape(all)))
elif text[end:end+1] == '(':
results.append(self.namelink(name, methods, funcs, classes))
elif selfdot:
results.append('self.<strong>%s</strong>' % name)
else:
results.append(self.namelink(name, classes))
|
FunctionDef('testall', arguments([arg('list', None), arg('recursive', None), arg('toplevel', None)], None, None, [], None, None, [], []), [Import([alias('sys', None)]), Import([alias('os', None)]), For(Name('filename'), Name('list'), [If(Call(Attribute(Attribute(Name('os'), 'path'), 'isdir'), [Name('filename')], [], None, None), [Expr(Call(Name('print'), [BinOp(Name('filename'), Add(), Str('/:'))], [keyword('end', Str(' '))], None, None)), If(BoolOp(Or(), [Name('recursive'), Name('toplevel')]), [Expr(Call(Name('print'), [Str('recursing down:')], [], None, None)), Import([alias('glob', None)]), Assign([Name('names')], Call(Attribute(Name('glob'), 'glob'), [Call(Attribute(Attribute(Name('os'), 'path'), 'join'), [Name('filename'), Str('*')], [], None, None)], [], None, None)), Expr(Call(Name('testall'), [Name('names'), Name('recursive'), Num(0)], [], None, None))], [Expr(Call(Name('print'), [Str('*** directory (use -r) ***')], [], None, None))])], [Expr(Call(Name('print'), [BinOp(Name('filename'), Add(), Str(':'))], [keyword('end', Str(' '))], None, None)), Expr(Call(Attribute(Attribute(Name('sys'), 'stdout'), 'flush'), [], [], None, None)), TryExcept([Expr(Call(Name('print'), [Call(Name('what'), [Name('filename')], [], None, None)], [], None, None))], [ExceptHandler(Name('IOError'), None, [Expr(Call(Name('print'), [Str('*** not found ***')], [], None, None))])], [])])], [])], [], None)
1 |
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
def testall(list, recursive, toplevel):
import sys
import os
for filename in list:
if os.path.isdir(filename):
print(filename + '/:', end=' ')
if recursive or toplevel:
print('recursing down:')
import glob
names = glob.glob(os.path.join(filename, '*'))
testall(names, recursive, 0)
else:
print('*** directory (use -r) ***')
else:
print(filename + ':', end=' ')
sys.stdout.flush()
try:
print(what(filename))
except IOError:
print('*** not found ***')
|
2 |
215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 |
def testall(list, recursive, toplevel):
import sys
import os
for filename in list:
if os.path.isdir(filename):
print(filename + '/:', end=' ')
if recursive or toplevel:
print('recursing down:')
import glob
names = glob.glob(os.path.join(filename, '*'))
testall(names, recursive, 0)
else:
print('*** directory (use -r) ***')
else:
print(filename + ':', end=' ')
sys.stdout.flush()
try:
print(what(filename))
except IOError:
print('*** not found ***')
|
FunctionDef('get_build_version', arguments([], None, None, [], None, None, [], []), [Expr(Str('Return the version of MSVC that was used to build Python.\n\n For Python 2.3 and up, the version number is included in\n sys.version. For earlier versions, assume the compiler is MSVC 6.\n ')), Assign([Name('prefix')], Str('MSC v.')), Assign([Name('i')], Call(Attribute(Attribute(Name('sys'), 'version'), 'find'), [Name('prefix')], [], None, None)), If(Compare(Name('i'), [Eq()], [UnaryOp(USub(), Num(1))]), [Return(Num(6))], []), Assign([Name('i')], BinOp(Name('i'), Add(), Call(Name('len'), [Name('prefix')], [], None, None))), Assign([Tuple([Name('s'), Name('rest')])], Call(Attribute(Subscript(Attribute(Name('sys'), 'version'), Slice(Name('i'), None, None)), 'split'), [Str(' '), Num(1)], [], None, None)), Assign([Name('majorVersion')], BinOp(Call(Name('int'), [Subscript(Name('s'), Slice(None, UnaryOp(USub(), Num(2)), None))], [], None, None), Sub(), Num(6))), Assign([Name('minorVersion')], BinOp(Call(Name('int'), [Subscript(Name('s'), Slice(Num(2), Num(3), None))], [], None, None), Div(), Num(10.0))), If(Compare(Name('majorVersion'), [Eq()], [Num(6)]), [Assign([Name('minorVersion')], Num(0))], []), If(Compare(Name('majorVersion'), [GtE()], [Num(6)]), [Return(BinOp(Name('majorVersion'), Add(), Name('minorVersion')))], []), Return(Name('None'))], [], None)
1 |
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 |
def get_build_version():
"""Return the version of MSVC that was used to build Python.
For Python 2.3 and up, the version number is included in
sys.version. For earlier versions, assume the compiler is MSVC 6.
"""
prefix = "MSC v."
i = sys.version.find(prefix)
if i == -1:
return 6
i = i + len(prefix)
s, rest = sys.version[i:].split(" ", 1)
majorVersion = int(s[:-2]) - 6
minorVersion = int(s[2:3]) / 10.0
# I don't think paths are affected by minor version in version 6
if majorVersion == 6:
minorVersion = 0
if majorVersion >= 6:
return majorVersion + minorVersion
# else we don't know what version of the compiler this is
return None
|
2 |
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
def get_build_version():
"""Return the version of MSVC that was used to build Python.
For Python 2.3 and up, the version number is included in
sys.version. For earlier versions, assume the compiler is MSVC 6.
"""
prefix = "MSC v."
i = sys.version.find(prefix)
if i == -1:
return 6
i = i + len(prefix)
s, rest = sys.version[i:].split(" ", 1)
majorVersion = int(s[:-2]) - 6
minorVersion = int(s[2:3]) / 10.0
# I don't think paths are affected by minor version in version 6
if majorVersion == 6:
minorVersion = 0
if majorVersion >= 6:
return majorVersion + minorVersion
# else we don't know what version of the compiler this is
return None
|
For(Name('filename'), Name('list'), [If(Call(Attribute(Attribute(Name('os'), 'path'), 'isdir'), [Name('filename')], [], None, None), [Expr(Call(Name('print'), [BinOp(Name('filename'), Add(), Str('/:'))], [keyword('end', Str(' '))], None, None)), If(BoolOp(Or(), [Name('recursive'), Name('toplevel')]), [Expr(Call(Name('print'), [Str('recursing down:')], [], None, None)), Import([alias('glob', None)]), Assign([Name('names')], Call(Attribute(Name('glob'), 'glob'), [Call(Attribute(Attribute(Name('os'), 'path'), 'join'), [Name('filename'), Str('*')], [], None, None)], [], None, None)), Expr(Call(Name('testall'), [Name('names'), Name('recursive'), Num(0)], [], None, None))], [Expr(Call(Name('print'), [Str('*** directory (use -r) ***')], [], None, None))])], [Expr(Call(Name('print'), [BinOp(Name('filename'), Add(), Str(':'))], [keyword('end', Str(' '))], None, None)), Expr(Call(Attribute(Attribute(Name('sys'), 'stdout'), 'flush'), [], [], None, None)), TryExcept([Expr(Call(Name('print'), [Call(Name('what'), [Name('filename')], [], None, None)], [], None, None))], [ExceptHandler(Name('IOError'), None, [Expr(Call(Name('print'), [Str('*** not found ***')], [], None, None))])], [])])], [])
1 |
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
for filename in list:
if os.path.isdir(filename):
print(filename + '/:', end=' ')
if recursive or toplevel:
print('recursing down:')
import glob
names = glob.glob(os.path.join(filename, '*'))
testall(names, recursive, 0)
else:
print('*** directory (use -r) ***')
else:
print(filename + ':', end=' ')
sys.stdout.flush()
try:
print(what(filename))
except IOError:
print('*** not found ***')
|
2 |
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 |
for filename in list:
if os.path.isdir(filename):
print(filename + '/:', end=' ')
if recursive or toplevel:
print('recursing down:')
import glob
names = glob.glob(os.path.join(filename, '*'))
testall(names, recursive, 0)
else:
print('*** directory (use -r) ***')
else:
print(filename + ':', end=' ')
sys.stdout.flush()
try:
print(what(filename))
except IOError:
print('*** not found ***')
|
If(Call(Attribute(Attribute(Name('os'), 'path'), 'isdir'), [Name('filename')], [], None, None), [Expr(Call(Name('print'), [BinOp(Name('filename'), Add(), Str('/:'))], [keyword('end', Str(' '))], None, None)), If(BoolOp(Or(), [Name('recursive'), Name('toplevel')]), [Expr(Call(Name('print'), [Str('recursing down:')], [], None, None)), Import([alias('glob', None)]), Assign([Name('names')], Call(Attribute(Name('glob'), 'glob'), [Call(Attribute(Attribute(Name('os'), 'path'), 'join'), [Name('filename'), Str('*')], [], None, None)], [], None, None)), Expr(Call(Name('testall'), [Name('names'), Name('recursive'), Num(0)], [], None, None))], [Expr(Call(Name('print'), [Str('*** directory (use -r) ***')], [], None, None))])], [Expr(Call(Name('print'), [BinOp(Name('filename'), Add(), Str(':'))], [keyword('end', Str(' '))], None, None)), Expr(Call(Attribute(Attribute(Name('sys'), 'stdout'), 'flush'), [], [], None, None)), TryExcept([Expr(Call(Name('print'), [Call(Name('what'), [Name('filename')], [], None, None)], [], None, None))], [ExceptHandler(Name('IOError'), None, [Expr(Call(Name('print'), [Str('*** not found ***')], [], None, None))])], [])])
1 |
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
if os.path.isdir(filename):
print(filename + '/:', end=' ')
if recursive or toplevel:
print('recursing down:')
import glob
names = glob.glob(os.path.join(filename, '*'))
testall(names, recursive, 0)
else:
print('*** directory (use -r) ***')
else:
print(filename + ':', end=' ')
sys.stdout.flush()
try:
print(what(filename))
except IOError:
print('*** not found ***')
|
2 |
219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 |
if os.path.isdir(filename):
print(filename + '/:', end=' ')
if recursive or toplevel:
print('recursing down:')
import glob
names = glob.glob(os.path.join(filename, '*'))
testall(names, recursive, 0)
else:
print('*** directory (use -r) ***')
else:
print(filename + ':', end=' ')
sys.stdout.flush()
try:
print(what(filename))
except IOError:
print('*** not found ***')
|
If(Compare(Call(Name('len'), [Name('archs')], [], None, None), [Eq()], [Num(1)]), [Assign([Name('machine')], Subscript(Name('archs'), Index(Num(0))))], [If(Compare(Name('archs'), [Eq()], [Tuple([Str('i386'), Str('ppc')])]), [Assign([Name('machine')], Str('fat'))], [If(Compare(Name('archs'), [Eq()], [Tuple([Str('i386'), Str('x86_64')])]), [Assign([Name('machine')], Str('intel'))], [If(Compare(Name('archs'), [Eq()], [Tuple([Str('i386'), Str('ppc'), Str('x86_64')])]), [Assign([Name('machine')], Str('fat3'))], [If(Compare(Name('archs'), [Eq()], [Tuple([Str('ppc64'), Str('x86_64')])]), [Assign([Name('machine')], Str('fat64'))], [If(Compare(Name('archs'), [Eq()], [Tuple([Str('i386'), Str('ppc'), Str('ppc64'), Str('x86_64')])]), [Assign([Name('machine')], Str('universal'))], [Raise(Call(Name('ValueError'), [BinOp(Str("Don't know machine value for archs=%r"), Mod(), Tuple([Name('archs')]))], [], None, None), None)])])])])])])
1 |
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
if len(archs) == 1:
machine = archs[0]
elif archs == ('i386', 'ppc'):
machine = 'fat'
elif archs == ('i386', 'x86_64'):
machine = 'intel'
elif archs == ('i386', 'ppc', 'x86_64'):
machine = 'fat3'
elif archs == ('ppc64', 'x86_64'):
machine = 'fat64'
elif archs == ('i386', 'ppc', 'ppc64', 'x86_64'):
machine = 'universal'
else:
raise ValueError(
"Don't know machine value for archs=%r"%(archs,))
|
2 |
735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 |
if len(archs) == 1:
machine = archs[0]
elif archs == ('i386', 'ppc'):
machine = 'fat'
elif archs == ('i386', 'x86_64'):
machine = 'intel'
elif archs == ('i386', 'ppc', 'x86_64'):
machine = 'fat3'
elif archs == ('ppc64', 'x86_64'):
machine = 'fat64'
elif archs == ('i386', 'ppc', 'ppc64', 'x86_64'):
machine = 'universal'
else:
raise ValueError(
"Don't know machine value for archs=%r"%(archs,))
|
If(Compare(Name('n'), [In()], [Name('done')]), [Assign([Name('item')], Call(Name('str'), [Subscript(Name('done'), Index(Name('n')))], [], None, None))], [If(Compare(Name('n'), [In()], [Name('notdone')]), [Assign([Name('found')], Name('False'))], [If(Compare(Name('n'), [In()], [Attribute(Name('os'), 'environ')]), [Assign([Name('item')], Subscript(Attribute(Name('os'), 'environ'), Index(Name('n'))))], [If(Compare(Name('n'), [In()], [Name('renamed_variables')]), [If(BoolOp(And(), [Call(Attribute(Name('name'), 'startswith'), [Str('PY_')], [], None, None), Compare(Subscript(Name('name'), Slice(Num(3), None, None)), [In()], [Name('renamed_variables')])]), [Assign([Name('item')], Str(''))], [If(Compare(BinOp(Str('PY_'), Add(), Name('n')), [In()], [Name('notdone')]), [Assign([Name('found')], Name('False'))], [Assign([Name('item')], Call(Name('str'), [Subscript(Name('done'), Index(BinOp(Str('PY_'), Add(), Name('n'))))], [], None, None))])])], [Assign([Subscript(Name('done'), Index(Name('n'))), Name('item')], Str(''))])])])])
1 |
346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 |
if n in done:
item = str(done[n])
elif n in notdone:
# get it on a subsequent round
found = False
elif n in os.environ:
# do it like make: fall back to environment
item = os.environ[n]
elif n in renamed_variables:
if name.startswith('PY_') and name[3:] in renamed_variables:
item = ""
elif 'PY_' + n in notdone:
found = False
else:
item = str(done['PY_' + n])
else:
done[n] = item = ""
|
2 |
280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 |
if n in done:
item = str(done[n])
elif n in notdone:
# get it on a subsequent round
found = False
elif n in os.environ:
# do it like make: fall back to environment
item = os.environ[n]
elif n in renamed_variables:
if name.startswith('PY_') and name[3:] in renamed_variables:
item = ""
elif 'PY_' + n in notdone:
found = False
else:
item = str(done['PY_' + n])
else:
done[n] = item = ""
|
FunctionDef('create_static_lib', arguments([arg('self', None), arg('objects', None), arg('output_libname', None), arg('output_dir', None), arg('debug', None), arg('target_lang', None)], None, None, [], None, None, [Name('None'), Num(0), Name('None')], []), [If(UnaryOp(Not(), Attribute(Name('self'), 'initialized')), [Expr(Call(Attribute(Name('self'), 'initialize'), [], [], None, None))], []), Assign([Tuple([Name('objects'), Name('output_dir')])], Call(Attribute(Name('self'), '_fix_object_args'), [Name('objects'), Name('output_dir')], [], None, None)), Assign([Name('output_filename')], Call(Attribute(Name('self'), 'library_filename'), [Name('output_libname')], [keyword('output_dir', Name('output_dir'))], None, None)), If(Call(Attribute(Name('self'), '_need_link'), [Name('objects'), Name('output_filename')], [], None, None), [Assign([Name('lib_args')], BinOp(Name('objects'), Add(), List([BinOp(Str('/OUT:'), Add(), Name('output_filename'))]))), If(Name('debug'), [Pass()], []), TryExcept([Expr(Call(Attribute(Name('self'), 'spawn'), [BinOp(List([Attribute(Name('self'), 'lib')]), Add(), Name('lib_args'))], [], None, None))], [ExceptHandler(Name('DistutilsExecError'), 'msg', [Raise(Call(Name('LibError'), [Name('msg')], [], None, None), None)])], [])], [Expr(Call(Attribute(Name('log'), 'debug'), [Str('skipping %s (up-to-date)'), Name('output_filename')], [], None, None))])], [], None)
1 |
540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 |
def create_static_lib(self,
objects,
output_libname,
output_dir=None,
debug=0,
target_lang=None):
if not self.initialized:
self.initialize()
(objects, output_dir) = self._fix_object_args(objects, output_dir)
output_filename = self.library_filename(output_libname,
output_dir=output_dir)
if self._need_link(objects, output_filename):
lib_args = objects + ['/OUT:' + output_filename]
if debug:
pass # XXX what goes here?
try:
self.spawn([self.lib] + lib_args)
except DistutilsExecError as msg:
raise LibError(msg)
else:
log.debug("skipping %s (up-to-date)", output_filename)
|
2 |
425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 |
def create_static_lib(self,
objects,
output_libname,
output_dir=None,
debug=0,
target_lang=None):
if not self.initialized:
self.initialize()
(objects, output_dir) = self._fix_object_args(objects, output_dir)
output_filename = self.library_filename(output_libname,
output_dir=output_dir)
if self._need_link(objects, output_filename):
lib_args = objects + ['/OUT:' + output_filename]
if debug:
pass # XXX what goes here?
try:
self.spawn([self.lib] + lib_args)
except DistutilsExecError as msg:
raise LibError(msg)
else:
log.debug("skipping %s (up-to-date)", output_filename)
|
TryExcept([Expr(Call(Attribute(Name('self'), 'spawn'), [BinOp(BinOp(List([Attribute(Name('self'), 'mc')]), Add(), List([Str('-h'), Name('h_dir'), Str('-r'), Name('rc_dir')])), Add(), List([Name('src')]))], [], None, None)), Assign([Tuple([Name('base'), Name('_')])], Call(Attribute(Attribute(Name('os'), 'path'), 'splitext'), [Call(Attribute(Attribute(Name('os'), 'path'), 'basename'), [Name('src')], [], None, None)], [], None, None)), Assign([Name('rc_file')], Call(Attribute(Attribute(Name('os'), 'path'), 'join'), [Name('rc_dir'), BinOp(Name('base'), Add(), Str('.rc'))], [], None, None)), Expr(Call(Attribute(Name('self'), 'spawn'), [BinOp(BinOp(List([Attribute(Name('self'), 'rc')]), Add(), List([BinOp(Str('/fo'), Add(), Name('obj'))])), Add(), List([Name('rc_file')]))], [], None, None))], [ExceptHandler(Name('DistutilsExecError'), 'msg', [Raise(Call(Name('CompileError'), [Name('msg')], [], None, None), None)])], [])
1 |
511 512 513 514 515 516 517 518 519 520 521 522 |
try:
# first compile .MC to .RC and .H file
self.spawn([self.mc] +
['-h', h_dir, '-r', rc_dir] + [src])
base, _ = os.path.splitext (os.path.basename (src))
rc_file = os.path.join (rc_dir, base + '.rc')
# then compile .RC to .RES file
self.spawn([self.rc] +
["/fo" + obj] + [rc_file])
except DistutilsExecError as msg:
raise CompileError(msg)
|
2 |
396 397 398 399 400 401 402 403 404 405 406 407 |
try:
# first compile .MC to .RC and .H file
self.spawn([self.mc] +
['-h', h_dir, '-r', rc_dir] + [src])
base, _ = os.path.splitext (os.path.basename (src))
rc_file = os.path.join (rc_dir, base + '.rc')
# then compile .RC to .RES file
self.spawn([self.rc] +
["/fo" + obj] + [rc_file])
except DistutilsExecError as msg:
raise CompileError(msg)
|
If(Compare(Call(Name('len'), [Name('args')], [], None, None), [Gt()], [Num(0)]), [Assign([Name('progname')], Subscript(Name('args'), Index(Num(0)))), Expr(Call(Attribute(Attribute(Name('sys'), 'path'), 'insert'), [Num(0), Call(Attribute(Attribute(Name('os'), 'path'), 'dirname'), [Name('progname')], [], None, None)], [], None, None)), With(Call(Name('open'), [Name('progname'), Str('rb')], [], None, None), Name('fp'), [Assign([Name('code')], Call(Name('compile'), [Call(Attribute(Name('fp'), 'read'), [], [], None, None), Name('progname'), Str('exec')], [], None, None))]), Assign([Name('globs')], Dict([Str('__file__'), Str('__name__'), Str('__package__'), Str('__cached__')], [Name('progname'), Str('__main__'), Name('None'), Name('None')])), Expr(Call(Name('runctx'), [Name('code'), Name('globs'), Name('None'), Attribute(Name('options'), 'outfile'), Attribute(Name('options'), 'sort')], [], None, None))], [Expr(Call(Attribute(Name('parser'), 'print_usage'), [], [], None, None))])
1 |
177 178 179 180 181 182 183 184 185 186 187 188 189 190 |
if len(args) > 0:
progname = args[0]
sys.path.insert(0, os.path.dirname(progname))
with open(progname, 'rb') as fp:
code = compile(fp.read(), progname, 'exec')
globs = {
'__file__': progname,
'__name__': '__main__',
'__package__': None,
'__cached__': None,
}
runctx(code, globs, None, options.outfile, options.sort)
else:
parser.print_usage()
|
2 |
586 587 588 589 590 591 592 593 594 595 596 597 598 599 |
if len(args) > 0:
progname = args[0]
sys.path.insert(0, os.path.dirname(progname))
with open(progname, 'rb') as fp:
code = compile(fp.read(), progname, 'exec')
globs = {
'__file__': progname,
'__name__': '__main__',
'__package__': None,
'__cached__': None,
}
runctx(code, globs, None, options.outfile, options.sort)
else:
parser.print_usage()
|
FunctionDef('find_cookie', arguments([arg('line', None)], None, None, [], None, None, [], []), [TryExcept([Assign([Name('line_string')], Call(Attribute(Name('line'), 'decode'), [Str('ascii')], [], None, None))], [ExceptHandler(Name('UnicodeDecodeError'), None, [Return(Name('None'))])], []), Assign([Name('matches')], Call(Attribute(Name('cookie_re'), 'findall'), [Name('line_string')], [], None, None)), If(UnaryOp(Not(), Name('matches')), [Return(Name('None'))], []), Assign([Name('encoding')], Call(Name('_get_normal_name'), [Subscript(Name('matches'), Index(Num(0)))], [], None, None)), TryExcept([Assign([Name('codec')], Call(Name('lookup'), [Name('encoding')], [], None, None))], [ExceptHandler(Name('LookupError'), None, [Raise(Call(Name('SyntaxError'), [BinOp(Str('unknown encoding: '), Add(), Name('encoding'))], [], None, None), None)])], []), If(Name('bom_found'), [If(Compare(Attribute(Name('codec'), 'name'), [NotEq()], [Str('utf-8')]), [Raise(Call(Name('SyntaxError'), [Str('encoding problem: utf-8')], [], None, None), None)], []), AugAssign(Name('encoding'), Add(), Str('-sig'))], []), Return(Name('encoding'))], [], None)
1 |
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 |
def find_cookie(line):
try:
line_string = line.decode('ascii')
except UnicodeDecodeError:
return None
matches = cookie_re.findall(line_string)
if not matches:
return None
encoding = _get_normal_name(matches[0])
try:
codec = lookup(encoding)
except LookupError:
# This behaviour mimics the Python interpreter
raise SyntaxError("unknown encoding: " + encoding)
if bom_found:
if codec.name != 'utf-8':
# This behaviour mimics the Python interpreter
raise SyntaxError('encoding problem: utf-8')
encoding += '-sig'
return encoding
|
2 |
293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 |
def find_cookie(line):
try:
line_string = line.decode('ascii')
except UnicodeDecodeError:
return None
matches = cookie_re.findall(line_string)
if not matches:
return None
encoding = _get_normal_name(matches[0])
try:
codec = lookup(encoding)
except LookupError:
# This behaviour mimics the Python interpreter
raise SyntaxError("unknown encoding: " + encoding)
if bom_found:
if codec.name != 'utf-8':
# This behaviour mimics the Python interpreter
raise SyntaxError('encoding problem: utf-8')
encoding += '-sig'
return encoding
|
FunctionDef('find_exe', arguments([arg('self', None), arg('exe', None)], None, None, [], None, None, [], []), [Expr(Str("Return path to an MSVC executable program.\n\n Tries to find the program in several places: first, one of the\n MSVC program search paths from the registry; next, the directories\n in the PATH environment variable. If any of those work, return an\n absolute path that is known to exist. If none of them work, just\n return the original program name, 'exe'.\n ")), For(Name('p'), Attribute(Name('self'), '__paths'), [Assign([Name('fn')], Call(Attribute(Attribute(Name('os'), 'path'), 'join'), [Call(Attribute(Attribute(Name('os'), 'path'), 'abspath'), [Name('p')], [], None, None), Name('exe')], [], None, None)), If(Call(Attribute(Attribute(Name('os'), 'path'), 'isfile'), [Name('fn')], [], None, None), [Return(Name('fn'))], [])], []), For(Name('p'), Call(Attribute(Subscript(Attribute(Name('os'), 'environ'), Index(Str('Path'))), 'split'), [Str(';')], [], None, None), [Assign([Name('fn')], Call(Attribute(Attribute(Name('os'), 'path'), 'join'), [Call(Attribute(Attribute(Name('os'), 'path'), 'abspath'), [Name('p')], [], None, None), Name('exe')], [], None, None)), If(Call(Attribute(Attribute(Name('os'), 'path'), 'isfile'), [Name('fn')], [], None, None), [Return(Name('fn'))], [])], []), Return(Name('exe'))], [], None)
1 |
768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 |
def find_exe(self, exe):
"""Return path to an MSVC executable program.
Tries to find the program in several places: first, one of the
MSVC program search paths from the registry; next, the directories
in the PATH environment variable. If any of those work, return an
absolute path that is known to exist. If none of them work, just
return the original program name, 'exe'.
"""
for p in self.__paths:
fn = os.path.join(os.path.abspath(p), exe)
if os.path.isfile(fn):
return fn
# didn't find it; try existing path
for p in os.environ['Path'].split(';'):
fn = os.path.join(os.path.abspath(p),exe)
if os.path.isfile(fn):
return fn
return exe
|
2 |
562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 |
def find_exe(self, exe):
"""Return path to an MSVC executable program.
Tries to find the program in several places: first, one of the
MSVC program search paths from the registry; next, the directories
in the PATH environment variable. If any of those work, return an
absolute path that is known to exist. If none of them work, just
return the original program name, 'exe'.
"""
for p in self.__paths:
fn = os.path.join(os.path.abspath(p), exe)
if os.path.isfile(fn):
return fn
# didn't find it; try existing path
for p in os.environ['Path'].split(';'):
fn = os.path.join(os.path.abspath(p),exe)
if os.path.isfile(fn):
return fn
return exe
|
If(Compare(Name('archs'), [Eq()], [Tuple([Str('i386'), Str('ppc')])]), [Assign([Name('machine')], Str('fat'))], [If(Compare(Name('archs'), [Eq()], [Tuple([Str('i386'), Str('x86_64')])]), [Assign([Name('machine')], Str('intel'))], [If(Compare(Name('archs'), [Eq()], [Tuple([Str('i386'), Str('ppc'), Str('x86_64')])]), [Assign([Name('machine')], Str('fat3'))], [If(Compare(Name('archs'), [Eq()], [Tuple([Str('ppc64'), Str('x86_64')])]), [Assign([Name('machine')], Str('fat64'))], [If(Compare(Name('archs'), [Eq()], [Tuple([Str('i386'), Str('ppc'), Str('ppc64'), Str('x86_64')])]), [Assign([Name('machine')], Str('universal'))], [Raise(Call(Name('ValueError'), [BinOp(Str("Don't know machine value for archs=%r"), Mod(), Tuple([Name('archs')]))], [], None, None), None)])])])])])
1 |
157 158 159 160 161 162 163 164 165 166 167 168 169 |
elif archs == ('i386', 'ppc'):
machine = 'fat'
elif archs == ('i386', 'x86_64'):
machine = 'intel'
elif archs == ('i386', 'ppc', 'x86_64'):
machine = 'fat3'
elif archs == ('ppc64', 'x86_64'):
machine = 'fat64'
elif archs == ('i386', 'ppc', 'ppc64', 'x86_64'):
machine = 'universal'
else:
raise ValueError(
"Don't know machine value for archs=%r"%(archs,))
|
2 |
737 738 739 740 741 742 743 744 745 746 747 748 749 |
elif archs == ('i386', 'ppc'):
machine = 'fat'
elif archs == ('i386', 'x86_64'):
machine = 'intel'
elif archs == ('i386', 'ppc', 'x86_64'):
machine = 'fat3'
elif archs == ('ppc64', 'x86_64'):
machine = 'fat64'
elif archs == ('i386', 'ppc', 'ppc64', 'x86_64'):
machine = 'universal'
else:
raise ValueError(
"Don't know machine value for archs=%r"%(archs,))
|
FunctionDef('test', arguments([], None, None, [], None, None, [], []), [Import([alias('sys', None)]), Assign([Name('recursive')], Num(0)), If(BoolOp(And(), [Subscript(Attribute(Name('sys'), 'argv'), Slice(Num(1), None, None)), Compare(Subscript(Attribute(Name('sys'), 'argv'), Index(Num(1))), [Eq()], [Str('-r')])]), [Delete([Subscript(Attribute(Name('sys'), 'argv'), Slice(Num(1), Num(2), None), Del())]), Assign([Name('recursive')], Num(1))], []), TryExcept([If(Subscript(Attribute(Name('sys'), 'argv'), Slice(Num(1), None, None)), [Expr(Call(Name('testall'), [Subscript(Attribute(Name('sys'), 'argv'), Slice(Num(1), None, None)), Name('recursive'), Num(1)], [], None, None))], [Expr(Call(Name('testall'), [List([Str('.')]), Name('recursive'), Num(1)], [], None, None))])], [ExceptHandler(Name('KeyboardInterrupt'), None, [Expr(Call(Attribute(Attribute(Name('sys'), 'stderr'), 'write'), [Str('\n[Interrupted]\n')], [], None, None)), Expr(Call(Attribute(Name('sys'), 'exit'), [Num(1)], [], None, None))])], [])], [], None)
1 |
119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
def test():
import sys
recursive = 0
if sys.argv[1:] and sys.argv[1] == '-r':
del sys.argv[1:2]
recursive = 1
try:
if sys.argv[1:]:
testall(sys.argv[1:], recursive, 1)
else:
testall(['.'], recursive, 1)
except KeyboardInterrupt:
sys.stderr.write('\n[Interrupted]\n')
sys.exit(1)
|
2 |
200 201 202 203 204 205 206 207 208 209 210 211 212 213 |
def test():
import sys
recursive = 0
if sys.argv[1:] and sys.argv[1] == '-r':
del sys.argv[1:2]
recursive = 1
try:
if sys.argv[1:]:
testall(sys.argv[1:], recursive, 1)
else:
testall(['.'], recursive, 1)
except KeyboardInterrupt:
sys.stderr.write('\n[Interrupted]\n')
sys.exit(1)
|
If(Compare(Name('n'), [In()], [Name('notdone')]), [Assign([Name('found')], Name('False'))], [If(Compare(Name('n'), [In()], [Attribute(Name('os'), 'environ')]), [Assign([Name('item')], Subscript(Attribute(Name('os'), 'environ'), Index(Name('n'))))], [If(Compare(Name('n'), [In()], [Name('renamed_variables')]), [If(BoolOp(And(), [Call(Attribute(Name('name'), 'startswith'), [Str('PY_')], [], None, None), Compare(Subscript(Name('name'), Slice(Num(3), None, None)), [In()], [Name('renamed_variables')])]), [Assign([Name('item')], Str(''))], [If(Compare(BinOp(Str('PY_'), Add(), Name('n')), [In()], [Name('notdone')]), [Assign([Name('found')], Name('False'))], [Assign([Name('item')], Call(Name('str'), [Subscript(Name('done'), Index(BinOp(Str('PY_'), Add(), Name('n'))))], [], None, None))])])], [Assign([Subscript(Name('done'), Index(Name('n'))), Name('item')], Str(''))])])])
1 |
348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 |
elif n in notdone:
# get it on a subsequent round
found = False
elif n in os.environ:
# do it like make: fall back to environment
item = os.environ[n]
elif n in renamed_variables:
if name.startswith('PY_') and name[3:] in renamed_variables:
item = ""
elif 'PY_' + n in notdone:
found = False
else:
item = str(done['PY_' + n])
else:
done[n] = item = ""
|
2 |
282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 |
elif n in notdone:
# get it on a subsequent round
found = False
elif n in os.environ:
# do it like make: fall back to environment
item = os.environ[n]
elif n in renamed_variables:
if name.startswith('PY_') and name[3:] in renamed_variables:
item = ""
elif 'PY_' + n in notdone:
found = False
else:
item = str(done['PY_' + n])
else:
done[n] = item = ""
|
If(Name('pep'), [Assign([Name('url')], BinOp(Str('http://www.python.org/dev/peps/pep-%04d/'), Mod(), Call(Name('int'), [Name('pep')], [], None, None))), Expr(Call(Attribute(Name('results'), 'append'), [BinOp(Str('<a href="%s">%s</a>'), Mod(), Tuple([Name('url'), Call(Name('escape'), [Name('all')], [], None, None)]))], [], None, None))], [If(Compare(Subscript(Name('text'), Slice(Name('end'), BinOp(Name('end'), Add(), Num(1)), None)), [Eq()], [Str('(')]), [Expr(Call(Attribute(Name('results'), 'append'), [Call(Attribute(Name('self'), 'namelink'), [Name('name'), Name('methods'), Name('funcs'), Name('classes')], [], None, None)], [], None, None))], [If(Name('selfdot'), [Expr(Call(Attribute(Name('results'), 'append'), [BinOp(Str('self.<strong>%s</strong>'), Mod(), Name('name'))], [], None, None))], [Expr(Call(Attribute(Name('results'), 'append'), [Call(Attribute(Name('self'), 'namelink'), [Name('name'), Name('classes')], [], None, None)], [], None, None))])])])
1 |
567 568 569 570 571 572 573 574 575 |
elif pep:
url = 'http://www.python.org/dev/peps/pep-%04d/' % int(pep)
results.append('<a href="%s">%s</a>' % (url, escape(all)))
elif text[end:end+1] == '(':
results.append(self.namelink(name, methods, funcs, classes))
elif selfdot:
results.append('self.<strong>%s</strong>' % name)
else:
results.append(self.namelink(name, classes))
|
2 |
731 732 733 734 735 736 737 738 739 |
elif pep:
url = 'http://www.python.org/dev/peps/pep-%04d/' % int(pep)
results.append('<a href="%s">%s</a>' % (url, escape(all)))
elif text[end:end+1] == '(':
results.append(self.namelink(name, methods, funcs, classes))
elif selfdot:
results.append('self.<strong>%s</strong>' % name)
else:
results.append(self.namelink(name, classes))
|
If(Compare(Attribute(Name('os'), 'name'), [Eq()], [Str('nt')]), [Assign([Name('prefix')], Str(' bit (')), Assign([Name('i')], Call(Attribute(Attribute(Name('sys'), 'version'), 'find'), [Name('prefix')], [], None, None)), If(Compare(Name('i'), [Eq()], [UnaryOp(USub(), Num(1))]), [Return(Attribute(Name('sys'), 'platform'))], []), Assign([Name('j')], Call(Attribute(Attribute(Name('sys'), 'version'), 'find'), [Str(')'), Name('i')], [], None, None)), Assign([Name('look')], Call(Attribute(Subscript(Attribute(Name('sys'), 'version'), Slice(BinOp(Name('i'), Add(), Call(Name('len'), [Name('prefix')], [], None, None)), Name('j'), None)), 'lower'), [], [], None, None)), If(Compare(Name('look'), [Eq()], [Str('amd64')]), [Return(Str('win-amd64'))], []), If(Compare(Name('look'), [Eq()], [Str('itanium')]), [Return(Str('win-ia64'))], []), Return(Attribute(Name('sys'), 'platform'))], [])
1 |
42 43 44 45 46 47 48 49 50 51 52 53 54 |
if os.name == 'nt':
# sniff sys.version for architecture.
prefix = " bit ("
i = sys.version.find(prefix)
if i == -1:
return sys.platform
j = sys.version.find(")", i)
look = sys.version[i+len(prefix):j].lower()
if look == 'amd64':
return 'win-amd64'
if look == 'itanium':
return 'win-ia64'
return sys.platform
|
2 |
625 626 627 628 629 630 631 632 633 634 635 636 637 |
if os.name == 'nt':
# sniff sys.version for architecture.
prefix = " bit ("
i = sys.version.find(prefix)
if i == -1:
return sys.platform
j = sys.version.find(")", i)
look = sys.version[i+len(prefix):j].lower()
if look == 'amd64':
return 'win-amd64'
if look == 'itanium':
return 'win-ia64'
return sys.platform
|
ClassDef('Namespace', [Name('object')], [], None, None, [FunctionDef('__init__', arguments([arg('self', None)], None, None, [], 'kwds', None, [], []), [Expr(Call(Attribute(Attribute(Name('self'), '__dict__'), 'update'), [Name('kwds')], [], None, None))], [], None), FunctionDef('__repr__', arguments([arg('self', None)], None, None, [], None, None, [], []), [Assign([Name('items')], Call(Name('list'), [Call(Attribute(Attribute(Name('self'), '__dict__'), 'items'), [], [], None, None)], [], None, None)), Assign([Name('temp')], List([])), For(Tuple([Name('name'), Name('value')]), Name('items'), [If(UnaryOp(Not(), Call(Attribute(Name('name'), 'startswith'), [Str('_')], [], None, None)), [Expr(Call(Attribute(Name('temp'), 'append'), [BinOp(Str('%s=%r'), Mod(), Tuple([Name('name'), Name('value')]))], [], None, None))], [])], []), Expr(Call(Attribute(Name('temp'), 'sort'), [], [], None, None)), Return(BinOp(Str('Namespace(%s)'), Mod(), Call(Attribute(Name('str'), 'join'), [Str(', '), Name('temp')], [], None, None)))], [], None)], [])
1 |
116 117 118 119 120 121 122 123 124 125 126 |
class Namespace(object):
def __init__(self, **kwds):
self.__dict__.update(kwds)
def __repr__(self):
items = list(self.__dict__.items())
temp = []
for name, value in items:
if not name.startswith('_'):
temp.append('%s=%r' % (name, value))
temp.sort()
return 'Namespace(%s)' % str.join(', ', temp)
|
2 |
938 939 940 941 942 943 944 945 946 947 948 |
class Namespace(object):
def __init__(self, **kwds):
self.__dict__.update(kwds)
def __repr__(self):
items = list(self.__dict__.items())
temp = []
for name, value in items:
if not name.startswith('_'):
temp.append('%s=%r' % (name, value))
temp.sort()
return 'Namespace(%s)' % str.join(', ', temp)
|
If(BoolOp(Or(), [Attribute(Name('self'), '_is_special'), Attribute(Name('other'), '_is_special')]), [Assign([Name('sn')], Call(Attribute(Name('self'), '_isnan'), [], [], None, None)), Assign([Name('on')], Call(Attribute(Name('other'), '_isnan'), [], [], None, None)), If(BoolOp(Or(), [Name('sn'), Name('on')]), [If(BoolOp(And(), [Compare(Name('on'), [Eq()], [Num(1)]), Compare(Name('sn'), [Eq()], [Num(0)])]), [Return(Call(Attribute(Name('self'), '_fix'), [Name('context')], [], None, None))], []), If(BoolOp(And(), [Compare(Name('sn'), [Eq()], [Num(1)]), Compare(Name('on'), [Eq()], [Num(0)])]), [Return(Call(Attribute(Name('other'), '_fix'), [Name('context')], [], None, None))], []), Return(Call(Attribute(Name('self'), '_check_nans'), [Name('other'), Name('context')], [], None, None))], [])], [])
1 |
2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 |
if self._is_special or other._is_special:
# If one operand is a quiet NaN and the other is number, then the
# number is always returned
sn = self._isnan()
on = other._isnan()
if sn or on:
if on == 1 and sn == 0:
return self._fix(context)
if sn == 1 and on == 0:
return other._fix(context)
return self._check_nans(other, context)
|
2 |
2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 |
if self._is_special or other._is_special:
# If one operand is a quiet NaN and the other is number, then the
# number is always returned
sn = self._isnan()
on = other._isnan()
if sn or on:
if on == 1 and sn == 0:
return self._fix(context)
if sn == 1 and on == 0:
return other._fix(context)
return self._check_nans(other, context)
|
3 |
3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 |
if self._is_special or other._is_special:
# If one operand is a quiet NaN and the other is number, then the
# number is always returned
sn = self._isnan()
on = other._isnan()
if sn or on:
if on == 1 and sn == 0:
return self._fix(context)
if sn == 1 and on == 0:
return other._fix(context)
return self._check_nans(other, context)
|
4 |
3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 |
if self._is_special or other._is_special:
# If one operand is a quiet NaN and the other is number, then the
# number is always returned
sn = self._isnan()
on = other._isnan()
if sn or on:
if on == 1 and sn == 0:
return self._fix(context)
if sn == 1 and on == 0:
return other._fix(context)
return self._check_nans(other, context)
|
If(Name('m'), [Assign([Tuple([Name('n'), Name('v')])], Call(Attribute(Name('m'), 'group'), [Num(1), Num(2)], [], None, None)), Assign([Name('v')], Call(Attribute(Name('v'), 'strip'), [], [], None, None)), Assign([Name('tmpv')], Call(Attribute(Name('v'), 'replace'), [Str('$$'), Str('')], [], None, None)), If(Compare(Str('$'), [In()], [Name('tmpv')]), [Assign([Subscript(Name('notdone'), Index(Name('n')))], Name('v'))], [TryExcept([Assign([Name('v')], Call(Name('int'), [Name('v')], [], None, None))], [ExceptHandler(Name('ValueError'), None, [Assign([Subscript(Name('done'), Index(Name('n')))], Call(Attribute(Name('v'), 'replace'), [Str('$$'), Str('$')], [], None, None))])], [Assign([Subscript(Name('done'), Index(Name('n')))], Name('v'))])])], [])
1 |
315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 |
if m:
n, v = m.group(1, 2)
v = v.strip()
# `$$' is a literal `$' in make
tmpv = v.replace('$$', '')
if "$" in tmpv:
notdone[n] = v
else:
try:
v = int(v)
except ValueError:
# insert literal `$'
done[n] = v.replace('$$', '$')
else:
done[n] = v
|
2 |
247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 |
if m:
n, v = m.group(1, 2)
v = v.strip()
# `$$' is a literal `$' in make
tmpv = v.replace('$$', '')
if "$" in tmpv:
notdone[n] = v
else:
try:
v = int(v)
except ValueError:
# insert literal `$'
done[n] = v.replace('$$', '$')
else:
done[n] = v
|
If(Compare(Name('ext'), [In()], [Attribute(Name('self'), '_rc_extensions')]), [Expr(Call(Attribute(Name('obj_names'), 'append'), [Call(Attribute(Attribute(Name('os'), 'path'), 'join'), [Name('output_dir'), BinOp(Name('base'), Add(), Attribute(Name('self'), 'res_extension'))], [], None, None)], [], None, None))], [If(Compare(Name('ext'), [In()], [Attribute(Name('self'), '_mc_extensions')]), [Expr(Call(Attribute(Name('obj_names'), 'append'), [Call(Attribute(Attribute(Name('os'), 'path'), 'join'), [Name('output_dir'), BinOp(Name('base'), Add(), Attribute(Name('self'), 'res_extension'))], [], None, None)], [], None, None))], [Expr(Call(Attribute(Name('obj_names'), 'append'), [Call(Attribute(Attribute(Name('os'), 'path'), 'join'), [Name('output_dir'), BinOp(Name('base'), Add(), Attribute(Name('self'), 'obj_extension'))], [], None, None)], [], None, None))])])
1 |
443 444 445 446 447 448 449 450 451 |
if ext in self._rc_extensions:
obj_names.append (os.path.join (output_dir,
base + self.res_extension))
elif ext in self._mc_extensions:
obj_names.append (os.path.join (output_dir,
base + self.res_extension))
else:
obj_names.append (os.path.join (output_dir,
base + self.obj_extension))
|
2 |
328 329 330 331 332 333 334 335 336 |
if ext in self._rc_extensions:
obj_names.append (os.path.join (output_dir,
base + self.res_extension))
elif ext in self._mc_extensions:
obj_names.append (os.path.join (output_dir,
base + self.res_extension))
else:
obj_names.append (os.path.join (output_dir,
base + self.obj_extension))
|
If(Compare(Call(Name('len'), [Name('rargs')], [], None, None), [Lt()], [Name('nargs')]), [If(Compare(Name('nargs'), [Eq()], [Num(1)]), [Expr(Call(Attribute(Name('self'), 'error'), [BinOp(Call(Name('_'), [Str('%s option requires an argument')], [], None, None), Mod(), Name('opt'))], [], None, None))], [Expr(Call(Attribute(Name('self'), 'error'), [BinOp(Call(Name('_'), [Str('%s option requires %d arguments')], [], None, None), Mod(), Tuple([Name('opt'), Name('nargs')]))], [], None, None))])], [If(Compare(Name('nargs'), [Eq()], [Num(1)]), [Assign([Name('value')], Call(Attribute(Name('rargs'), 'pop'), [Num(0)], [], None, None))], [Assign([Name('value')], Call(Name('tuple'), [Subscript(Name('rargs'), Slice(Num(0), Name('nargs'), None))], [], None, None)), Delete([Subscript(Name('rargs'), Slice(Num(0), Name('nargs'), None), Del())])])])
1 |
1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 |
if len(rargs) < nargs:
if nargs == 1:
self.error(_("%s option requires an argument") % opt)
else:
self.error(_("%s option requires %d arguments")
% (opt, nargs))
elif nargs == 1:
value = rargs.pop(0)
else:
value = tuple(rargs[0:nargs])
del rargs[0:nargs]
|
2 |
1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 |
if len(rargs) < nargs:
if nargs == 1:
self.error(_("%s option requires an argument") % opt)
else:
self.error(_("%s option requires %d arguments")
% (opt, nargs))
elif nargs == 1:
value = rargs.pop(0)
else:
value = tuple(rargs[0:nargs])
del rargs[0:nargs]
|
If(Num(1), [Assign([Name('macrelease')], Name('macver')), TryExcept([Assign([Name('f')], Call(Name('open'), [Str('/System/Library/CoreServices/SystemVersion.plist')], [], None, None))], [ExceptHandler(Name('IOError'), None, [Pass()])], [TryFinally([Assign([Name('m')], Call(Attribute(Name('re'), 'search'), [BinOp(Str('<key>ProductUserVisibleVersion</key>\\s*'), Add(), Str('<string>(.*?)</string>')), Call(Attribute(Name('f'), 'read'), [], [], None, None)], [], None, None)), If(Compare(Name('m'), [IsNot()], [Name('None')]), [Assign([Name('macrelease')], Call(Attribute(Str('.'), 'join'), [Subscript(Call(Attribute(Call(Attribute(Name('m'), 'group'), [Num(1)], [], None, None), 'split'), [Str('.')], [], None, None), Slice(None, Num(2), None))], [], None, None))], [])], [Expr(Call(Attribute(Name('f'), 'close'), [], [], None, None))])])], [])
1 |
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
if 1:
# Always calculate the release of the running machine,
# needed to determine if we can build fat binaries or not.
macrelease = macver
# Get the system version. Reading this plist is a documented
# way to get the system version (see the documentation for
# the Gestalt Manager)
try:
f = open('/System/Library/CoreServices/SystemVersion.plist')
except IOError:
# We're on a plain darwin box, fall back to the default
# behaviour.
pass
else:
try:
m = re.search(
r'<key>ProductUserVisibleVersion</key>\s*' +
r'<string>(.*?)</string>', f.read())
if m is not None:
macrelease = '.'.join(m.group(1).split('.')[:2])
# else: fall back to the default behaviour
finally:
f.close()
|
2 |
689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 |
if 1:
# Always calculate the release of the running machine,
# needed to determine if we can build fat binaries or not.
macrelease = macver
# Get the system version. Reading this plist is a documented
# way to get the system version (see the documentation for
# the Gestalt Manager)
try:
f = open('/System/Library/CoreServices/SystemVersion.plist')
except IOError:
# We're on a plain darwin box, fall back to the default
# behaviour.
pass
else:
try:
m = re.search(
r'<key>ProductUserVisibleVersion</key>\s*' +
r'<string>(.*?)</string>', f.read())
if m is not None:
macrelease = '.'.join(m.group(1).split('.')[:2])
# else: fall back to the default behaviour
finally:
f.close()
|
If(Call(Attribute(Attribute(Name('self'), 'distribution'), 'has_ext_modules'), [], [], None, None), [Assign([Name('target_version')], Attribute(Name('self'), 'target_version')), If(UnaryOp(Not(), Name('target_version')), [Assert(Attribute(Name('self'), 'skip_build'), Str('Should have already checked this')), Assign([Name('target_version')], Subscript(Attribute(Name('sys'), 'version'), Slice(Num(0), Num(3), None)))], []), Assign([Name('plat_specifier')], BinOp(Str('.%s-%s'), Mod(), Tuple([Attribute(Name('self'), 'plat_name'), Name('target_version')]))), Assign([Name('build')], Call(Attribute(Name('self'), 'get_finalized_command'), [Str('build')], [], None, None)), Assign([Attribute(Name('build'), 'build_lib')], Call(Attribute(Attribute(Name('os'), 'path'), 'join'), [Attribute(Name('build'), 'build_base'), BinOp(Str('lib'), Add(), Name('plat_specifier'))], [], None, None))], [])
1 |
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 |
if self.distribution.has_ext_modules():
# If we are building an installer for a Python version other
# than the one we are currently running, then we need to ensure
# our build_lib reflects the other Python version rather than ours.
# Note that for target_version!=sys.version, we must have skipped the
# build step, so there is no issue with enforcing the build of this
# version.
target_version = self.target_version
if not target_version:
assert self.skip_build, "Should have already checked this"
target_version = sys.version[0:3]
plat_specifier = ".%s-%s" % (self.plat_name, target_version)
build = self.get_finalized_command('build')
build.build_lib = os.path.join(build.build_base,
'lib' + plat_specifier)
|
2 |
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
if self.distribution.has_ext_modules():
# If we are building an installer for a Python version other
# than the one we are currently running, then we need to ensure
# our build_lib reflects the other Python version rather than ours.
# Note that for target_version!=sys.version, we must have skipped the
# build step, so there is no issue with enforcing the build of this
# version.
target_version = self.target_version
if not target_version:
assert self.skip_build, "Should have already checked this"
target_version = sys.version[0:3]
plat_specifier = ".%s-%s" % (self.plat_name, target_version)
build = self.get_finalized_command('build')
build.build_lib = os.path.join(build.build_base,
'lib' + plat_specifier)
|
If(Compare(Name('n'), [In()], [Attribute(Name('os'), 'environ')]), [Assign([Name('item')], Subscript(Attribute(Name('os'), 'environ'), Index(Name('n'))))], [If(Compare(Name('n'), [In()], [Name('renamed_variables')]), [If(BoolOp(And(), [Call(Attribute(Name('name'), 'startswith'), [Str('PY_')], [], None, None), Compare(Subscript(Name('name'), Slice(Num(3), None, None)), [In()], [Name('renamed_variables')])]), [Assign([Name('item')], Str(''))], [If(Compare(BinOp(Str('PY_'), Add(), Name('n')), [In()], [Name('notdone')]), [Assign([Name('found')], Name('False'))], [Assign([Name('item')], Call(Name('str'), [Subscript(Name('done'), Index(BinOp(Str('PY_'), Add(), Name('n'))))], [], None, None))])])], [Assign([Subscript(Name('done'), Index(Name('n'))), Name('item')], Str(''))])])
1 |
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 |
elif n in os.environ:
# do it like make: fall back to environment
item = os.environ[n]
elif n in renamed_variables:
if name.startswith('PY_') and name[3:] in renamed_variables:
item = ""
elif 'PY_' + n in notdone:
found = False
else:
item = str(done['PY_' + n])
else:
done[n] = item = ""
|
2 |
285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 |
elif n in os.environ:
# do it like make: fall back to environment
item = os.environ[n]
elif n in renamed_variables:
if name.startswith('PY_') and name[3:] in renamed_variables:
item = ""
elif 'PY_' + n in notdone:
found = False
else:
item = str(done['PY_' + n])
else:
done[n] = item = ""
|
TryExcept([If(Attribute(Name('self'), '_locked'), [Assign([Name('f')], Call(Name('open'), [Call(Attribute(Attribute(Name('os'), 'path'), 'join'), [Attribute(Name('self'), '_path'), Call(Name('str'), [Name('key')], [], None, None)], [], None, None), Str('rb+')], [], None, None))], [Assign([Name('f')], Call(Name('open'), [Call(Attribute(Attribute(Name('os'), 'path'), 'join'), [Attribute(Name('self'), '_path'), Call(Name('str'), [Name('key')], [], None, None)], [], None, None), Str('rb')], [], None, None))])], [ExceptHandler(Name('IOError'), 'e', [If(Compare(Attribute(Name('e'), 'errno'), [Eq()], [Attribute(Name('errno'), 'ENOENT')]), [Raise(Call(Name('KeyError'), [BinOp(Str('No message with key: %s'), Mod(), Name('key'))], [], None, None), None)], [Raise(None, None)])])], [])
1 |
980 981 982 983 984 985 986 987 988 989 |
try:
if self._locked:
f = open(os.path.join(self._path, str(key)), 'rb+')
else:
f = open(os.path.join(self._path, str(key)), 'rb')
except IOError as e:
if e.errno == errno.ENOENT:
raise KeyError('No message with key: %s' % key)
else:
raise
|
2 |
1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 |
try:
if self._locked:
f = open(os.path.join(self._path, str(key)), 'rb+')
else:
f = open(os.path.join(self._path, str(key)), 'rb')
except IOError as e:
if e.errno == errno.ENOENT:
raise KeyError('No message with key: %s' % key)
else:
raise
|
If(Compare(Name('archs'), [Eq()], [Tuple([Str('i386'), Str('x86_64')])]), [Assign([Name('machine')], Str('intel'))], [If(Compare(Name('archs'), [Eq()], [Tuple([Str('i386'), Str('ppc'), Str('x86_64')])]), [Assign([Name('machine')], Str('fat3'))], [If(Compare(Name('archs'), [Eq()], [Tuple([Str('ppc64'), Str('x86_64')])]), [Assign([Name('machine')], Str('fat64'))], [If(Compare(Name('archs'), [Eq()], [Tuple([Str('i386'), Str('ppc'), Str('ppc64'), Str('x86_64')])]), [Assign([Name('machine')], Str('universal'))], [Raise(Call(Name('ValueError'), [BinOp(Str("Don't know machine value for archs=%r"), Mod(), Tuple([Name('archs')]))], [], None, None), None)])])])])
1 |
159 160 161 162 163 164 165 166 167 168 169 |
elif archs == ('i386', 'x86_64'):
machine = 'intel'
elif archs == ('i386', 'ppc', 'x86_64'):
machine = 'fat3'
elif archs == ('ppc64', 'x86_64'):
machine = 'fat64'
elif archs == ('i386', 'ppc', 'ppc64', 'x86_64'):
machine = 'universal'
else:
raise ValueError(
"Don't know machine value for archs=%r"%(archs,))
|
2 |
739 740 741 742 743 744 745 746 747 748 749 |
elif archs == ('i386', 'x86_64'):
machine = 'intel'
elif archs == ('i386', 'ppc', 'x86_64'):
machine = 'fat3'
elif archs == ('ppc64', 'x86_64'):
machine = 'fat64'
elif archs == ('i386', 'ppc', 'ppc64', 'x86_64'):
machine = 'universal'
else:
raise ValueError(
"Don't know machine value for archs=%r"%(archs,))
|
While(Num(1), [Assign([Name('line')], Call(Attribute(Name('fp'), 'readline'), [], [], None, None)), If(Compare(Attribute(Name('self'), 'debugging'), [Gt()], [Num(2)]), [Expr(Call(Name('print'), [Str('*retr*'), Call(Name('repr'), [Name('line')], [], None, None)], [], None, None))], []), If(UnaryOp(Not(), Name('line')), [Break()], []), If(Compare(Subscript(Name('line'), Slice(UnaryOp(USub(), Num(2)), None, None)), [Eq()], [Name('CRLF')]), [Assign([Name('line')], Subscript(Name('line'), Slice(None, UnaryOp(USub(), Num(2)), None)))], [If(Compare(Subscript(Name('line'), Slice(UnaryOp(USub(), Num(1)), None, None)), [Eq()], [Str('\n')]), [Assign([Name('line')], Subscript(Name('line'), Slice(None, UnaryOp(USub(), Num(1)), None)))], [])]), Expr(Call(Name('callback'), [Name('line')], [], None, None))], [])
1 |
441 442 443 444 445 446 447 448 449 450 |
while 1:
line = fp.readline()
if self.debugging > 2: print('*retr*', repr(line))
if not line:
break
if line[-2:] == CRLF:
line = line[:-2]
elif line[-1:] == '\n':
line = line[:-1]
callback(line)
|
2 |
738 739 740 741 742 743 744 745 746 747 |
while 1:
line = fp.readline()
if self.debugging > 2: print('*retr*', repr(line))
if not line:
break
if line[-2:] == CRLF:
line = line[:-2]
elif line[-1:] == '\n':
line = line[:-1]
callback(line)
|
FunctionDef('__repr__', arguments([arg('self', None)], None, None, [], None, None, [], []), [Assign([Name('items')], Call(Name('list'), [Call(Attribute(Attribute(Name('self'), '__dict__'), 'items'), [], [], None, None)], [], None, None)), Assign([Name('temp')], List([])), For(Tuple([Name('name'), Name('value')]), Name('items'), [If(UnaryOp(Not(), Call(Attribute(Name('name'), 'startswith'), [Str('_')], [], None, None)), [Expr(Call(Attribute(Name('temp'), 'append'), [BinOp(Str('%s=%r'), Mod(), Tuple([Name('name'), Name('value')]))], [], None, None))], [])], []), Expr(Call(Attribute(Name('temp'), 'sort'), [], [], None, None)), Return(BinOp(Str('Namespace(%s)'), Mod(), Call(Attribute(Name('str'), 'join'), [Str(', '), Name('temp')], [], None, None)))], [], None)
1 |
119 120 121 122 123 124 125 126 |
def __repr__(self):
items = list(self.__dict__.items())
temp = []
for name, value in items:
if not name.startswith('_'):
temp.append('%s=%r' % (name, value))
temp.sort()
return 'Namespace(%s)' % str.join(', ', temp)
|
2 |
941 942 943 944 945 946 947 948 |
def __repr__(self):
items = list(self.__dict__.items())
temp = []
for name, value in items:
if not name.startswith('_'):
temp.append('%s=%r' % (name, value))
temp.sort()
return 'Namespace(%s)' % str.join(', ', temp)
|
FunctionDef('_get_normal_name', arguments([arg('orig_enc', None)], None, None, [], None, None, [], []), [Expr(Str('Imitates get_normal_name in tokenizer.c.')), Assign([Name('enc')], Call(Attribute(Call(Attribute(Subscript(Name('orig_enc'), Slice(None, Num(12), None)), 'lower'), [], [], None, None), 'replace'), [Str('_'), Str('-')], [], None, None)), If(BoolOp(Or(), [Compare(Name('enc'), [Eq()], [Str('utf-8')]), Call(Attribute(Name('enc'), 'startswith'), [Str('utf-8-')], [], None, None)]), [Return(Str('utf-8'))], []), If(BoolOp(Or(), [Compare(Name('enc'), [In()], [Tuple([Str('latin-1'), Str('iso-8859-1'), Str('iso-latin-1')])]), Call(Attribute(Name('enc'), 'startswith'), [Tuple([Str('latin-1-'), Str('iso-8859-1-'), Str('iso-latin-1-')])], [], None, None)]), [Return(Str('iso-8859-1'))], []), Return(Name('orig_enc'))], [], None)
1 |
241 242 243 244 245 246 247 248 249 250 |
def _get_normal_name(orig_enc):
"""Imitates get_normal_name in tokenizer.c."""
# Only care about the first 12 characters.
enc = orig_enc[:12].lower().replace("_", "-")
if enc == "utf-8" or enc.startswith("utf-8-"):
return "utf-8"
if enc in ("latin-1", "iso-8859-1", "iso-latin-1") or \
enc.startswith(("latin-1-", "iso-8859-1-", "iso-latin-1-")):
return "iso-8859-1"
return orig_enc
|
2 |
256 257 258 259 260 261 262 263 264 265 |
def _get_normal_name(orig_enc):
"""Imitates get_normal_name in tokenizer.c."""
# Only care about the first 12 characters.
enc = orig_enc[:12].lower().replace("_", "-")
if enc == "utf-8" or enc.startswith("utf-8-"):
return "utf-8"
if enc in ("latin-1", "iso-8859-1", "iso-latin-1") or \
enc.startswith(("latin-1-", "iso-8859-1-", "iso-latin-1-")):
return "iso-8859-1"
return orig_enc
|
TryExcept([Assign([Name('f')], Call(Name('open'), [Str('/System/Library/CoreServices/SystemVersion.plist')], [], None, None))], [ExceptHandler(Name('IOError'), None, [Pass()])], [TryFinally([Assign([Name('m')], Call(Attribute(Name('re'), 'search'), [BinOp(Str('<key>ProductUserVisibleVersion</key>\\s*'), Add(), Str('<string>(.*?)</string>')), Call(Attribute(Name('f'), 'read'), [], [], None, None)], [], None, None)), If(Compare(Name('m'), [IsNot()], [Name('None')]), [Assign([Name('macrelease')], Call(Attribute(Str('.'), 'join'), [Subscript(Call(Attribute(Call(Attribute(Name('m'), 'group'), [Num(1)], [], None, None), 'split'), [Str('.')], [], None, None), Slice(None, Num(2), None))], [], None, None))], [])], [Expr(Call(Attribute(Name('f'), 'close'), [], [], None, None))])])
1 |
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
try:
f = open('/System/Library/CoreServices/SystemVersion.plist')
except IOError:
# We're on a plain darwin box, fall back to the default
# behaviour.
pass
else:
try:
m = re.search(
r'<key>ProductUserVisibleVersion</key>\s*' +
r'<string>(.*?)</string>', f.read())
if m is not None:
macrelease = '.'.join(m.group(1).split('.')[:2])
# else: fall back to the default behaviour
finally:
f.close()
|
2 |
697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 |
try:
f = open('/System/Library/CoreServices/SystemVersion.plist')
except IOError:
# We're on a plain darwin box, fall back to the default
# behaviour.
pass
else:
try:
m = re.search(
r'<key>ProductUserVisibleVersion</key>\s*' +
r'<string>(.*?)</string>', f.read())
if m is not None:
macrelease = '.'.join(m.group(1).split('.')[:2])
# else: fall back to the default behaviour
finally:
f.close()
|
FunctionDef('find_library_file', arguments([arg('self', None), arg('dirs', None), arg('lib', None), arg('debug', None)], None, None, [], None, None, [Num(0)], []), [If(Name('debug'), [Assign([Name('try_names')], List([BinOp(Name('lib'), Add(), Str('_d')), Name('lib')]))], [Assign([Name('try_names')], List([Name('lib')]))]), For(Name('dir'), Name('dirs'), [For(Name('name'), Name('try_names'), [Assign([Name('libfile')], Call(Attribute(Attribute(Name('os'), 'path'), 'join'), [Name('dir'), Call(Attribute(Name('self'), 'library_filename'), [Name('name')], [], None, None)], [], None, None)), If(Call(Attribute(Attribute(Name('os'), 'path'), 'exists'), [Name('libfile')], [], None, None), [Return(Name('libfile'))], [])], [])], [Return(Name('None'))])], [], None)
1 |
750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 |
def find_library_file(self, dirs, lib, debug=0):
# Prefer a debugging library if found (and requested), but deal
# with it if we don't have one.
if debug:
try_names = [lib + "_d", lib]
else:
try_names = [lib]
for dir in dirs:
for name in try_names:
libfile = os.path.join(dir, self.library_filename (name))
if os.path.exists(libfile):
return libfile
else:
# Oops, didn't find it in *any* of 'dirs'
return None
|
2 |
544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 |
def find_library_file(self, dirs, lib, debug=0):
# Prefer a debugging library if found (and requested), but deal
# with it if we don't have one.
if debug:
try_names = [lib + "_d", lib]
else:
try_names = [lib]
for dir in dirs:
for name in try_names:
libfile = os.path.join(dir, self.library_filename (name))
if os.path.exists(libfile):
return libfile
else:
# Oops, didn't find it in *any* of 'dirs'
return None
|
While(Num(1), [Assign([Name('buf')], Call(Attribute(Name('fp'), 'readline'), [], [], None, None)), If(UnaryOp(Not(), Name('buf')), [Break()], []), If(Compare(Subscript(Name('buf'), Slice(UnaryOp(USub(), Num(2)), None, None)), [NotEq()], [Name('B_CRLF')]), [If(Compare(Subscript(Name('buf'), Index(UnaryOp(USub(), Num(1)))), [In()], [Name('B_CRLF')]), [Assign([Name('buf')], Subscript(Name('buf'), Slice(None, UnaryOp(USub(), Num(1)), None)))], []), Assign([Name('buf')], BinOp(Name('buf'), Add(), Name('B_CRLF')))], []), Expr(Call(Attribute(Name('conn'), 'sendall'), [Name('buf')], [], None, None)), If(Name('callback'), [Expr(Call(Name('callback'), [Name('buf')], [], None, None))], [])], [])
1 |
491 492 493 494 495 496 497 498 |
while 1:
buf = fp.readline()
if not buf: break
if buf[-2:] != B_CRLF:
if buf[-1] in B_CRLF: buf = buf[:-1]
buf = buf + B_CRLF
conn.sendall(buf)
if callback: callback(buf)
|
2 |
776 777 778 779 780 781 782 783 |
while 1:
buf = fp.readline()
if not buf: break
if buf[-2:] != B_CRLF:
if buf[-1] in B_CRLF: buf = buf[:-1]
buf = buf + B_CRLF
conn.sendall(buf)
if callback: callback(buf)
|
If(Compare(Name('toknum'), [Eq()], [Name('INDENT')]), [Expr(Call(Attribute(Name('indents'), 'append'), [Name('tokval')], [], None, None)), Continue()], [If(Compare(Name('toknum'), [Eq()], [Name('DEDENT')]), [Expr(Call(Attribute(Name('indents'), 'pop'), [], [], None, None)), Continue()], [If(Compare(Name('toknum'), [In()], [Tuple([Name('NEWLINE'), Name('NL')])]), [Assign([Name('startline')], Name('True'))], [If(BoolOp(And(), [Name('startline'), Name('indents')]), [Expr(Call(Name('toks_append'), [Subscript(Name('indents'), Index(UnaryOp(USub(), Num(1))))], [], None, None)), Assign([Name('startline')], Name('False'))], [])])])])
1 |
226 227 228 229 230 231 232 233 234 235 236 |
if toknum == INDENT:
indents.append(tokval)
continue
elif toknum == DEDENT:
indents.pop()
continue
elif toknum in (NEWLINE, NL):
startline = True
elif startline and indents:
toks_append(indents[-1])
startline = False
|
2 |
215 216 217 218 219 220 221 222 223 224 225 |
if toknum == INDENT:
indents.append(tokval)
continue
elif toknum == DEDENT:
indents.pop()
continue
elif toknum in (NEWLINE, NL):
startline = True
elif startline and indents:
toks_append(indents[-1])
startline = False
|
If(Call(Attribute(Name('self'), '_need_link'), [Name('objects'), Name('output_filename')], [], None, None), [Assign([Name('lib_args')], BinOp(Name('objects'), Add(), List([BinOp(Str('/OUT:'), Add(), Name('output_filename'))]))), If(Name('debug'), [Pass()], []), TryExcept([Expr(Call(Attribute(Name('self'), 'spawn'), [BinOp(List([Attribute(Name('self'), 'lib')]), Add(), Name('lib_args'))], [], None, None))], [ExceptHandler(Name('DistutilsExecError'), 'msg', [Raise(Call(Name('LibError'), [Name('msg')], [], None, None), None)])], [])], [Expr(Call(Attribute(Name('log'), 'debug'), [Str('skipping %s (up-to-date)'), Name('output_filename')], [], None, None))])
1 |
553 554 555 556 557 558 559 560 561 562 |
if self._need_link(objects, output_filename):
lib_args = objects + ['/OUT:' + output_filename]
if debug:
pass # XXX what goes here?
try:
self.spawn([self.lib] + lib_args)
except DistutilsExecError as msg:
raise LibError(msg)
else:
log.debug("skipping %s (up-to-date)", output_filename)
|
2 |
438 439 440 441 442 443 444 445 446 447 |
if self._need_link(objects, output_filename):
lib_args = objects + ['/OUT:' + output_filename]
if debug:
pass # XXX what goes here?
try:
self.spawn([self.lib] + lib_args)
except DistutilsExecError as msg:
raise LibError(msg)
else:
log.debug("skipping %s (up-to-date)", output_filename)
|
Expr(Call(Attribute(Name('self'), 'geometry'), [BinOp(Str('+%d+%d'), Mod(), Tuple([BinOp(Call(Attribute(Name('parent'), 'winfo_rootx'), [], [], None, None), Add(), BinOp(BinOp(Call(Attribute(Name('parent'), 'winfo_width'), [], [], None, None), Div(), Num(2)), Sub(), BinOp(Call(Attribute(Name('self'), 'winfo_reqwidth'), [], [], None, None), Div(), Num(2)))), BinOp(Call(Attribute(Name('parent'), 'winfo_rooty'), [], [], None, None), Add(), BinOp(BinOp(Call(Attribute(Name('parent'), 'winfo_height'), [], [], None, None), Div(), Num(2)), Sub(), BinOp(Call(Attribute(Name('self'), 'winfo_reqheight'), [], [], None, None), Div(), Num(2))))]))], [], None, None))
1 |
35 36 37 38 39 |
self.geometry("+%d+%d" %
((parent.winfo_rootx() + ((parent.winfo_width()/2)
-(self.winfo_reqwidth()/2)),
parent.winfo_rooty() + ((parent.winfo_height()/2)
-(self.winfo_reqheight()/2)))))
|
2 |
30 31 32 33 34 |
self.geometry("+%d+%d" %
((parent.winfo_rootx()+((parent.winfo_width()/2)
-(self.winfo_reqwidth()/2)),
parent.winfo_rooty()+((parent.winfo_height()/2)
-(self.winfo_reqheight()/2)) )) ) #centre dialog over parent
|
3 |
41 42 43 44 45 |
self.geometry("+%d+%d" %
((parent.winfo_rootx()+((parent.winfo_width()/2)
-(self.winfo_reqwidth()/2)),
parent.winfo_rooty()+((parent.winfo_height()/2)
-(self.winfo_reqheight()/2)) )) ) #centre dialog over parent
|
If(Compare(Name('archs'), [Eq()], [Tuple([Str('i386'), Str('ppc'), Str('x86_64')])]), [Assign([Name('machine')], Str('fat3'))], [If(Compare(Name('archs'), [Eq()], [Tuple([Str('ppc64'), Str('x86_64')])]), [Assign([Name('machine')], Str('fat64'))], [If(Compare(Name('archs'), [Eq()], [Tuple([Str('i386'), Str('ppc'), Str('ppc64'), Str('x86_64')])]), [Assign([Name('machine')], Str('universal'))], [Raise(Call(Name('ValueError'), [BinOp(Str("Don't know machine value for archs=%r"), Mod(), Tuple([Name('archs')]))], [], None, None), None)])])])
1 |
161 162 163 164 165 166 167 168 169 |
elif archs == ('i386', 'ppc', 'x86_64'):
machine = 'fat3'
elif archs == ('ppc64', 'x86_64'):
machine = 'fat64'
elif archs == ('i386', 'ppc', 'ppc64', 'x86_64'):
machine = 'universal'
else:
raise ValueError(
"Don't know machine value for archs=%r"%(archs,))
|
2 |
741 742 743 744 745 746 747 748 749 |
elif archs == ('i386', 'ppc', 'x86_64'):
machine = 'fat3'
elif archs == ('ppc64', 'x86_64'):
machine = 'fat64'
elif archs == ('i386', 'ppc', 'ppc64', 'x86_64'):
machine = 'universal'
else:
raise ValueError(
"Don't know machine value for archs=%r"%(archs,))
|
If(Compare(Name('n'), [In()], [Name('renamed_variables')]), [If(BoolOp(And(), [Call(Attribute(Name('name'), 'startswith'), [Str('PY_')], [], None, None), Compare(Subscript(Name('name'), Slice(Num(3), None, None)), [In()], [Name('renamed_variables')])]), [Assign([Name('item')], Str(''))], [If(Compare(BinOp(Str('PY_'), Add(), Name('n')), [In()], [Name('notdone')]), [Assign([Name('found')], Name('False'))], [Assign([Name('item')], Call(Name('str'), [Subscript(Name('done'), Index(BinOp(Str('PY_'), Add(), Name('n'))))], [], None, None))])])], [Assign([Subscript(Name('done'), Index(Name('n'))), Name('item')], Str(''))])
1 |
355 356 357 358 359 360 361 362 363 364 365 |
elif n in renamed_variables:
if name.startswith('PY_') and name[3:] in renamed_variables:
item = ""
elif 'PY_' + n in notdone:
found = False
else:
item = str(done['PY_' + n])
else:
done[n] = item = ""
|
2 |
289 290 291 292 293 294 295 296 297 298 299 300 |
elif n in renamed_variables:
if name.startswith('PY_') and name[3:] in renamed_variables:
item = ""
elif 'PY_' + n in notdone:
found = False
else:
item = str(done['PY_' + n])
else:
done[n] = item = ""
|
FunctionDef('spilldescriptors', arguments([arg('msg', None), arg('attrs', None), arg('predicate', None)], None, None, [], None, None, [], []), [Assign([Tuple([Name('ok'), Name('attrs')])], Call(Name('_split_list'), [Name('attrs'), Name('predicate')], [], None, None)), If(Name('ok'), [Expr(Call(Attribute(Name('hr'), 'maybe'), [], [], None, None)), Expr(Call(Name('push'), [Name('msg')], [], None, None)), For(Tuple([Name('name'), Name('kind'), Name('homecls'), Name('value')]), Name('ok'), [Expr(Call(Name('push'), [Call(Attribute(Name('self'), '_docdescriptor'), [Name('name'), Name('value'), Name('mod')], [], None, None)], [], None, None))], [])], []), Return(Name('attrs'))], [], None)
1 |
773 774 775 776 777 778 779 780 |
def spilldescriptors(msg, attrs, predicate):
ok, attrs = _split_list(attrs, predicate)
if ok:
hr.maybe()
push(msg)
for name, kind, homecls, value in ok:
push(self._docdescriptor(name, value, mod))
return attrs
|
2 |
1210 1211 1212 1213 1214 1215 1216 1217 |
def spilldescriptors(msg, attrs, predicate):
ok, attrs = _split_list(attrs, predicate)
if ok:
hr.maybe()
push(msg)
for name, kind, homecls, value in ok:
push(self._docdescriptor(name, value, mod))
return attrs
|
If(BoolOp(Or(), [Name('sn'), Name('on')]), [If(BoolOp(And(), [Compare(Name('on'), [Eq()], [Num(1)]), Compare(Name('sn'), [Eq()], [Num(0)])]), [Return(Call(Attribute(Name('self'), '_fix'), [Name('context')], [], None, None))], []), If(BoolOp(And(), [Compare(Name('sn'), [Eq()], [Num(1)]), Compare(Name('on'), [Eq()], [Num(0)])]), [Return(Call(Attribute(Name('other'), '_fix'), [Name('context')], [], None, None))], []), Return(Call(Attribute(Name('self'), '_check_nans'), [Name('other'), Name('context')], [], None, None))], [])
1 |
2759 2760 2761 2762 2763 2764 |
if sn or on:
if on == 1 and sn == 0:
return self._fix(context)
if sn == 1 and on == 0:
return other._fix(context)
return self._check_nans(other, context)
|
2 |
2801 2802 2803 2804 2805 2806 |
if sn or on:
if on == 1 and sn == 0:
return self._fix(context)
if sn == 1 and on == 0:
return other._fix(context)
return self._check_nans(other, context)
|
3 |
3377 3378 3379 3380 3381 3382 |
if sn or on:
if on == 1 and sn == 0:
return self._fix(context)
if sn == 1 and on == 0:
return other._fix(context)
return self._check_nans(other, context)
|
4 |
3407 3408 3409 3410 3411 3412 |
if sn or on:
if on == 1 and sn == 0:
return self._fix(context)
if sn == 1 and on == 0:
return other._fix(context)
return self._check_nans(other, context)
|
Call(Attribute(Name('self'), 'geometry'), [BinOp(Str('+%d+%d'), Mod(), Tuple([BinOp(Call(Attribute(Name('parent'), 'winfo_rootx'), [], [], None, None), Add(), BinOp(BinOp(Call(Attribute(Name('parent'), 'winfo_width'), [], [], None, None), Div(), Num(2)), Sub(), BinOp(Call(Attribute(Name('self'), 'winfo_reqwidth'), [], [], None, None), Div(), Num(2)))), BinOp(Call(Attribute(Name('parent'), 'winfo_rooty'), [], [], None, None), Add(), BinOp(BinOp(Call(Attribute(Name('parent'), 'winfo_height'), [], [], None, None), Div(), Num(2)), Sub(), BinOp(Call(Attribute(Name('self'), 'winfo_reqheight'), [], [], None, None), Div(), Num(2))))]))], [], None, None)
1 |
35 36 37 38 39 |
self.geometry("+%d+%d" %
((parent.winfo_rootx() + ((parent.winfo_width()/2)
-(self.winfo_reqwidth()/2)),
parent.winfo_rooty() + ((parent.winfo_height()/2)
-(self.winfo_reqheight()/2)))))
|
2 |
30 31 32 33 34 |
self.geometry("+%d+%d" %
((parent.winfo_rootx()+((parent.winfo_width()/2)
-(self.winfo_reqwidth()/2)),
parent.winfo_rooty()+((parent.winfo_height()/2)
-(self.winfo_reqheight()/2)) )) ) #centre dialog over parent
|
3 |
41 42 43 44 45 |
self.geometry("+%d+%d" %
((parent.winfo_rootx()+((parent.winfo_width()/2)
-(self.winfo_reqwidth()/2)),
parent.winfo_rooty()+((parent.winfo_height()/2)
-(self.winfo_reqheight()/2)) )) ) #centre dialog over parent
|
For(Tuple([Name('name'), Name('category')]), Call(Attribute(Name('categories'), 'items'), [], [], None, None), [Expr(Call(Name('print'), [Name('name'), Str('...')], [], None, None)), Assign([Tuple([Name('lang'), Name('enc')])], Call(Name('getlocale'), [Name('category')], [], None, None)), Expr(Call(Name('print'), [Str(' Language: '), BoolOp(Or(), [Name('lang'), Str('(undefined)')])], [], None, None)), Expr(Call(Name('print'), [Str(' Encoding: '), BoolOp(Or(), [Name('enc'), Str('(undefined)')])], [], None, None)), Expr(Call(Name('print'), [], [], None, None))], [])
1 |
1840 1841 1842 1843 1844 1845 |
for name,category in categories.items():
print(name, '...')
lang, enc = getlocale(category)
print(' Language: ', lang or '(undefined)')
print(' Encoding: ', enc or '(undefined)')
print()
|
2 |
1851 1852 1853 1854 1855 1856 |
for name,category in categories.items():
print(name, '...')
lang, enc = getlocale(category)
print(' Language: ', lang or '(undefined)')
print(' Encoding: ', enc or '(undefined)')
print()
|
3 |
1868 1869 1870 1871 1872 1873 |
for name,category in categories.items():
print(name, '...')
lang, enc = getlocale(category)
print(' Language: ', lang or '(undefined)')
print(' Encoding: ', enc or '(undefined)')
print()
|
If(BoolOp(And(), [Call(Attribute(Name('request'), 'is_unverifiable'), [], [], None, None), Call(Name('is_third_party'), [Name('request')], [], None, None)]), [If(BoolOp(And(), [Compare(Attribute(Name('cookie'), 'version'), [Gt()], [Num(0)]), Attribute(Name('self'), 'strict_rfc2965_unverifiable')]), [Expr(Call(Name('_debug'), [Str(' third-party RFC 2965 cookie during unverifiable transaction')], [], None, None)), Return(Name('False'))], [If(BoolOp(And(), [Compare(Attribute(Name('cookie'), 'version'), [Eq()], [Num(0)]), Attribute(Name('self'), 'strict_ns_unverifiable')]), [Expr(Call(Name('_debug'), [Str(' third-party Netscape cookie during unverifiable transaction')], [], None, None)), Return(Name('False'))], [])])], [])
1 |
952 953 954 955 956 957 958 959 960 |
if request.is_unverifiable() and is_third_party(request):
if cookie.version > 0 and self.strict_rfc2965_unverifiable:
_debug(" third-party RFC 2965 cookie during "
"unverifiable transaction")
return False
elif cookie.version == 0 and self.strict_ns_unverifiable:
_debug(" third-party Netscape cookie during "
"unverifiable transaction")
return False
|
2 |
1091 1092 1093 1094 1095 1096 1097 1098 1099 |
if request.is_unverifiable() and is_third_party(request):
if cookie.version > 0 and self.strict_rfc2965_unverifiable:
_debug(" third-party RFC 2965 cookie during unverifiable "
"transaction")
return False
elif cookie.version == 0 and self.strict_ns_unverifiable:
_debug(" third-party Netscape cookie during unverifiable "
"transaction")
return False
|
If(Compare(Name('op'), [Is()], [Name('LITERAL')]), [Assign([Subscript(Name('charmap'), Index(Call(Name('fixup'), [Name('av')], [], None, None)))], Num(1))], [If(Compare(Name('op'), [Is()], [Name('RANGE')]), [For(Name('i'), Call(Name('range'), [Call(Name('fixup'), [Subscript(Name('av'), Index(Num(0)))], [], None, None), BinOp(Call(Name('fixup'), [Subscript(Name('av'), Index(Num(1)))], [], None, None), Add(), Num(1))], [], None, None), [Assign([Subscript(Name('charmap'), Index(Name('i')))], Num(1))], [])], [If(Compare(Name('op'), [Is()], [Name('CATEGORY')]), [Return(Name('charset'))], [])])])
1 |
216 217 218 219 220 221 222 223 |
elif op is LITERAL:
charmap[fixup(av)] = 1
elif op is RANGE:
for i in range(fixup(av[0]), fixup(av[1])+1):
charmap[i] = 1
elif op is CATEGORY:
# XXX: could append to charmap tail
return charset # cannot compress
|
2 |
312 313 314 315 316 317 318 319 |
elif op is LITERAL:
charmap[fixup(av)] = 1
elif op is RANGE:
for i in range(fixup(av[0]), fixup(av[1])+1):
charmap[i] = 1
elif op is CATEGORY:
# XXX: could expand category
return charset # cannot compress
|
If(Compare(Subscript(Name('release'), Index(Num(0))), [GtE()], [Str('5')]), [Assign([Name('osname')], Str('solaris')), Assign([Name('release')], BinOp(Str('%d.%s'), Mod(), Tuple([BinOp(Call(Name('int'), [Subscript(Name('release'), Index(Num(0)))], [], None, None), Sub(), Num(3)), Subscript(Name('release'), Slice(Num(2), None, None))]))), Assign([Name('bitness')], Dict([Num(2147483647), Num(9223372036854775807)], [Str('32bit'), Str('64bit')])), AugAssign(Name('machine'), Add(), BinOp(Str('.%s'), Mod(), Subscript(Name('bitness'), Index(Attribute(Name('sys'), 'maxsize')))))], [])
1 |
77 78 79 80 81 82 83 84 |
if release[0] >= "5": # SunOS 5 == Solaris 2
osname = "solaris"
release = "%d.%s" % (int(release[0]) - 3, release[2:])
# We can't use "platform.architecture()[0]" because a
# bootstrap problem. We use a dict to get an error
# if some suspicious happens.
bitness = {2147483647:"32bit", 9223372036854775807:"64bit"}
machine += ".%s" % bitness[sys.maxsize]
|
2 |
659 660 661 662 663 664 665 666 |
if release[0] >= "5": # SunOS 5 == Solaris 2
osname = "solaris"
release = "%d.%s" % (int(release[0]) - 3, release[2:])
# We can't use "platform.architecture()[0]" because a
# bootstrap problem. We use a dict to get an error
# if some suspicious happens.
bitness = {2147483647:"32bit", 9223372036854775807:"64bit"}
machine += ".%s" % bitness[sys.maxsize]
|
If(Compare(Subscript(Name('text'), Slice(Name('end'), BinOp(Name('end'), Add(), Num(1)), None)), [Eq()], [Str('(')]), [Expr(Call(Attribute(Name('results'), 'append'), [Call(Attribute(Name('self'), 'namelink'), [Name('name'), Name('methods'), Name('funcs'), Name('classes')], [], None, None)], [], None, None))], [If(Name('selfdot'), [Expr(Call(Attribute(Name('results'), 'append'), [BinOp(Str('self.<strong>%s</strong>'), Mod(), Name('name'))], [], None, None))], [Expr(Call(Attribute(Name('results'), 'append'), [Call(Attribute(Name('self'), 'namelink'), [Name('name'), Name('classes')], [], None, None)], [], None, None))])])
1 |
570 571 572 573 574 575 |
elif text[end:end+1] == '(':
results.append(self.namelink(name, methods, funcs, classes))
elif selfdot:
results.append('self.<strong>%s</strong>' % name)
else:
results.append(self.namelink(name, classes))
|
2 |
734 735 736 737 738 739 |
elif text[end:end+1] == '(':
results.append(self.namelink(name, methods, funcs, classes))
elif selfdot:
results.append('self.<strong>%s</strong>' % name)
else:
results.append(self.namelink(name, classes))
|
BinOp(Str('+%d+%d'), Mod(), Tuple([BinOp(Call(Attribute(Name('parent'), 'winfo_rootx'), [], [], None, None), Add(), BinOp(BinOp(Call(Attribute(Name('parent'), 'winfo_width'), [], [], None, None), Div(), Num(2)), Sub(), BinOp(Call(Attribute(Name('self'), 'winfo_reqwidth'), [], [], None, None), Div(), Num(2)))), BinOp(Call(Attribute(Name('parent'), 'winfo_rooty'), [], [], None, None), Add(), BinOp(BinOp(Call(Attribute(Name('parent'), 'winfo_height'), [], [], None, None), Div(), Num(2)), Sub(), BinOp(Call(Attribute(Name('self'), 'winfo_reqheight'), [], [], None, None), Div(), Num(2))))]))
1 |
35 36 37 38 39 |
self.geometry("+%d+%d" %
((parent.winfo_rootx() + ((parent.winfo_width()/2)
-(self.winfo_reqwidth()/2)),
parent.winfo_rooty() + ((parent.winfo_height()/2)
-(self.winfo_reqheight()/2)))))
|
2 |
30 31 32 33 34 |
self.geometry("+%d+%d" %
((parent.winfo_rootx()+((parent.winfo_width()/2)
-(self.winfo_reqwidth()/2)),
parent.winfo_rooty()+((parent.winfo_height()/2)
-(self.winfo_reqheight()/2)) )) ) #centre dialog over parent
|
3 |
41 42 43 44 45 |
self.geometry("+%d+%d" %
((parent.winfo_rootx()+((parent.winfo_width()/2)
-(self.winfo_reqwidth()/2)),
parent.winfo_rooty()+((parent.winfo_height()/2)
-(self.winfo_reqheight()/2)) )) ) #centre dialog over parent
|
For(Name('i'), Call(Name('range'), [Num(0), Call(Name('len'), [Name('words')], [], None, None), Num(2)], [], None, None), [Assign([Name('key')], Subscript(Subscript(Name('words'), Index(Name('i'))), Slice(Num(1), None, None))), Assign([Name('value')], Subscript(Name('words'), Index(BinOp(Name('i'), Add(), Num(1))))), If(Compare(Subscript(Name('value'), Slice(None, Num(1), None)), [Eq()], [Str('.')]), [Assign([Name('value')], Call(Attribute(Name('self'), '_nametowidget'), [Name('value')], [], None, None))], []), Assign([Subscript(Name('dict'), Index(Name('key')))], Name('value'))], [])
1 |
1807 1808 1809 1810 1811 1812 |
for i in range(0, len(words), 2):
key = words[i][1:]
value = words[i+1]
if value[:1] == '.':
value = self._nametowidget(value)
dict[key] = value
|
2 |
1858 1859 1860 1861 1862 1863 |
for i in range(0, len(words), 2):
key = words[i][1:]
value = words[i+1]
if value[:1] == '.':
value = self._nametowidget(value)
dict[key] = value
|
3 |
1907 1908 1909 1910 1911 1912 |
for i in range(0, len(words), 2):
key = words[i][1:]
value = words[i+1]
if value[:1] == '.':
value = self._nametowidget(value)
dict[key] = value
|
TryFinally([Assign([Name('m')], Call(Attribute(Name('re'), 'search'), [BinOp(Str('<key>ProductUserVisibleVersion</key>\\s*'), Add(), Str('<string>(.*?)</string>')), Call(Attribute(Name('f'), 'read'), [], [], None, None)], [], None, None)), If(Compare(Name('m'), [IsNot()], [Name('None')]), [Assign([Name('macrelease')], Call(Attribute(Str('.'), 'join'), [Subscript(Call(Attribute(Call(Attribute(Name('m'), 'group'), [Num(1)], [], None, None), 'split'), [Str('.')], [], None, None), Slice(None, Num(2), None))], [], None, None))], [])], [Expr(Call(Attribute(Name('f'), 'close'), [], [], None, None))])
1 |
123 124 125 126 127 128 129 130 131 |
try:
m = re.search(
r'<key>ProductUserVisibleVersion</key>\s*' +
r'<string>(.*?)</string>', f.read())
if m is not None:
macrelease = '.'.join(m.group(1).split('.')[:2])
# else: fall back to the default behaviour
finally:
f.close()
|
2 |
704 705 706 707 708 709 710 711 712 |
try:
m = re.search(
r'<key>ProductUserVisibleVersion</key>\s*' +
r'<string>(.*?)</string>', f.read())
if m is not None:
macrelease = '.'.join(m.group(1).split('.')[:2])
# else: fall back to the default behaviour
finally:
f.close()
|
FunctionDef('__init__', arguments([arg('self', None), arg('master', None), arg('name', None), arg('destroy_physically', None)], None, None, [], None, None, [Num(1)], []), [Expr(Call(Attribute(Name('TixSubWidget'), '__init__'), [Name('self'), Name('master'), Name('name'), Name('destroy_physically')], [], None, None)), Assign([Subscript(Attribute(Name('self'), 'subwidget_list'), Index(Str('hlist')))], Call(Name('_dummyHList'), [Name('self'), Str('hlist')], [], None, None)), Assign([Subscript(Attribute(Name('self'), 'subwidget_list'), Index(Str('vsb')))], Call(Name('_dummyScrollbar'), [Name('self'), Str('vsb')], [], None, None)), Assign([Subscript(Attribute(Name('self'), 'subwidget_list'), Index(Str('hsb')))], Call(Name('_dummyScrollbar'), [Name('self'), Str('hsb')], [], None, None))], [], None)
1 |
1674 1675 1676 1677 1678 |
def __init__(self, master, name, destroy_physically=1):
TixSubWidget.__init__(self, master, name, destroy_physically)
self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
|
2 |
1702 1703 1704 1705 1706 |
def __init__(self, master, name, destroy_physically=1):
TixSubWidget.__init__(self, master, name, destroy_physically)
self.subwidget_list['hlist'] = _dummyHList(self, 'hlist')
self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb')
self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb')
|
If(Compare(Subscript(Name('url'), Slice(None, Num(2), None)), [Eq()], [Str('//')]), [Assign([Tuple([Name('netloc'), Name('url')])], Call(Name('_splitnetloc'), [Name('url'), Num(2)], [], None, None)), If(BoolOp(Or(), [BoolOp(And(), [Compare(Str('['), [In()], [Name('netloc')]), Compare(Str(']'), [NotIn()], [Name('netloc')])]), BoolOp(And(), [Compare(Str(']'), [In()], [Name('netloc')]), Compare(Str('['), [NotIn()], [Name('netloc')])])]), [Raise(Call(Name('ValueError'), [Str('Invalid IPv6 URL')], [], None, None), None)], [])], [])
1 |
332 333 334 335 336 |
if url[:2] == '//':
netloc, url = _splitnetloc(url, 2)
if (('[' in netloc and ']' not in netloc) or
(']' in netloc and '[' not in netloc)):
raise ValueError("Invalid IPv6 URL")
|
2 |
355 356 357 358 359 |
if url[:2] == '//':
netloc, url = _splitnetloc(url, 2)
if (('[' in netloc and ']' not in netloc) or
(']' in netloc and '[' not in netloc)):
raise ValueError("Invalid IPv6 URL")
|
FunctionDef('abspath', arguments([arg('path', None)], None, None, [], None, None, [], []), [Expr(Str('Return an absolute path.')), If(UnaryOp(Not(), Call(Name('isabs'), [Name('path')], [], None, None)), [If(Call(Name('isinstance'), [Name('path'), Name('bytes')], [], None, None), [Assign([Name('cwd')], Call(Attribute(Name('os'), 'getcwdb'), [], [], None, None))], [Assign([Name('cwd')], Call(Attribute(Name('os'), 'getcwd'), [], [], None, None))]), Assign([Name('path')], Call(Name('join'), [Name('cwd'), Name('path')], [], None, None))], []), Return(Call(Name('normpath'), [Name('path')], [], None, None))], [], None)
1 |
175 176 177 178 179 180 181 182 183 |
def abspath(path):
"""Return an absolute path."""
if not isabs(path):
if isinstance(path, bytes):
cwd = os.getcwdb()
else:
cwd = os.getcwd()
path = join(cwd, path)
return normpath(path)
|
2 |
367 368 369 370 371 372 373 374 375 |
def abspath(path):
"""Return an absolute path."""
if not isabs(path):
if isinstance(path, bytes):
cwd = os.getcwdb()
else:
cwd = os.getcwd()
path = join(cwd, path)
return normpath(path)
|
TryExcept([If(Subscript(Attribute(Name('sys'), 'argv'), Slice(Num(1), None, None)), [Expr(Call(Name('testall'), [Subscript(Attribute(Name('sys'), 'argv'), Slice(Num(1), None, None)), Name('recursive'), Num(1)], [], None, None))], [Expr(Call(Name('testall'), [List([Str('.')]), Name('recursive'), Num(1)], [], None, None))])], [ExceptHandler(Name('KeyboardInterrupt'), None, [Expr(Call(Attribute(Attribute(Name('sys'), 'stderr'), 'write'), [Str('\n[Interrupted]\n')], [], None, None)), Expr(Call(Attribute(Name('sys'), 'exit'), [Num(1)], [], None, None))])], [])
1 |
125 126 127 128 129 130 131 132 |
try:
if sys.argv[1:]:
testall(sys.argv[1:], recursive, 1)
else:
testall(['.'], recursive, 1)
except KeyboardInterrupt:
sys.stderr.write('\n[Interrupted]\n')
sys.exit(1)
|
2 |
206 207 208 209 210 211 212 213 |
try:
if sys.argv[1:]:
testall(sys.argv[1:], recursive, 1)
else:
testall(['.'], recursive, 1)
except KeyboardInterrupt:
sys.stderr.write('\n[Interrupted]\n')
sys.exit(1)
|
If(Call(Name('hasattr'), [Call(Name('type'), [Name('x')], [], None, None), Str('__name__')], [], None, None), [Assign([Name('methodname')], BinOp(Str('repr_'), Add(), Call(Attribute(Str('_'), 'join'), [Call(Attribute(Attribute(Call(Name('type'), [Name('x')], [], None, None), '__name__'), 'split'), [], [], None, None)], [], None, None))), If(Call(Name('hasattr'), [Name('self'), Name('methodname')], [], None, None), [Return(Call(Call(Name('getattr'), [Name('self'), Name('methodname')], [], None, None), [Name('x'), Name('level')], [], None, None))], [])], [])
1 |
402 403 404 405 |
if hasattr(type(x), '__name__'):
methodname = 'repr_' + '_'.join(type(x).__name__.split())
if hasattr(self, methodname):
return getattr(self, methodname)(x, level)
|
2 |
988 989 990 991 |
if hasattr(type(x), '__name__'):
methodname = 'repr_' + '_'.join(type(x).__name__.split())
if hasattr(self, methodname):
return getattr(self, methodname)(x, level)
|
If(Compare(Name('fn'), [In()], [Name('timings')]), [Assign([Tuple([Name('cc'), Name('ns'), Name('tt'), Name('ct'), Name('callers')])], Subscript(Name('timings'), Index(Name('fn')))), Assign([Subscript(Name('timings'), Index(Name('fn')))], Tuple([Name('cc'), BinOp(Name('ns'), Add(), Num(1)), Name('tt'), Name('ct'), Name('callers')]))], [Assign([Subscript(Name('timings'), Index(Name('fn')))], Tuple([Num(0), Num(0), Num(0), Num(0), Dict([], [])]))])
1 |
287 288 289 290 291 |
if fn in timings:
cc, ns, tt, ct, callers = timings[fn]
timings[fn] = cc, ns + 1, tt, ct, callers
else:
timings[fn] = 0, 0, 0, 0, {}
|
2 |
298 299 300 301 302 |
if fn in timings:
cc, ns, tt, ct, callers = timings[fn]
timings[fn] = cc, ns+1, tt, ct, callers
else:
timings[fn] = 0, 0, 0, 0, {}
|
Tuple([BinOp(Call(Attribute(Name('parent'), 'winfo_rootx'), [], [], None, None), Add(), BinOp(BinOp(Call(Attribute(Name('parent'), 'winfo_width'), [], [], None, None), Div(), Num(2)), Sub(), BinOp(Call(Attribute(Name('self'), 'winfo_reqwidth'), [], [], None, None), Div(), Num(2)))), BinOp(Call(Attribute(Name('parent'), 'winfo_rooty'), [], [], None, None), Add(), BinOp(BinOp(Call(Attribute(Name('parent'), 'winfo_height'), [], [], None, None), Div(), Num(2)), Sub(), BinOp(Call(Attribute(Name('self'), 'winfo_reqheight'), [], [], None, None), Div(), Num(2))))])
1 |
36 37 38 39 |
((parent.winfo_rootx() + ((parent.winfo_width()/2)
-(self.winfo_reqwidth()/2)),
parent.winfo_rooty() + ((parent.winfo_height()/2)
-(self.winfo_reqheight()/2)))))
|
2 |
31 32 33 34 |
((parent.winfo_rootx()+((parent.winfo_width()/2)
-(self.winfo_reqwidth()/2)),
parent.winfo_rooty()+((parent.winfo_height()/2)
-(self.winfo_reqheight()/2)) )) ) #centre dialog over parent
|
3 |
42 43 44 45 |
((parent.winfo_rootx()+((parent.winfo_width()/2)
-(self.winfo_reqwidth()/2)),
parent.winfo_rooty()+((parent.winfo_height()/2)
-(self.winfo_reqheight()/2)) )) ) #centre dialog over parent
|
If(Compare(Name('ext'), [In()], [Attribute(Name('self'), '_mc_extensions')]), [Expr(Call(Attribute(Name('obj_names'), 'append'), [Call(Attribute(Attribute(Name('os'), 'path'), 'join'), [Name('output_dir'), BinOp(Name('base'), Add(), Attribute(Name('self'), 'res_extension'))], [], None, None)], [], None, None))], [Expr(Call(Attribute(Name('obj_names'), 'append'), [Call(Attribute(Attribute(Name('os'), 'path'), 'join'), [Name('output_dir'), BinOp(Name('base'), Add(), Attribute(Name('self'), 'obj_extension'))], [], None, None)], [], None, None))])
1 |
446 447 448 449 450 451 |
elif ext in self._mc_extensions:
obj_names.append (os.path.join (output_dir,
base + self.res_extension))
else:
obj_names.append (os.path.join (output_dir,
base + self.obj_extension))
|
2 |
331 332 333 334 335 336 |
elif ext in self._mc_extensions:
obj_names.append (os.path.join (output_dir,
base + self.res_extension))
else:
obj_names.append (os.path.join (output_dir,
base + self.obj_extension))
|
For(Name('attr'), Name('attrs'), [Assign([Tuple([Name('attr'), Name('value')])], Call(Name('splitvalue'), [Name('attr')], [], None, None)), If(BoolOp(And(), [Compare(Call(Attribute(Name('attr'), 'lower'), [], [], None, None), [Eq()], [Str('type')]), Compare(Name('value'), [In()], [Tuple([Str('a'), Str('A'), Str('i'), Str('I'), Str('d'), Str('D')])])]), [Assign([Name('type')], Call(Attribute(Name('value'), 'upper'), [], [], None, None))], [])], [])
1 |
1345 1346 1347 1348 1349 |
for attr in attrs:
attr, value = splitvalue(attr)
if attr.lower() == 'type' and \
value in ('a', 'A', 'i', 'I', 'd', 'D'):
type = value.upper()
|
2 |
1831 1832 1833 1834 1835 |
for attr in attrs:
attr, value = splitvalue(attr)
if attr.lower() == 'type' and \
value in ('a', 'A', 'i', 'I', 'd', 'D'):
type = value.upper()
|
FunctionDef('_python_exit', arguments([], None, None, [], None, None, [], []), [Global(['_shutdown']), Assign([Name('_shutdown')], Name('True')), Assign([Name('items')], Call(Name('list'), [Call(Attribute(Name('_threads_queues'), 'items'), [], [], None, None)], [], None, None)), For(Tuple([Name('t'), Name('q')]), Name('items'), [Expr(Call(Attribute(Name('q'), 'put'), [Name('None')], [], None, None))], []), For(Tuple([Name('t'), Name('q')]), Name('items'), [Expr(Call(Attribute(Name('t'), 'join'), [], [], None, None))], [])], [], None)
1 |
72 73 74 75 76 77 78 79 |
def _python_exit():
global _shutdown
_shutdown = True
items = list(_threads_queues.items())
for t, q in items:
q.put(None)
for t, q in items:
t.join()
|
2 |
31 32 33 34 35 36 37 38 |
def _python_exit():
global _shutdown
_shutdown = True
items = list(_threads_queues.items())
for t, q in items:
q.put(None)
for t, q in items:
t.join()
|
If(Attribute(Name('self'), '_locked'), [Assign([Name('f')], Call(Name('open'), [Call(Attribute(Attribute(Name('os'), 'path'), 'join'), [Attribute(Name('self'), '_path'), Call(Name('str'), [Name('key')], [], None, None)], [], None, None), Str('rb+')], [], None, None))], [Assign([Name('f')], Call(Name('open'), [Call(Attribute(Attribute(Name('os'), 'path'), 'join'), [Attribute(Name('self'), '_path'), Call(Name('str'), [Name('key')], [], None, None)], [], None, None), Str('rb')], [], None, None))])
1 |
981 982 983 984 |
if self._locked:
f = open(os.path.join(self._path, str(key)), 'rb+')
else:
f = open(os.path.join(self._path, str(key)), 'rb')
|
2 |
1008 1009 1010 1011 |
if self._locked:
f = open(os.path.join(self._path, str(key)), 'rb+')
else:
f = open(os.path.join(self._path, str(key)), 'rb')
|
FunctionDef('eventfun', arguments([arg('event', None)], None, None, [], None, None, [], []), [Assign([Tuple([Name('x'), Name('y')])], Tuple([BinOp(Call(Attribute(Attribute(Name('self'), 'cv'), 'canvasx'), [Attribute(Name('event'), 'x')], [], None, None), Div(), Attribute(Name('self'), 'xscale')), BinOp(UnaryOp(USub(), Call(Attribute(Attribute(Name('self'), 'cv'), 'canvasy'), [Attribute(Name('event'), 'y')], [], None, None)), Div(), Attribute(Name('self'), 'yscale'))])), Expr(Call(Name('fun'), [Name('x'), Name('y')], [], None, None))], [], None)
1 |
614 615 616 617 |
def eventfun(event):
x, y = (self.cv.canvasx(event.x)/self.xscale,
-self.cv.canvasy(event.y)/self.yscale)
fun(x, y)
|
2 |
632 633 634 635 |
def eventfun(event):
x, y = (self.cv.canvasx(event.x)/self.xscale,
-self.cv.canvasy(event.y)/self.yscale)
fun(x, y)
|
3 |
672 673 674 675 |
def eventfun(event):
x, y = (self.cv.canvasx(event.x)/self.xscale,
-self.cv.canvasy(event.y)/self.yscale)
fun(x, y)
|
FunctionDef('type_repr', arguments([arg('type_num', None)], None, None, [], None, None, [], []), [Global(['_type_reprs']), If(UnaryOp(Not(), Name('_type_reprs')), [ImportFrom('pygram', [alias('python_symbols', None)], 1), For(Tuple([Name('name'), Name('val')]), Call(Attribute(Attribute(Name('python_symbols'), '__dict__'), 'items'), [], [], None, None), [If(Compare(Call(Name('type'), [Name('val')], [], None, None), [Eq()], [Name('int')]), [Assign([Subscript(Name('_type_reprs'), Index(Name('val')))], Name('name'))], [])], [])], []), Return(Call(Attribute(Name('_type_reprs'), 'setdefault'), [Name('type_num'), Name('type_num')], [], None, None))], [], None)
1 |
160 161 162 163 164 165 166 167 168 |
def type_repr(type_num):
global _type_reprs
if not _type_reprs:
from .pygram import python_symbols
# printing tokens is possible but not as useful
# from .pgen2 import token // token.__dict__.items():
for name, val in python_symbols.__dict__.items():
if type(val) == int: _type_reprs[val] = name
return _type_reprs.setdefault(type_num, type_num)
|
2 |
22 23 24 25 26 27 28 29 30 |
def type_repr(type_num):
global _type_reprs
if not _type_reprs:
from .pygram import python_symbols
# printing tokens is possible but not as useful
# from .pgen2 import token // token.__dict__.items():
for name, val in python_symbols.__dict__.items():
if type(val) == int: _type_reprs[val] = name
return _type_reprs.setdefault(type_num, type_num)
|
If(Call(Name('isinstance'), [Name('value'), Tuple([Name('list'), Name('tuple')])], [], None, None), [Assign([Name('chunks')], Call(Name('_iterencode_list'), [Name('value'), Name('_current_indent_level')], [], None, None))], [If(Call(Name('isinstance'), [Name('value'), Name('dict')], [], None, None), [Assign([Name('chunks')], Call(Name('_iterencode_dict'), [Name('value'), Name('_current_indent_level')], [], None, None))], [Assign([Name('chunks')], Call(Name('_iterencode'), [Name('value'), Name('_current_indent_level')], [], None, None))])])
1 |
303 304 305 306 307 308 |
if isinstance(value, (list, tuple)):
chunks = _iterencode_list(value, _current_indent_level)
elif isinstance(value, dict):
chunks = _iterencode_dict(value, _current_indent_level)
else:
chunks = _iterencode(value, _current_indent_level)
|
2 |
379 380 381 382 383 384 |
if isinstance(value, (list, tuple)):
chunks = _iterencode_list(value, _current_indent_level)
elif isinstance(value, dict):
chunks = _iterencode_dict(value, _current_indent_level)
else:
chunks = _iterencode(value, _current_indent_level)
|
If(BoolOp(Or(), [Name('recursive'), Name('toplevel')]), [Expr(Call(Name('print'), [Str('recursing down:')], [], None, None)), Import([alias('glob', None)]), Assign([Name('names')], Call(Attribute(Name('glob'), 'glob'), [Call(Attribute(Attribute(Name('os'), 'path'), 'join'), [Name('filename'), Str('*')], [], None, None)], [], None, None)), Expr(Call(Name('testall'), [Name('names'), Name('recursive'), Num(0)], [], None, None))], [Expr(Call(Name('print'), [Str('*** directory (use -r) ***')], [], None, None))])
1 |
140 141 142 143 144 145 146 |
if recursive or toplevel:
print('recursing down:')
import glob
names = glob.glob(os.path.join(filename, '*'))
testall(names, recursive, 0)
else:
print('*** directory (use -r) ***')
|
2 |
221 222 223 224 225 226 227 |
if recursive or toplevel:
print('recursing down:')
import glob
names = glob.glob(os.path.join(filename, '*'))
testall(names, recursive, 0)
else:
print('*** directory (use -r) ***')
|
FunctionDef('getparams', arguments([arg('self', None)], None, None, [], None, None, [], []), [If(BoolOp(Or(), [UnaryOp(Not(), Attribute(Name('self'), '_nchannels')), UnaryOp(Not(), Attribute(Name('self'), '_sampwidth')), UnaryOp(Not(), Attribute(Name('self'), '_framerate'))]), [Raise(Call(Name('Error'), [Str('not all parameters set')], [], None, None), None)], []), Return(Tuple([Attribute(Name('self'), '_nchannels'), Attribute(Name('self'), '_sampwidth'), Attribute(Name('self'), '_framerate'), Attribute(Name('self'), '_nframes'), Attribute(Name('self'), '_comptype'), Attribute(Name('self'), '_compname')]))], [], None)
1 |
646 647 648 649 650 |
def getparams(self):
if not self._nchannels or not self._sampwidth or not self._framerate:
raise Error('not all parameters set')
return self._nchannels, self._sampwidth, self._framerate, \
self._nframes, self._comptype, self._compname
|
2 |
398 399 400 401 402 |
def getparams(self):
if not self._nchannels or not self._sampwidth or not self._framerate:
raise Error('not all parameters set')
return self._nchannels, self._sampwidth, self._framerate, \
self._nframes, self._comptype, self._compname
|
If(Compare(Name('toknum'), [Eq()], [Name('DEDENT')]), [Expr(Call(Attribute(Name('indents'), 'pop'), [], [], None, None)), Continue()], [If(Compare(Name('toknum'), [In()], [Tuple([Name('NEWLINE'), Name('NL')])]), [Assign([Name('startline')], Name('True'))], [If(BoolOp(And(), [Name('startline'), Name('indents')]), [Expr(Call(Name('toks_append'), [Subscript(Name('indents'), Index(UnaryOp(USub(), Num(1))))], [], None, None)), Assign([Name('startline')], Name('False'))], [])])])
1 |
229 230 231 232 233 234 235 236 |
elif toknum == DEDENT:
indents.pop()
continue
elif toknum in (NEWLINE, NL):
startline = True
elif startline and indents:
toks_append(indents[-1])
startline = False
|
2 |
218 219 220 221 222 223 224 225 |
elif toknum == DEDENT:
indents.pop()
continue
elif toknum in (NEWLINE, NL):
startline = True
elif startline and indents:
toks_append(indents[-1])
startline = False
|
If(BoolOp(And(), [Compare(Attribute(Name('cookie'), 'version'), [Gt()], [Num(0)]), UnaryOp(Not(), Attribute(Name('self'), 'rfc2965'))]), [Expr(Call(Name('_debug'), [Str(' RFC 2965 cookies are switched off')], [], None, None)), Return(Name('False'))], [If(BoolOp(And(), [Compare(Attribute(Name('cookie'), 'version'), [Eq()], [Num(0)]), UnaryOp(Not(), Attribute(Name('self'), 'netscape'))]), [Expr(Call(Name('_debug'), [Str(' Netscape cookies are switched off')], [], None, None)), Return(Name('False'))], [])])
1 |
943 944 945 946 947 948 |
if cookie.version > 0 and not self.rfc2965:
_debug(" RFC 2965 cookies are switched off")
return False
elif cookie.version == 0 and not self.netscape:
_debug(" Netscape cookies are switched off")
return False
|
2 |
1082 1083 1084 1085 1086 1087 |
if cookie.version > 0 and not self.rfc2965:
_debug(" RFC 2965 cookies are switched off")
return False
elif cookie.version == 0 and not self.netscape:
_debug(" Netscape cookies are switched off")
return False
|
FunctionDef('pages', arguments([arg('self', None)], None, None, [], None, None, [], []), [Assign([Name('names')], Call(Attribute(Attribute(Name('self'), 'tk'), 'split'), [Call(Attribute(Attribute(Name('self'), 'tk'), 'call'), [Attribute(Name('self'), '_w'), Str('pages')], [], None, None)], [], None, None)), Assign([Name('ret')], List([])), For(Name('x'), Name('names'), [Expr(Call(Attribute(Name('ret'), 'append'), [Call(Attribute(Name('self'), 'subwidget'), [Name('x')], [], None, None)], [], None, None))], []), Return(Name('ret'))], [], None)
1 |
1131 1132 1133 1134 1135 1136 1137 |
def pages(self):
# Can't call subwidgets_all directly because we don't want .nbframe
names = self.tk.split(self.tk.call(self._w, 'pages'))
ret = []
for x in names:
ret.append(self.subwidget(x))
return ret
|
2 |
1177 1178 1179 1180 1181 1182 1183 |
def pages(self):
# Can't call subwidgets_all directly because we don't want .nbframe
names = self.tk.split(self.tk.call(self._w, 'pages'))
ret = []
for x in names:
ret.append(self.subwidget(x))
return ret
|
If(Compare(Call(Name('len'), [Name('pair')], [], None, None), [Eq()], [Num(1)]), [Assign([Name('pair')], Tuple([Name('None'), Name('name')]))], [If(Compare(Call(Name('len'), [Name('pair')], [], None, None), [Eq()], [Num(3)]), [Assign([Name('pair')], Tuple([Subscript(Name('pair'), Index(Num(0))), Subscript(Name('pair'), Index(Num(1)))]))], [Assign([Name('pair')], Call(Name('tuple'), [Name('pair')], [], None, None))])])
1 |
311 312 313 314 315 316 317 318 |
if len(pair) == 1:
# no namespace
pair = (None, name)
elif len(pair) == 3:
pair = pair[0], pair[1]
else:
# default namespace
pair = tuple(pair)
|
2 |
345 346 347 348 349 350 |
if len(pair) == 1:
pair = (None, name)
elif len(pair) == 3:
pair = pair[0], pair[1]
else:
pair = tuple(pair)
|
While(BoolOp(And(), [Compare(Name('end'), [Gt()], [Num(0)]), BinOp(BinOp(Call(Attribute(Name('s'), 'count'), [Str('"'), Num(0), Name('end')], [], None, None), Sub(), Call(Attribute(Name('s'), 'count'), [Str('\\"'), Num(0), Name('end')], [], None, None)), Mod(), Num(2))]), [Assign([Name('end')], Call(Attribute(Name('s'), 'find'), [Str(';'), BinOp(Name('end'), Add(), Num(1))], [], None, None))], [])
1 |
294 295 |
while end > 0 and (s.count('"', 0, end) - s.count('\\"', 0, end)) % 2:
end = s.find(';', end + 1)
|
2 |
99 100 |
while end > 0 and (s.count('"', 0, end) - s.count('\\"', 0, end)) % 2:
end = s.find(';', end + 1)
|
If(BoolOp(And(), [Compare(Attribute(Name('cookie'), 'version'), [Gt()], [Num(0)]), Attribute(Name('self'), 'strict_rfc2965_unverifiable')]), [Expr(Call(Name('_debug'), [Str(' third-party RFC 2965 cookie during unverifiable transaction')], [], None, None)), Return(Name('False'))], [If(BoolOp(And(), [Compare(Attribute(Name('cookie'), 'version'), [Eq()], [Num(0)]), Attribute(Name('self'), 'strict_ns_unverifiable')]), [Expr(Call(Name('_debug'), [Str(' third-party Netscape cookie during unverifiable transaction')], [], None, None)), Return(Name('False'))], [])])
1 |
953 954 955 956 957 958 959 960 |
if cookie.version > 0 and self.strict_rfc2965_unverifiable:
_debug(" third-party RFC 2965 cookie during "
"unverifiable transaction")
return False
elif cookie.version == 0 and self.strict_ns_unverifiable:
_debug(" third-party Netscape cookie during "
"unverifiable transaction")
return False
|
2 |
1092 1093 1094 1095 1096 1097 1098 1099 |
if cookie.version > 0 and self.strict_rfc2965_unverifiable:
_debug(" third-party RFC 2965 cookie during unverifiable "
"transaction")
return False
elif cookie.version == 0 and self.strict_ns_unverifiable:
_debug(" third-party Netscape cookie during unverifiable "
"transaction")
return False
|
If(Name('namespaces'), [For(Tuple([Name('v'), Name('k')]), Call(Name('sorted'), [Call(Attribute(Name('namespaces'), 'items'), [], [], None, None)], [keyword('key', Lambda(arguments([arg('x', None)], None, None, [], None, None, [], []), Subscript(Name('x'), Index(Num(1)))))], None, None), [If(Name('k'), [Assign([Name('k')], BinOp(Str(':'), Add(), Name('k')))], []), Expr(Call(Name('write'), [BinOp(Str(' xmlns%s="%s"'), Mod(), Tuple([Name('k'), Call(Name('_escape_attrib'), [Name('v')], [], None, None)]))], [], None, None))], [])], [])
1 |
956 957 958 959 960 961 962 963 |
if namespaces:
for v, k in sorted(namespaces.items(),
key=lambda x: x[1]): # sort on prefix
if k:
k = ":" + k
write(" xmlns%s=\"%s\"" % (
k,
_escape_attrib(v)
|
2 |
1011 1012 1013 1014 1015 1016 1017 1018 |
if namespaces:
for v, k in sorted(namespaces.items(),
key=lambda x: x[1]): # sort on prefix
if k:
k = ":" + k
write(" xmlns%s=\"%s\"" % (
k,
_escape_attrib(v)
|
For(Name('p'), Subscript(Name('av'), Index(Num(1))), [If(UnaryOp(Not(), Name('p')), [Break()], []), Assign([Tuple([Name('op'), Name('av')])], Subscript(Name('p'), Index(Num(0)))), If(Compare(Name('op'), [Is()], [Name('LITERAL')]), [Expr(Call(Name('cappend'), [Tuple([Name('op'), Name('av')])], [], None, None))], [Break()])], [Assign([Name('charset')], Name('c'))])
1 |
400 401 402 403 404 405 406 407 408 409 |
for p in av[1]:
if not p:
break
op, av = p[0]
if op is LITERAL:
cappend((op, av))
else:
break
else:
charset = c
|
2 |
413 414 415 416 417 418 419 420 421 422 |
for p in av[1]:
if not p:
break
op, av = p[0]
if op is LITERAL:
cappend((op, av))
else:
break
else:
charset = c
|
If(Compare(Str('$'), [In()], [Name('tmpv')]), [Assign([Subscript(Name('notdone'), Index(Name('n')))], Name('v'))], [TryExcept([Assign([Name('v')], Call(Name('int'), [Name('v')], [], None, None))], [ExceptHandler(Name('ValueError'), None, [Assign([Subscript(Name('done'), Index(Name('n')))], Call(Attribute(Name('v'), 'replace'), [Str('$$'), Str('$')], [], None, None))])], [Assign([Subscript(Name('done'), Index(Name('n')))], Name('v'))])])
1 |
321 322 323 324 325 326 327 328 329 330 |
if "$" in tmpv:
notdone[n] = v
else:
try:
v = int(v)
except ValueError:
# insert literal `$'
done[n] = v.replace('$$', '$')
else:
done[n] = v
|
2 |
253 254 255 256 257 258 259 260 261 262 |
if "$" in tmpv:
notdone[n] = v
else:
try:
v = int(v)
except ValueError:
# insert literal `$'
done[n] = v.replace('$$', '$')
else:
done[n] = v
|
If(Compare(Name('ext'), [Eq()], [Str('.py')]), [Assign([Tuple([Name('fname'), Name('arcname')])], Call(Attribute(Name('self'), '_get_codename'), [Subscript(Name('path'), Slice(Num(0), UnaryOp(USub(), Num(3)), None)), Name('basename')], [], None, None)), If(Attribute(Name('self'), 'debug'), [Expr(Call(Name('print'), [Str('Adding'), Name('arcname')], [], None, None))], []), Expr(Call(Attribute(Name('self'), 'write'), [Name('fname'), Name('arcname')], [], None, None))], [])
1 |
1355 1356 1357 1358 1359 1360 |
elif ext == ".py":
fname, arcname = self._get_codename(path[0:-3],
basename)
if self.debug:
print("Adding", arcname)
self.write(fname, arcname)
|
2 |
1368 1369 1370 1371 1372 1373 |
if ext == ".py":
fname, arcname = self._get_codename(path[0:-3],
basename)
if self.debug:
print("Adding", arcname)
self.write(fname, arcname)
|
If(BoolOp(And(), [Call(Attribute(Name('name'), 'startswith'), [Str('PY_')], [], None, None), Compare(Subscript(Name('name'), Slice(Num(3), None, None)), [In()], [Name('renamed_variables')])]), [Assign([Name('item')], Str(''))], [If(Compare(BinOp(Str('PY_'), Add(), Name('n')), [In()], [Name('notdone')]), [Assign([Name('found')], Name('False'))], [Assign([Name('item')], Call(Name('str'), [Subscript(Name('done'), Index(BinOp(Str('PY_'), Add(), Name('n'))))], [], None, None))])])
1 |
356 357 358 359 360 361 362 363 |
if name.startswith('PY_') and name[3:] in renamed_variables:
item = ""
elif 'PY_' + n in notdone:
found = False
else:
item = str(done['PY_' + n])
|
2 |
290 291 292 293 294 295 296 297 |
if name.startswith('PY_') and name[3:] in renamed_variables:
item = ""
elif 'PY_' + n in notdone:
found = False
else:
item = str(done['PY_' + n])
|
If(Compare(Name('op'), [Is()], [Name('RANGE')]), [For(Name('i'), Call(Name('range'), [Call(Name('fixup'), [Subscript(Name('av'), Index(Num(0)))], [], None, None), BinOp(Call(Name('fixup'), [Subscript(Name('av'), Index(Num(1)))], [], None, None), Add(), Num(1))], [], None, None), [Assign([Subscript(Name('charmap'), Index(Name('i')))], Num(1))], [])], [If(Compare(Name('op'), [Is()], [Name('CATEGORY')]), [Return(Name('charset'))], [])])
1 |
218 219 220 221 222 223 |
elif op is RANGE:
for i in range(fixup(av[0]), fixup(av[1])+1):
charmap[i] = 1
elif op is CATEGORY:
# XXX: could append to charmap tail
return charset # cannot compress
|
2 |
314 315 316 317 318 319 |
elif op is RANGE:
for i in range(fixup(av[0]), fixup(av[1])+1):
charmap[i] = 1
elif op is CATEGORY:
# XXX: could expand category
return charset # cannot compress
|
If(Call(Name('isinstance'), [Name('file'), Name('str')], [], None, None), [Assign([Name('fp')], Call(Name('open'), [Name('file'), Str('rb')], [], None, None)), TryFinally([Assign([Name('result')], Call(Attribute(Name('builder'), 'parseFile'), [Name('fp')], [], None, None))], [Expr(Call(Attribute(Name('fp'), 'close'), [], [], None, None))])], [Assign([Name('result')], Call(Attribute(Name('builder'), 'parseFile'), [Name('file')], [], None, None))])
1 |
921 922 923 924 925 926 927 928 |
if isinstance(file, str):
fp = open(file, 'rb')
try:
result = builder.parseFile(fp)
finally:
fp.close()
else:
result = builder.parseFile(file)
|
2 |
955 956 957 958 959 960 961 962 |
if isinstance(file, str):
fp = open(file, 'rb')
try:
result = builder.parseFile(fp)
finally:
fp.close()
else:
result = builder.parseFile(file)
|
For(Name('p'), Call(Attribute(Subscript(Attribute(Name('os'), 'environ'), Index(Str('Path'))), 'split'), [Str(';')], [], None, None), [Assign([Name('fn')], Call(Attribute(Attribute(Name('os'), 'path'), 'join'), [Call(Attribute(Attribute(Name('os'), 'path'), 'abspath'), [Name('p')], [], None, None), Name('exe')], [], None, None)), If(Call(Attribute(Attribute(Name('os'), 'path'), 'isfile'), [Name('fn')], [], None, None), [Return(Name('fn'))], [])], [])
1 |
783 784 785 786 |
for p in os.environ['Path'].split(';'):
fn = os.path.join(os.path.abspath(p),exe)
if os.path.isfile(fn):
return fn
|
2 |
577 578 579 580 |
for p in os.environ['Path'].split(';'):
fn = os.path.join(os.path.abspath(p),exe)
if os.path.isfile(fn):
return fn
|
For(Name('dir'), Name('dirs'), [For(Name('name'), Name('try_names'), [Assign([Name('libfile')], Call(Attribute(Attribute(Name('os'), 'path'), 'join'), [Name('dir'), Call(Attribute(Name('self'), 'library_filename'), [Name('name')], [], None, None)], [], None, None)), If(Call(Attribute(Attribute(Name('os'), 'path'), 'exists'), [Name('libfile')], [], None, None), [Return(Name('libfile'))], [])], [])], [Return(Name('None'))])
1 |
324 325 326 327 328 329 330 331 |
for dir in dirs:
for name in try_names:
libfile = os.path.join(dir, self.library_filename(name))
if os.path.exists(libfile):
return libfile
else:
# Oops, didn't find it in *any* of 'dirs'
return None
|
2 |
757 758 759 760 761 762 763 764 |
for dir in dirs:
for name in try_names:
libfile = os.path.join(dir, self.library_filename (name))
if os.path.exists(libfile):
return libfile
else:
# Oops, didn't find it in *any* of 'dirs'
return None
|
3 |
551 552 553 554 555 556 557 558 |
for dir in dirs:
for name in try_names:
libfile = os.path.join(dir, self.library_filename (name))
if os.path.exists(libfile):
return libfile
else:
# Oops, didn't find it in *any* of 'dirs'
return None
|
FunctionDef('normalize_and_reduce_paths', arguments([arg('paths', None)], None, None, [], None, None, [], []), [Expr(Str('Return a list of normalized paths with duplicates removed.\n\n The current order of paths is maintained.\n ')), Assign([Name('reduced_paths')], List([])), For(Name('p'), Name('paths'), [Assign([Name('np')], Call(Attribute(Attribute(Name('os'), 'path'), 'normpath'), [Name('p')], [], None, None)), If(Compare(Name('np'), [NotIn()], [Name('reduced_paths')]), [Expr(Call(Attribute(Name('reduced_paths'), 'append'), [Name('np')], [], None, None))], [])], []), Return(Name('reduced_paths'))], [], None)
1 |
191 192 193 194 195 196 197 198 199 200 201 202 203 |
def normalize_and_reduce_paths(paths):
"""Return a list of normalized paths with duplicates removed.
The current order of paths is maintained.
"""
# Paths are normalized so things like: /a and /a/ aren't both preserved.
reduced_paths = []
for p in paths:
np = os.path.normpath(p)
# XXX(nnorwitz): O(n**2), if reduced_paths gets long perhaps use a set.
if np not in reduced_paths:
reduced_paths.append(np)
return reduced_paths
|
2 |
182 183 184 185 186 187 188 189 190 191 192 193 194 |
def normalize_and_reduce_paths(paths):
"""Return a list of normalized paths with duplicates removed.
The current order of paths is maintained.
"""
# Paths are normalized so things like: /a and /a/ aren't both preserved.
reduced_paths = []
for p in paths:
np = os.path.normpath(p)
# XXX(nnorwitz): O(n**2), if reduced_paths gets long perhaps use a set.
if np not in reduced_paths:
reduced_paths.append(np)
return reduced_paths
|
If(Compare(Name('target_desc'), [Eq()], [Attribute(Name('CCompiler'), 'EXECUTABLE')]), [If(Name('debug'), [Assign([Name('ldflags')], Subscript(Attribute(Name('self'), 'ldflags_shared_debug'), Slice(Num(1), None, None)))], [Assign([Name('ldflags')], Subscript(Attribute(Name('self'), 'ldflags_shared'), Slice(Num(1), None, None)))])], [If(Name('debug'), [Assign([Name('ldflags')], Attribute(Name('self'), 'ldflags_shared_debug'))], [Assign([Name('ldflags')], Attribute(Name('self'), 'ldflags_shared'))])])
1 |
598 599 600 601 602 603 604 605 606 607 |
if target_desc == CCompiler.EXECUTABLE:
if debug:
ldflags = self.ldflags_shared_debug[1:]
else:
ldflags = self.ldflags_shared[1:]
else:
if debug:
ldflags = self.ldflags_shared_debug
else:
ldflags = self.ldflags_shared
|
2 |
483 484 485 486 487 488 489 490 491 492 |
if target_desc == CCompiler.EXECUTABLE:
if debug:
ldflags = self.ldflags_shared_debug[1:]
else:
ldflags = self.ldflags_shared[1:]
else:
if debug:
ldflags = self.ldflags_shared_debug
else:
ldflags = self.ldflags_shared
|
If(Compare(Name('archs'), [Eq()], [Tuple([Str('ppc64'), Str('x86_64')])]), [Assign([Name('machine')], Str('fat64'))], [If(Compare(Name('archs'), [Eq()], [Tuple([Str('i386'), Str('ppc'), Str('ppc64'), Str('x86_64')])]), [Assign([Name('machine')], Str('universal'))], [Raise(Call(Name('ValueError'), [BinOp(Str("Don't know machine value for archs=%r"), Mod(), Tuple([Name('archs')]))], [], None, None), None)])])
1 |
163 164 165 166 167 168 169 |
elif archs == ('ppc64', 'x86_64'):
machine = 'fat64'
elif archs == ('i386', 'ppc', 'ppc64', 'x86_64'):
machine = 'universal'
else:
raise ValueError(
"Don't know machine value for archs=%r"%(archs,))
|
2 |
743 744 745 746 747 748 749 |
elif archs == ('ppc64', 'x86_64'):
machine = 'fat64'
elif archs == ('i386', 'ppc', 'ppc64', 'x86_64'):
machine = 'universal'
else:
raise ValueError(
"Don't know machine value for archs=%r"%(archs,))
|
FunctionDef('add_whitespace', arguments([arg('self', None), arg('start', None)], None, None, [], None, None, [], []), [Assign([Tuple([Name('row'), Name('col')])], Name('start')), Assert(Compare(Name('row'), [LtE()], [Attribute(Name('self'), 'prev_row')]), None), Assign([Name('col_offset')], BinOp(Name('col'), Sub(), Attribute(Name('self'), 'prev_col'))), If(Name('col_offset'), [Expr(Call(Attribute(Attribute(Name('self'), 'tokens'), 'append'), [BinOp(Str(' '), Mult(), Name('col_offset'))], [], None, None))], [])], [], None)
1 |
190 191 192 193 194 195 |
def add_whitespace(self, start):
row, col = start
assert row <= self.prev_row
col_offset = col - self.prev_col
if col_offset:
self.tokens.append(" " * col_offset)
|
2 |
163 164 165 166 167 168 |
def add_whitespace(self, start):
row, col = start
assert row <= self.prev_row
col_offset = col - self.prev_col
if col_offset:
self.tokens.append(" " * col_offset)
|
While(Name('True'), [Assign([Name('line')], Call(Attribute(Attribute(Name('self'), '_file'), 'readline'), [], [], None, None)), If(BoolOp(Or(), [Compare(Name('line'), [Eq()], [BinOp(Bytes(b'*** EOOH ***'), Add(), Name('linesep'))]), UnaryOp(Not(), Name('line'))]), [Break()], []), Expr(Call(Attribute(Name('original_headers'), 'write'), [Call(Attribute(Name('line'), 'replace'), [Name('linesep'), Bytes(b'\n')], [], None, None)], [], None, None))], [])
1 |
1238 1239 1240 1241 1242 |
while True:
line = self._file.readline()
if line == b'*** EOOH ***' + linesep or not line:
break
original_headers.write(line.replace(linesep, b'\n'))
|
2 |
1266 1267 1268 1269 1270 |
while True:
line = self._file.readline()
if line == b'*** EOOH ***' + linesep or not line:
break
original_headers.write(line.replace(linesep, b'\n'))
|
FunctionDef('add', arguments([arg('self', None), arg('name', None), arg('cnf', None)], None, None, [], 'kw', None, [Dict([], [])], []), [Expr(Call(Attribute(Attribute(Name('self'), 'tk'), 'call'), [Attribute(Name('self'), '_w'), Str('add'), Name('name')], [], Call(Attribute(Name('self'), '_options'), [Name('cnf'), Name('kw')], [], None, None), None)), Assign([Subscript(Attribute(Name('self'), 'subwidget_list'), Index(Name('name')))], Call(Name('TixSubWidget'), [Name('self'), Name('name')], [], None, None)), Return(Subscript(Attribute(Name('self'), 'subwidget_list'), Index(Name('name'))))], [], None)
1 |
1123 1124 1125 1126 |
def add(self, name, cnf={}, **kw):
self.tk.call(self._w, 'add', name, *self._options(cnf, kw))
self.subwidget_list[name] = TixSubWidget(self, name)
return self.subwidget_list[name]
|
2 |
1164 1165 1166 1167 |
def add(self, name, cnf={}, **kw):
self.tk.call(self._w, 'add', name, *self._options(cnf, kw))
self.subwidget_list[name] = TixSubWidget(self, name)
return self.subwidget_list[name]
|
TryExcept([If(Compare(Subscript(Name('s'), Index(Name('end'))), [In()], [Name('_ws')]), [AugAssign(Name('end'), Add(), Num(1)), If(Compare(Subscript(Name('s'), Index(Name('end'))), [In()], [Name('_ws')]), [Assign([Name('end')], Call(Attribute(Call(Name('_w'), [Name('s'), BinOp(Name('end'), Add(), Num(1))], [], None, None), 'end'), [], [], None, None))], [])], [])], [ExceptHandler(Name('IndexError'), None, [Pass()])], [])
1 |
189 190 191 192 193 194 195 |
try:
if s[end] in _ws:
end += 1
if s[end] in _ws:
end = _w(s, end + 1).end()
except IndexError:
pass
|
2 |
254 255 256 257 258 259 260 |
try:
if s[end] in _ws:
end += 1
if s[end] in _ws:
end = _w(s, end + 1).end()
except IndexError:
pass
|
If(Call(Name('isinstance'), [Name('x'), Name('Vec2D')], [], None, None), [Assign([Name('pos')], Name('x'))], [If(Call(Name('isinstance'), [Name('x'), Name('tuple')], [], None, None), [Assign([Name('pos')], Call(Name('Vec2D'), [], [], Name('x'), None))], [If(Call(Name('isinstance'), [Name('x'), Name('TNavigator')], [], None, None), [Assign([Name('pos')], Attribute(Name('x'), '_position'))], [])])])
1 |
1845 1846 1847 1848 1849 1850 |
if isinstance(x, Vec2D):
pos = x
elif isinstance(x, tuple):
pos = Vec2D(*x)
elif isinstance(x, TNavigator):
pos = x._position
|
2 |
1877 1878 1879 1880 1881 1882 |
if isinstance(x, Vec2D):
pos = x
elif isinstance(x, tuple):
pos = Vec2D(*x)
elif isinstance(x, TNavigator):
pos = x._position
|
If(Compare(Name('r'), [Eq()], [Name('maxc')]), [Assign([Name('h')], BinOp(Name('bc'), Sub(), Name('gc')))], [If(Compare(Name('g'), [Eq()], [Name('maxc')]), [Assign([Name('h')], BinOp(BinOp(Num(2.0), Add(), Name('rc')), Sub(), Name('bc')))], [Assign([Name('h')], BinOp(BinOp(Num(4.0), Add(), Name('gc')), Sub(), Name('rc')))])])
1 |
81 82 83 84 85 86 |
if r == maxc:
h = bc-gc
elif g == maxc:
h = 2.0+rc-bc
else:
h = 4.0+gc-rc
|
2 |
126 127 128 129 130 131 |
if r == maxc:
h = bc-gc
elif g == maxc:
h = 2.0+rc-bc
else:
h = 4.0+gc-rc
|
If(UnaryOp(Not(), Call(Name('isabs'), [Name('path')], [], None, None)), [If(Call(Name('isinstance'), [Name('path'), Name('bytes')], [], None, None), [Assign([Name('cwd')], Call(Attribute(Name('os'), 'getcwdb'), [], [], None, None))], [Assign([Name('cwd')], Call(Attribute(Name('os'), 'getcwd'), [], [], None, None))]), Assign([Name('path')], Call(Name('join'), [Name('cwd'), Name('path')], [], None, None))], [])
1 |
177 178 179 180 181 182 |
if not isabs(path):
if isinstance(path, bytes):
cwd = os.getcwdb()
else:
cwd = os.getcwd()
path = join(cwd, path)
|
2 |
576 577 578 579 580 581 |
if not isabs(path):
if isinstance(path, bytes):
cwd = os.getcwdb()
else:
cwd = os.getcwd()
path = join(cwd, path)
|
3 |
369 370 371 372 373 374 |
if not isabs(path):
if isinstance(path, bytes):
cwd = os.getcwdb()
else:
cwd = os.getcwd()
path = join(cwd, path)
|
For(Tuple([Name('v'), Name('k')]), Call(Name('sorted'), [Call(Attribute(Name('namespaces'), 'items'), [], [], None, None)], [keyword('key', Lambda(arguments([arg('x', None)], None, None, [], None, None, [], []), Subscript(Name('x'), Index(Num(1)))))], None, None), [If(Name('k'), [Assign([Name('k')], BinOp(Str(':'), Add(), Name('k')))], []), Expr(Call(Name('write'), [BinOp(Str(' xmlns%s="%s"'), Mod(), Tuple([Name('k'), Call(Name('_escape_attrib'), [Name('v')], [], None, None)]))], [], None, None))], [])
1 |
957 958 959 960 961 962 963 |
for v, k in sorted(namespaces.items(),
key=lambda x: x[1]): # sort on prefix
if k:
k = ":" + k
write(" xmlns%s=\"%s\"" % (
k,
_escape_attrib(v)
|
2 |
1012 1013 1014 1015 1016 1017 1018 |
for v, k in sorted(namespaces.items(),
key=lambda x: x[1]): # sort on prefix
if k:
k = ":" + k
write(" xmlns%s=\"%s\"" % (
k,
_escape_attrib(v)
|
If(Name('ok'), [Expr(Call(Attribute(Name('hr'), 'maybe'), [], [], None, None)), Expr(Call(Name('push'), [Name('msg')], [], None, None)), For(Tuple([Name('name'), Name('kind'), Name('homecls'), Name('value')]), Name('ok'), [Expr(Call(Name('push'), [Call(Attribute(Name('self'), '_docdescriptor'), [Name('name'), Name('value'), Name('mod')], [], None, None)], [], None, None))], [])], [])
1 |
775 776 777 778 779 |
if ok:
hr.maybe()
push(msg)
for name, kind, homecls, value in ok:
push(self._docdescriptor(name, value, mod))
|
2 |
1212 1213 1214 1215 1216 |
if ok:
hr.maybe()
push(msg)
for name, kind, homecls, value in ok:
push(self._docdescriptor(name, value, mod))
|
While(UnaryOp(Not(), Attribute(Name('self'), 'quit')), [Assign([Tuple([Name('rd'), Name('wr'), Name('ex')])], Call(Attribute(Name('select'), 'select'), [List([Call(Attribute(Attribute(Name('self'), 'socket'), 'fileno'), [], [], None, None)]), List([]), List([]), Num(1)], [], None, None)), If(Name('rd'), [Expr(Call(Attribute(Name('self'), 'handle_request'), [], [], None, None))], [])], [])
1 |
2144 2145 2146 |
while not self.quit:
rd, wr, ex = select.select([self.socket.fileno()], [], [], 1)
if rd: self.handle_request()
|
2 |
2441 2442 2443 2444 |
while not self.quit:
rd, wr, ex = select.select([self.socket.fileno()], [], [], 1)
if rd:
self.handle_request()
|
If(Compare(Attribute(Name('op1'), 'exp'), [GtE()], [Attribute(Name('op2'), 'exp')]), [AugAssign(Attribute(Name('op1'), 'int'), Mult(), BinOp(Num(10), Pow(), BinOp(Attribute(Name('op1'), 'exp'), Sub(), Attribute(Name('op2'), 'exp'))))], [AugAssign(Attribute(Name('op2'), 'int'), Mult(), BinOp(Num(10), Pow(), BinOp(Attribute(Name('op2'), 'exp'), Sub(), Attribute(Name('op1'), 'exp'))))])
1 |
1348 1349 1350 1351 |
if op1.exp >= op2.exp:
op1.int *= 10**(op1.exp - op2.exp)
else:
op2.int *= 10**(op2.exp - op1.exp)
|
2 |
1497 1498 1499 1500 |
if op1.exp >= op2.exp:
op1.int *= 10**(op1.exp - op2.exp)
else:
op2.int *= 10**(op2.exp - op1.exp)
|
For(Tuple([Name('k'), Name('v')]), Call(Attribute(Name('cnf'), 'items'), [], [], None, None), [If(Call(Name('callable'), [Name('v')], [], None, None), [Assign([Name('v')], Call(Attribute(Name('self'), '_register'), [Name('v')], [], None, None))], []), Assign([Name('options')], BinOp(Name('options'), Add(), Tuple([BinOp(Str('-'), Add(), Name('k')), Name('v')])))], [])
1 |
3183 3184 3185 3186 |
for k, v in cnf.items():
if callable(v):
v = self._register(v)
options = options + ('-'+k, v)
|
2 |
407 408 409 410 |
for k, v in cnf.items():
if callable(v):
v = self._register(v)
options = options + ('-'+k, v)
|
If(Compare(Name('value'), [IsNot()], [Name('result')]), [Assign([Subscript(Name('self'), Index(Name('key')))], Name('result')), If(Compare(Call(Name('type'), [Name('result')], [], None, None), [In()], [Tuple([Name('ConvertingDict'), Name('ConvertingList'), Name('ConvertingTuple')])]), [Assign([Attribute(Name('result'), 'parent')], Name('self')), Assign([Attribute(Name('result'), 'key')], Name('key'))], [])], [])
1 |
293 294 295 296 297 298 |
if value is not result:
self[key] = result
if type(result) in (ConvertingDict, ConvertingList,
ConvertingTuple):
result.parent = self
result.key = key
|
2 |
305 306 307 308 309 310 |
if value is not result:
self[key] = result
if type(result) in (ConvertingDict, ConvertingList,
ConvertingTuple):
result.parent = self
result.key = key
|
3 |
329 330 331 332 333 334 |
if value is not result:
self[key] = result
if type(result) in (ConvertingDict, ConvertingList,
ConvertingTuple):
result.parent = self
result.key = key
|
If(Attribute(Name('self'), 'install_script'), [For(Name('script'), Attribute(Attribute(Name('self'), 'distribution'), 'scripts'), [If(Compare(Attribute(Name('self'), 'install_script'), [Eq()], [Call(Attribute(Attribute(Name('os'), 'path'), 'basename'), [Name('script')], [], None, None)]), [Break()], [])], [Raise(Call(Name('DistutilsOptionError'), [BinOp(Str("install_script '%s' not found in scripts"), Mod(), Attribute(Name('self'), 'install_script'))], [], None, None), None)])], [])
1 |
168 169 170 171 172 173 174 175 |
if self.install_script:
for script in self.distribution.scripts:
if self.install_script == os.path.basename(script):
break
else:
raise DistutilsOptionError(
"install_script '%s' not found in scripts"
% self.install_script)
|
2 |
103 104 105 106 107 108 109 110 |
if self.install_script:
for script in self.distribution.scripts:
if self.install_script == os.path.basename(script):
break
else:
raise DistutilsOptionError(
"install_script '%s' not found in scripts"
% self.install_script)
|
If(Compare(Name('macros'), [Is()], [Name('None')]), [Assign([Name('macros')], Attribute(Name('self'), 'macros'))], [If(Call(Name('isinstance'), [Name('macros'), Name('list')], [], None, None), [Assign([Name('macros')], BinOp(Name('macros'), Add(), BoolOp(Or(), [Attribute(Name('self'), 'macros'), List([])])))], [Raise(Call(Name('TypeError'), [Str("'macros' (if supplied) must be a list of tuples")], [], None, None), None)])])
1 |
318 319 320 321 322 323 |
if macros is None:
macros = self.macros
elif isinstance(macros, list):
macros = macros + (self.macros or [])
else:
raise TypeError("'macros' (if supplied) must be a list of tuples")
|
2 |
377 378 379 380 381 382 |
if macros is None:
macros = self.macros
elif isinstance(macros, list):
macros = macros + (self.macros or [])
else:
raise TypeError("'macros' (if supplied) must be a list of tuples")
|
While(Name('True'), [Assign([Name('line')], Call(Attribute(Name('orig_buffer'), 'readline'), [], [], None, None)), Expr(Call(Attribute(Attribute(Name('self'), '_file'), 'write'), [Call(Attribute(Name('line'), 'replace'), [Bytes(b'\n'), Name('linesep')], [], None, None)], [], None, None)), If(BoolOp(Or(), [Compare(Name('line'), [Eq()], [Bytes(b'\n')]), UnaryOp(Not(), Name('line'))]), [Break()], [])], [])
1 |
1368 1369 1370 1371 1372 |
while True:
line = orig_buffer.readline()
self._file.write(line.replace(b'\n', linesep))
if line == b'\n' or not line:
break
|
2 |
1385 1386 1387 1388 1389 |
while True:
line = orig_buffer.readline()
self._file.write(line.replace(b'\n', linesep))
if line == b'\n' or not line:
break
|
If(UnaryOp(Not(), Call(Attribute(Attribute(Name('os'), 'path'), 'exists'), [Name('archive_dir')], [], None, None)), [If(Compare(Name('logger'), [IsNot()], [Name('None')]), [Expr(Call(Attribute(Name('logger'), 'info'), [Str('creating %s'), Name('archive_dir')], [], None, None))], []), If(UnaryOp(Not(), Name('dry_run')), [Expr(Call(Attribute(Name('os'), 'makedirs'), [Name('archive_dir')], [], None, None))], [])], [])
1 |
399 400 401 402 403 |
if not os.path.exists(archive_dir):
if logger is not None:
logger.info("creating %s", archive_dir)
if not dry_run:
os.makedirs(archive_dir)
|
2 |
459 460 461 462 463 |
if not os.path.exists(archive_dir):
if logger is not None:
logger.info("creating %s", archive_dir)
if not dry_run:
os.makedirs(archive_dir)
|
Assign([Tuple([Name('x'), Name('y')])], Tuple([BinOp(Call(Attribute(Attribute(Name('self'), 'cv'), 'canvasx'), [Attribute(Name('event'), 'x')], [], None, None), Div(), Attribute(Name('self'), 'xscale')), BinOp(UnaryOp(USub(), Call(Attribute(Attribute(Name('self'), 'cv'), 'canvasy'), [Attribute(Name('event'), 'y')], [], None, None)), Div(), Attribute(Name('self'), 'yscale'))]))
1 |
615 616 |
x, y = (self.cv.canvasx(event.x)/self.xscale,
-self.cv.canvasy(event.y)/self.yscale)
|
2 |
633 634 |
x, y = (self.cv.canvasx(event.x)/self.xscale,
-self.cv.canvasy(event.y)/self.yscale)
|
3 |
653 654 |
x, y = (self.cv.canvasx(event.x)/self.xscale,
-self.cv.canvasy(event.y)/self.yscale)
|
4 |
673 674 |
x, y = (self.cv.canvasx(event.x)/self.xscale,
-self.cv.canvasy(event.y)/self.yscale)
|
TryExcept([Expr(Call(Attribute(Name('self'), 'spawn'), [BinOp(BinOp(BinOp(BinOp(List([Attribute(Name('self'), 'cc')]), Add(), Name('compile_opts')), Add(), Name('pp_opts')), Add(), List([Name('input_opt'), Name('output_opt')])), Add(), Name('extra_postargs'))], [], None, None))], [ExceptHandler(Name('DistutilsExecError'), 'msg', [Raise(Call(Name('CompileError'), [Name('msg')], [], None, None), None)])], [])
1 |
530 531 532 533 534 535 |
try:
self.spawn([self.cc] + compile_opts + pp_opts +
[input_opt, output_opt] +
extra_postargs)
except DistutilsExecError as msg:
raise CompileError(msg)
|
2 |
415 416 417 418 419 420 |
try:
self.spawn([self.cc] + compile_opts + pp_opts +
[input_opt, output_opt] +
extra_postargs)
except DistutilsExecError as msg:
raise CompileError(msg)
|
If(BoolOp(Or(), [UnaryOp(Not(), Name('section')), Compare(Name('section'), [Eq()], [Attribute(Name('self'), 'default_section')])]), [Assign([Name('sectdict')], Attribute(Name('self'), '_defaults'))], [TryExcept([Assign([Name('sectdict')], Subscript(Attribute(Name('self'), '_sections'), Index(Name('section'))))], [ExceptHandler(Name('KeyError'), None, [Raise(Call(Name('NoSectionError'), [Name('section')], [], None, None), None)])], [])])
1 |
877 878 879 880 881 882 883 |
if not section or section == self.default_section:
sectdict = self._defaults
else:
try:
sectdict = self._sections[section]
except KeyError:
raise NoSectionError(section)
|
2 |
918 919 920 921 922 923 924 |
if not section or section == self.default_section:
sectdict = self._defaults
else:
try:
sectdict = self._sections[section]
except KeyError:
raise NoSectionError(section)
|
If(Compare(Name('nargs'), [Eq()], [Num(1)]), [Expr(Call(Attribute(Name('self'), 'error'), [BinOp(Call(Name('_'), [Str('%s option requires an argument')], [], None, None), Mod(), Name('opt'))], [], None, None))], [Expr(Call(Attribute(Name('self'), 'error'), [BinOp(Call(Name('_'), [Str('%s option requires %d arguments')], [], None, None), Mod(), Tuple([Name('opt'), Name('nargs')]))], [], None, None))])
1 |
1486 1487 1488 1489 1490 |
if nargs == 1:
self.error(_("%s option requires an argument") % opt)
else:
self.error(_("%s option requires %d arguments")
% (opt, nargs))
|
2 |
1525 1526 1527 1528 1529 |
if nargs == 1:
self.error(_("%s option requires an argument") % opt)
else:
self.error(_("%s option requires %d arguments")
% (opt, nargs))
|
ExceptHandler(Name('IOError'), 'msg', [Assign([Name('my_msg')], BinOp(Str('invalid Python installation: unable to open %s'), Mod(), Name('filename'))), If(Call(Name('hasattr'), [Name('msg'), Str('strerror')], [], None, None), [Assign([Name('my_msg')], BinOp(Name('my_msg'), Add(), BinOp(Str(' (%s)'), Mod(), Attribute(Name('msg'), 'strerror'))))], []), Raise(Call(Name('DistutilsPlatformError'), [Name('my_msg')], [], None, None), None)])
1 |
435 436 437 438 439 440 |
except IOError as msg:
my_msg = "invalid Python installation: unable to open %s" % filename
if hasattr(msg, "strerror"):
my_msg = my_msg + " (%s)" % msg.strerror
raise DistutilsPlatformError(my_msg)
|
2 |
447 448 449 450 451 452 |
except IOError as msg:
my_msg = "invalid Python installation: unable to open %s" % filename
if hasattr(msg, "strerror"):
my_msg = my_msg + " (%s)" % msg.strerror
raise DistutilsPlatformError(my_msg)
|
If(Compare(Name('itoken'), [In()], [Attribute(Name('c'), 'tokens')]), [Return(Subscript(Attribute(Name('c'), 'tokens'), Index(Name('itoken'))))], [Expr(Call(Attribute(Attribute(Name('c'), 'labels'), 'append'), [Tuple([Name('itoken'), Name('None')])], [], None, None)), Assign([Subscript(Attribute(Name('c'), 'tokens'), Index(Name('itoken')))], Name('ilabel')), Return(Name('ilabel'))])
1 |
79 80 81 82 83 84 |
if itoken in c.tokens:
return c.tokens[itoken]
else:
c.labels.append((itoken, None))
c.tokens[itoken] = ilabel
return ilabel
|
2 |
100 101 102 103 104 105 |
if itoken in c.tokens:
return c.tokens[itoken]
else:
c.labels.append((itoken, None))
c.tokens[itoken] = ilabel
return ilabel
|
If(Compare(Attribute(Name('self'), 'library_dirs'), [Is()], [Name('None')]), [Assign([Attribute(Name('self'), 'library_dirs')], List([]))], [If(Call(Name('isinstance'), [Attribute(Name('self'), 'library_dirs'), Name('str')], [], None, None), [Assign([Attribute(Name('self'), 'library_dirs')], Call(Attribute(Attribute(Name('self'), 'library_dirs'), 'split'), [Attribute(Name('os'), 'pathsep')], [], None, None))], [])])
1 |
174 175 176 177 |
if self.library_dirs is None:
self.library_dirs = []
elif isinstance(self.library_dirs, str):
self.library_dirs = self.library_dirs.split(os.pathsep)
|
2 |
77 78 79 80 |
if self.library_dirs is None:
self.library_dirs = []
elif isinstance(self.library_dirs, str):
self.library_dirs = self.library_dirs.split(os.pathsep)
|
If(Compare(Name('c'), [In()], [Name('STORE_OPS')]), [Assign([Tuple([Name('oparg')])], Call(Name('unpack'), [Str('<H'), Subscript(Name('code'), Slice(Num(1), Num(3), None))], [], None, None)), Expr(Yield(Tuple([Str('store'), Tuple([Subscript(Name('names'), Index(Name('oparg')))])]))), Assign([Name('code')], Subscript(Name('code'), Slice(Num(3), None, None))), Continue()], [])
1 |
346 347 348 349 350 |
if c in STORE_OPS:
oparg, = unpack('<H', code[1:3])
yield "store", (names[oparg],)
code = code[3:]
continue
|
2 |
371 372 373 374 375 |
if c in STORE_OPS:
oparg, = unpack('<H', code[1:3])
yield "store", (names[oparg],)
code = code[3:]
continue
|
For(Name('p'), Attribute(Name('self'), '__paths'), [Assign([Name('fn')], Call(Attribute(Attribute(Name('os'), 'path'), 'join'), [Call(Attribute(Attribute(Name('os'), 'path'), 'abspath'), [Name('p')], [], None, None), Name('exe')], [], None, None)), If(Call(Attribute(Attribute(Name('os'), 'path'), 'isfile'), [Name('fn')], [], None, None), [Return(Name('fn'))], [])], [])
1 |
777 778 779 780 |
for p in self.__paths:
fn = os.path.join(os.path.abspath(p), exe)
if os.path.isfile(fn):
return fn
|
2 |
571 572 573 574 |
for p in self.__paths:
fn = os.path.join(os.path.abspath(p), exe)
if os.path.isfile(fn):
return fn
|
While(Compare(Name('lo'), [Lt()], [Name('hi')]), [Assign([Name('mid')], BinOp(BinOp(Name('lo'), Add(), Name('hi')), FloorDiv(), Num(2))), If(Compare(Name('x'), [Lt()], [Subscript(Name('a'), Index(Name('mid')))]), [Assign([Name('hi')], Name('mid'))], [Assign([Name('lo')], BinOp(Name('mid'), Add(), Num(1)))])], [])
1 |
16 17 18 19 |
while lo < hi:
mid = (lo+hi)//2
if x < a[mid]: hi = mid
else: lo = mid+1
|
2 |
39 40 41 42 |
while lo < hi:
mid = (lo+hi)//2
if x < a[mid]: hi = mid
else: lo = mid+1
|
While(Compare(Name('lo'), [Lt()], [Name('hi')]), [Assign([Name('mid')], BinOp(BinOp(Name('lo'), Add(), Name('hi')), FloorDiv(), Num(2))), If(Compare(Subscript(Name('a'), Index(Name('mid'))), [Lt()], [Name('x')]), [Assign([Name('lo')], BinOp(Name('mid'), Add(), Num(1)))], [Assign([Name('hi')], Name('mid'))])], [])
1 |
60 61 62 63 |
while lo < hi:
mid = (lo+hi)//2
if a[mid] < x: lo = mid+1
else: hi = mid
|
2 |
82 83 84 85 |
while lo < hi:
mid = (lo+hi)//2
if a[mid] < x: lo = mid+1
else: hi = mid
|
TryExcept([Assign([Name('label')], Call(Attribute(Name('label'), 'encode'), [Str('ascii')], [], None, None))], [ExceptHandler(Name('UnicodeError'), None, [Pass()])], [If(Compare(Num(0), [Lt(), Lt()], [Call(Name('len'), [Name('label')], [], None, None), Num(64)]), [Return(Name('label'))], []), Raise(Call(Name('UnicodeError'), [Str('label empty or too long')], [], None, None), None)])
1 |
63 64 65 66 67 68 69 70 71 72 73 |
try:
# Step 1: try ASCII
label = label.encode("ascii")
except UnicodeError:
pass
else:
# Skip to step 3: UseSTD3ASCIIRules is false, so
# Skip to step 8.
if 0 < len(label) < 64:
return label
raise UnicodeError("label empty or too long")
|
2 |
80 81 82 83 84 85 86 87 88 |
try:
label = label.encode("ascii")
except UnicodeError:
pass
else:
# Skip to step 8.
if 0 < len(label) < 64:
return label
raise UnicodeError("label empty or too long")
|
TryExcept([Assign([Name('rc')], Call(Attribute(Name('os'), 'spawnv'), [Attribute(Name('os'), 'P_WAIT'), Name('executable'), Name('cmd')], [], None, None))], [ExceptHandler(Name('OSError'), 'exc', [Raise(Call(Name('DistutilsExecError'), [BinOp(Str("command '%s' failed: %s"), Mod(), Tuple([Subscript(Name('cmd'), Index(Num(0))), Subscript(Attribute(Name('exc'), 'args'), Index(UnaryOp(USub(), Num(1))))]))], [], None, None), None)])], [])
1 |
66 67 68 69 70 71 |
try:
rc = os.spawnv(os.P_WAIT, executable, cmd)
except OSError as exc:
# this seems to happen when the command isn't found
raise DistutilsExecError(
"command '%s' failed: %s" % (cmd[0], exc.args[-1]))
|
2 |
85 86 87 88 89 90 |
try:
rc = os.spawnv(os.P_WAIT, executable, cmd)
except OSError as exc:
# this seems to happen when the command isn't found
raise DistutilsExecError(
"command '%s' failed: %s" % (cmd[0], exc.args[-1]))
|
TryExcept([Assign([Name('line')], Subscript(Attribute(Name('self'), '_buffer'), Index(Attribute(Name('self'), '_bufindex'))))], [ExceptHandler(Name('IndexError'), None, [Pass()])], [AugAssign(Attribute(Name('self'), '_bufindex'), Add(), Num(1)), AugAssign(Attribute(Name('self'), '_lineno'), Add(), Num(1)), AugAssign(Attribute(Name('self'), '_filelineno'), Add(), Num(1)), Return(Name('line'))])
1 |
252 253 254 255 256 257 258 259 260 |
try:
line = self._buffer[self._bufindex]
except IndexError:
pass
else:
self._bufindex += 1
self._lineno += 1
self._filelineno += 1
return line
|
2 |
301 302 303 304 305 306 307 308 309 |
try:
line = self._buffer[self._bufindex]
except IndexError:
pass
else:
self._bufindex += 1
self._lineno += 1
self._filelineno += 1
return line
|
FunctionDef('encode', arguments([arg('self', None), arg('input', None), arg('final', None)], None, None, [], None, None, [Name('False')], []), [If(Name('final'), [Assign([Name('c')], Call(Attribute(Attribute(Name('self'), 'compressobj'), 'compress'), [Name('input')], [], None, None)), Return(BinOp(Name('c'), Add(), Call(Attribute(Attribute(Name('self'), 'compressobj'), 'flush'), [], [], None, None)))], [Return(Call(Attribute(Attribute(Name('self'), 'compressobj'), 'compress'), [Name('input')], [], None, None))])], [], None)
1 |
35 36 37 38 39 40 |
def encode(self, input, final=False):
if final:
c = self.compressobj.compress(input)
return c + self.compressobj.flush()
else:
return self.compressobj.compress(input)
|
2 |
34 35 36 37 38 39 |
def encode(self, input, final=False):
if final:
c = self.compressobj.compress(input)
return c + self.compressobj.flush()
else:
return self.compressobj.compress(input)
|
FunctionDef('convert_mbcs', arguments([arg('s', None)], None, None, [], None, None, [], []), [Assign([Name('dec')], Call(Name('getattr'), [Name('s'), Str('decode'), Name('None')], [], None, None)), If(Compare(Name('dec'), [IsNot()], [Name('None')]), [TryExcept([Assign([Name('s')], Call(Name('dec'), [Str('mbcs')], [], None, None))], [ExceptHandler(Name('UnicodeError'), None, [Pass()])], [])], []), Return(Name('s'))], [], None)
1 |
113 114 115 116 117 118 119 120 |
def convert_mbcs(s):
dec = getattr(s, "decode", None)
if dec is not None:
try:
s = dec("mbcs")
except UnicodeError:
pass
return s
|
2 |
93 94 95 96 97 98 99 100 |
def convert_mbcs(s):
dec = getattr(s, "decode", None)
if dec is not None:
try:
s = dec("mbcs")
except UnicodeError:
pass
return s
|
While(Num(1), [Assign([Name('buf')], Call(Attribute(Name('fp'), 'read'), [Name('blocksize')], [], None, None)), If(UnaryOp(Not(), Name('buf')), [Break()], []), Expr(Call(Attribute(Name('conn'), 'sendall'), [Name('buf')], [], None, None)), If(Name('callback'), [Expr(Call(Name('callback'), [Name('buf')], [], None, None))], [])], [])
1 |
470 471 472 473 474 |
while 1:
buf = fp.read(blocksize)
if not buf: break
conn.sendall(buf)
if callback: callback(buf)
|
2 |
760 761 762 763 764 |
while 1:
buf = fp.read(blocksize)
if not buf: break
conn.sendall(buf)
if callback: callback(buf)
|
If(Compare(Subscript(Name('line'), Index(Name('pos'))), [Eq()], [Str('\t')]), [Assign([Name('column')], BinOp(BinOp(BinOp(Name('column'), FloorDiv(), Name('tabsize')), Add(), Num(1)), Mult(), Name('tabsize')))], [If(Compare(Subscript(Name('line'), Index(Name('pos'))), [Eq()], [Str('\x0c')]), [Assign([Name('column')], Num(0))], [Break()])])
1 |
401 402 403 |
elif line[pos] == '\t': column = (column//tabsize + 1)*tabsize
elif line[pos] == '\f': column = 0
else: break
|
2 |
429 430 431 432 433 434 |
elif line[pos] == '\t':
column = (column//tabsize + 1)*tabsize
elif line[pos] == '\f':
column = 0
else:
break
|
If(Compare(Subscript(Name('s'), Index(Name('end'))), [In()], [Name('_ws')]), [AugAssign(Name('end'), Add(), Num(1)), If(Compare(Subscript(Name('s'), Index(Name('end'))), [In()], [Name('_ws')]), [Assign([Name('end')], Call(Attribute(Call(Name('_w'), [Name('s'), BinOp(Name('end'), Add(), Num(1))], [], None, None), 'end'), [], [], None, None))], [])], [])
1 |
190 191 192 193 |
if s[end] in _ws:
end += 1
if s[end] in _ws:
end = _w(s, end + 1).end()
|
2 |
255 256 257 258 |
if s[end] in _ws:
end += 1
if s[end] in _ws:
end = _w(s, end + 1).end()
|
For(Name('name'), Name('try_names'), [Assign([Name('libfile')], Call(Attribute(Attribute(Name('os'), 'path'), 'join'), [Name('dir'), Call(Attribute(Name('self'), 'library_filename'), [Name('name')], [], None, None)], [], None, None)), If(Call(Attribute(Attribute(Name('os'), 'path'), 'exists'), [Name('libfile')], [], None, None), [Return(Name('libfile'))], [])], [])
1 |
325 326 327 328 |
for name in try_names:
libfile = os.path.join(dir, self.library_filename(name))
if os.path.exists(libfile):
return libfile
|
2 |
758 759 760 761 |
for name in try_names:
libfile = os.path.join(dir, self.library_filename (name))
if os.path.exists(libfile):
return libfile
|
3 |
552 553 554 555 |
for name in try_names:
libfile = os.path.join(dir, self.library_filename (name))
if os.path.exists(libfile):
return libfile
|
For(Name('script'), Attribute(Attribute(Name('self'), 'distribution'), 'scripts'), [If(Compare(Attribute(Name('self'), 'install_script'), [Eq()], [Call(Attribute(Attribute(Name('os'), 'path'), 'basename'), [Name('script')], [], None, None)]), [Break()], [])], [Raise(Call(Name('DistutilsOptionError'), [BinOp(Str("install_script '%s' not found in scripts"), Mod(), Attribute(Name('self'), 'install_script'))], [], None, None), None)])
1 |
169 170 171 172 173 174 175 |
for script in self.distribution.scripts:
if self.install_script == os.path.basename(script):
break
else:
raise DistutilsOptionError(
"install_script '%s' not found in scripts"
% self.install_script)
|
2 |
104 105 106 107 108 109 110 |
for script in self.distribution.scripts:
if self.install_script == os.path.basename(script):
break
else:
raise DistutilsOptionError(
"install_script '%s' not found in scripts"
% self.install_script)
|
If(UnaryOp(Not(), Name('_type_reprs')), [ImportFrom('pygram', [alias('python_symbols', None)], 1), For(Tuple([Name('name'), Name('val')]), Call(Attribute(Attribute(Name('python_symbols'), '__dict__'), 'items'), [], [], None, None), [If(Compare(Call(Name('type'), [Name('val')], [], None, None), [Eq()], [Name('int')]), [Assign([Subscript(Name('_type_reprs'), Index(Name('val')))], Name('name'))], [])], [])], [])
1 |
162 163 164 165 166 167 |
if not _type_reprs:
from .pygram import python_symbols
# printing tokens is possible but not as useful
# from .pgen2 import token // token.__dict__.items():
for name, val in python_symbols.__dict__.items():
if type(val) == int: _type_reprs[val] = name
|
2 |
24 25 26 27 28 29 |
if not _type_reprs:
from .pygram import python_symbols
# printing tokens is possible but not as useful
# from .pgen2 import token // token.__dict__.items():
for name, val in python_symbols.__dict__.items():
if type(val) == int: _type_reprs[val] = name
|
If(BoolOp(And(), [Call(Attribute(Name('name'), 'startswith'), [Str('PY_')], [], None, None), Compare(Subscript(Name('name'), Slice(Num(3), None, None)), [In()], [Name('renamed_variables')])]), [Assign([Name('name')], Subscript(Name('name'), Slice(Num(3), None, None))), If(Compare(Name('name'), [NotIn()], [Name('done')]), [Assign([Subscript(Name('done'), Index(Name('name')))], Name('value'))], [])], [])
1 |
379 380 381 382 383 384 |
if name.startswith('PY_') \
and name[3:] in renamed_variables:
name = name[3:]
if name not in done:
done[name] = value
|
2 |
316 317 318 319 320 321 |
if name.startswith('PY_') \
and name[3:] in renamed_variables:
name = name[3:]
if name not in done:
done[name] = value
|
TryExcept([Expr(Call(Attribute(Name('self'), 'spawn'), [BinOp(BinOp(BinOp(List([Attribute(Name('self'), 'rc')]), Add(), Name('pp_opts')), Add(), List([Name('output_opt')])), Add(), List([Name('input_opt')]))], [], None, None))], [ExceptHandler(Name('DistutilsExecError'), 'msg', [Raise(Call(Name('CompileError'), [Name('msg')], [], None, None), None)])], [])
1 |
491 492 493 494 495 |
try:
self.spawn([self.rc] + pp_opts +
[output_opt] + [input_opt])
except DistutilsExecError as msg:
raise CompileError(msg)
|
2 |
376 377 378 379 380 |
try:
self.spawn([self.rc] + pp_opts +
[output_opt] + [input_opt])
except DistutilsExecError as msg:
raise CompileError(msg)
|
TryExcept([Expr(Call(Attribute(Name('self'), 'spawn'), [BinOp(BinOp(BinOp(Attribute(Name('self'), 'compiler_so'), Add(), Name('cc_args')), Add(), List([Name('src'), Str('-o'), Name('obj')])), Add(), Name('extra_postargs'))], [], None, None))], [ExceptHandler(Name('DistutilsExecError'), 'msg', [Raise(Call(Name('CompileError'), [Name('msg')], [], None, None), None)])], [])
1 |
164 165 166 167 168 |
try:
self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
extra_postargs)
except DistutilsExecError as msg:
raise CompileError(msg)
|
2 |
83 84 85 86 87 |
try:
self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
extra_postargs)
except DistutilsExecError as msg:
raise CompileError(msg)
|
FunctionDef('writeframes', arguments([arg('self', None), arg('data', None)], None, None, [], None, None, [], []), [Expr(Call(Attribute(Name('self'), 'writeframesraw'), [Name('data')], [], None, None)), If(BoolOp(Or(), [Compare(Attribute(Name('self'), '_nframeswritten'), [NotEq()], [Attribute(Name('self'), '_nframes')]), Compare(Attribute(Name('self'), '_datalength'), [NotEq()], [Attribute(Name('self'), '_datawritten')])]), [Expr(Call(Attribute(Name('self'), '_patchheader'), [], [], None, None))], [])], [], None)
1 |
688 689 690 691 692 |
def writeframes(self, data):
self.writeframesraw(data)
if self._nframeswritten != self._nframes or \
self._datalength != self._datawritten:
self._patchheader()
|
2 |
401 402 403 404 405 |
def writeframes(self, data):
self.writeframesraw(data)
if self._nframeswritten != self._nframes or \
self._datalength != self._datawritten:
self._patchheader()
|
If(Attribute(Name('self'), 'after_id'), [Assign([Name('after_id')], Attribute(Name('self'), 'after_id')), Assign([Attribute(Name('self'), 'after_id')], Name('None')), If(Name('DEBUG'), [Expr(Call(Name('print'), [Str('cancel scheduled recolorizer')], [], None, None))], []), Expr(Call(Attribute(Name('self'), 'after_cancel'), [Name('after_id')], [], None, None))], [])
1 |
107 108 109 110 111 |
if self.after_id:
after_id = self.after_id
self.after_id = None
if DEBUG: print("cancel scheduled recolorizer")
self.after_cancel(after_id)
|
2 |
121 122 123 124 125 |
if self.after_id:
after_id = self.after_id
self.after_id = None
if DEBUG: print("cancel scheduled recolorizer")
self.after_cancel(after_id)
|
If(Name('final'), [Assign([Name('c')], Call(Attribute(Attribute(Name('self'), 'compressobj'), 'compress'), [Name('input')], [], None, None)), Return(BinOp(Name('c'), Add(), Call(Attribute(Attribute(Name('self'), 'compressobj'), 'flush'), [], [], None, None)))], [Return(Call(Attribute(Attribute(Name('self'), 'compressobj'), 'compress'), [Name('input')], [], None, None))])
1 |
36 37 38 39 40 |
if final:
c = self.compressobj.compress(input)
return c + self.compressobj.flush()
else:
return self.compressobj.compress(input)
|
2 |
35 36 37 38 39 |
if final:
c = self.compressobj.compress(input)
return c + self.compressobj.flush()
else:
return self.compressobj.compress(input)
|
If(Call(Attribute(Name('line'), 'endswith'), [Bytes(b'\r\n')], [], None, None), [Assign([Name('line')], BinOp(Subscript(Name('line'), Slice(None, UnaryOp(USub(), Num(2)), None)), Add(), Bytes(b'\n')))], [If(Call(Attribute(Name('line'), 'endswith'), [Bytes(b'\r')], [], None, None), [Assign([Name('line')], BinOp(Subscript(Name('line'), Slice(None, UnaryOp(USub(), Num(1)), None)), Add(), Bytes(b'\n')))], [])])
1 |
241 242 243 244 |
if line.endswith(b'\r\n'):
line = line[:-2] + b'\n'
elif line.endswith(b'\r'):
line = line[:-1] + b'\n'
|
2 |
1421 1422 1423 1424 |
if line.endswith(b'\r\n'):
line = line[:-2] + b'\n'
elif line.endswith(b'\r'):
line = line[:-1] + b'\n'
|
FunctionDef('__init__', arguments([arg('self', None)], None, None, [], None, None, [], []), [Expr(Call(Attribute(Name('Repr'), '__init__'), [Name('self')], [], None, None)), Assign([Attribute(Name('self'), 'maxlist'), Attribute(Name('self'), 'maxtuple')], Num(20)), Assign([Attribute(Name('self'), 'maxdict')], Num(10)), Assign([Attribute(Name('self'), 'maxstring'), Attribute(Name('self'), 'maxother')], Num(100))], [], None)
1 |
389 390 391 392 393 |
def __init__(self):
Repr.__init__(self)
self.maxlist = self.maxtuple = 20
self.maxdict = 10
self.maxstring = self.maxother = 100
|
2 |
981 982 983 984 985 |
def __init__(self):
Repr.__init__(self)
self.maxlist = self.maxtuple = 20
self.maxdict = 10
self.maxstring = self.maxother = 100
|
For(Tuple([Name('key'), Name('value')]), Call(Attribute(Name('inspect'), 'getmembers'), [Name('object'), Name('isdata')], [], None, None), [If(Call(Name('visiblename'), [Name('key'), Name('all'), Name('object')], [], None, None), [Expr(Call(Attribute(Name('data'), 'append'), [Tuple([Name('key'), Name('value')])], [], None, None))], [])], [])
1 |
672 673 674 |
for key, value in inspect.getmembers(object, isdata):
if visiblename(key, all, object):
data.append((key, value))
|
2 |
1088 1089 1090 |
for key, value in inspect.getmembers(object, isdata):
if visiblename(key, all, object):
data.append((key, value))
|
If(Compare(Name('i'), [GtE()], [Num(0)]), [Assign([Name('i')], BinOp(Name('i'), Add(), Name('n'))), Assign([Name('buf')], Subscript(Attribute(Name('self'), 'cookedq'), Slice(None, Name('i'), None))), Assign([Attribute(Name('self'), 'cookedq')], Subscript(Attribute(Name('self'), 'cookedq'), Slice(Name('i'), None, None))), Return(Name('buf'))], [])
1 |
293 294 295 296 297 |
if i >= 0:
i = i+n
buf = self.cookedq[:i]
self.cookedq = self.cookedq[i:]
return buf
|
2 |
309 310 311 312 313 |
if i >= 0:
i = i+n
buf = self.cookedq[:i]
self.cookedq = self.cookedq[i:]
return buf
|
For(Tuple([Name('x'), Name('y')]), Name('coordlist'), [Expr(Call(Attribute(Name('cl'), 'append'), [BinOp(Name('x'), Mult(), Attribute(Name('self'), 'xscale'))], [], None, None)), Expr(Call(Attribute(Name('cl'), 'append'), [BinOp(UnaryOp(USub(), Name('y')), Mult(), Attribute(Name('self'), 'yscale'))], [], None, None))], [])
1 |
511 512 513 |
for x, y in coordlist:
cl.append(x * self.xscale)
cl.append(-y * self.yscale)
|
2 |
542 543 544 |
for x, y in coordlist:
cl.append(x * self.xscale)
cl.append(-y * self.yscale)
|
FunctionDef('getparams', arguments([arg('self', None)], None, None, [], None, None, [], []), [Return(Tuple([Call(Attribute(Name('self'), 'getnchannels'), [], [], None, None), Call(Attribute(Name('self'), 'getsampwidth'), [], [], None, None), Call(Attribute(Name('self'), 'getframerate'), [], [], None, None), Call(Attribute(Name('self'), 'getnframes'), [], [], None, None), Call(Attribute(Name('self'), 'getcomptype'), [], [], None, None), Call(Attribute(Name('self'), 'getcompname'), [], [], None, None)]))], [], None)
1 |
373 374 375 376 |
def getparams(self):
return self.getnchannels(), self.getsampwidth(), \
self.getframerate(), self.getnframes(), \
self.getcomptype(), self.getcompname()
|
2 |
244 245 246 247 |
def getparams(self):
return self.getnchannels(), self.getsampwidth(), \
self.getframerate(), self.getnframes(), \
self.getcomptype(), self.getcompname()
|
3 |
383 384 385 386 |
def getparams(self):
return self.getnchannels(), self.getsampwidth(), \
self.getframerate(), self.getnframes(), \
self.getcomptype(), self.getcompname()
|
4 |
208 209 210 211 |
def getparams(self):
return self.getnchannels(), self.getsampwidth(), \
self.getframerate(), self.getnframes(), \
self.getcomptype(), self.getcompname()
|
TryExcept([Assign([Name('t')], Call(Name('translation'), [Name('domain'), Call(Attribute(Name('_localedirs'), 'get'), [Name('domain'), Name('None')], [], None, None)], [keyword('codeset', Call(Attribute(Name('_localecodesets'), 'get'), [Name('domain')], [], None, None))], None, None))], [ExceptHandler(Name('IOError'), None, [If(Compare(Name('n'), [Eq()], [Num(1)]), [Return(Name('msgid1'))], [Return(Name('msgid2'))])])], [])
1 |
491 492 493 494 495 496 497 498 |
try:
t = translation(domain, _localedirs.get(domain, None),
codeset=_localecodesets.get(domain))
except IOError:
if n == 1:
return msgid1
else:
return msgid2
|
2 |
502 503 504 505 506 507 508 509 |
try:
t = translation(domain, _localedirs.get(domain, None),
codeset=_localecodesets.get(domain))
except IOError:
if n == 1:
return msgid1
else:
return msgid2
|
If(Call(Attribute(Name('option_string'), 'startswith'), [Name('option_prefix')], [], None, None), [Assign([Name('action')], Subscript(Attribute(Name('self'), '_option_string_actions'), Index(Name('option_string')))), Assign([Name('tup')], Tuple([Name('action'), Name('option_string'), Name('explicit_arg')])), Expr(Call(Attribute(Name('result'), 'append'), [Name('tup')], [], None, None))], [])
1 |
2123 2124 2125 2126 |
if option_string.startswith(option_prefix):
action = self._option_string_actions[option_string]
tup = action, option_string, explicit_arg
result.append(tup)
|
2 |
2142 2143 2144 2145 |
elif option_string.startswith(option_prefix):
action = self._option_string_actions[option_string]
tup = action, option_string, explicit_arg
result.append(tup)
|
If(Compare(Name('value'), [IsNot()], [Name('result')]), [If(Compare(Call(Name('type'), [Name('result')], [], None, None), [In()], [Tuple([Name('ConvertingDict'), Name('ConvertingList'), Name('ConvertingTuple')])]), [Assign([Attribute(Name('result'), 'parent')], Name('self')), Assign([Attribute(Name('result'), 'key')], Name('key'))], [])], [])
1 |
316 317 318 319 320 |
if value is not result:
if type(result) in (ConvertingDict, ConvertingList,
ConvertingTuple):
result.parent = self
result.key = key
|
2 |
351 352 353 354 355 |
if value is not result:
if type(result) in (ConvertingDict, ConvertingList,
ConvertingTuple):
result.parent = self
result.key = key
|
If(Compare(Call(Attribute(Attribute(Name('self'), 'headers'), 'get'), [Str('content-type')], [], None, None), [Is()], [Name('None')]), [Assign([Subscript(Name('env'), Index(Str('CONTENT_TYPE')))], Call(Attribute(Attribute(Name('self'), 'headers'), 'get_content_type'), [], [], None, None))], [Assign([Subscript(Name('env'), Index(Str('CONTENT_TYPE')))], Subscript(Attribute(Name('self'), 'headers'), Index(Str('content-type'))))])
1 |
1049 1050 1051 1052 |
if self.headers.get('content-type') is None:
env['CONTENT_TYPE'] = self.headers.get_content_type()
else:
env['CONTENT_TYPE'] = self.headers['content-type']
|
2 |
92 93 94 95 |
if self.headers.get('content-type') is None:
env['CONTENT_TYPE'] = self.headers.get_content_type()
else:
env['CONTENT_TYPE'] = self.headers['content-type']
|
If(Compare(Name('toknum'), [In()], [Tuple([Name('NEWLINE'), Name('NL')])]), [Assign([Name('startline')], Name('True'))], [If(BoolOp(And(), [Name('startline'), Name('indents')]), [Expr(Call(Name('toks_append'), [Subscript(Name('indents'), Index(UnaryOp(USub(), Num(1))))], [], None, None)), Assign([Name('startline')], Name('False'))], [])])
1 |
232 233 234 235 236 |
elif toknum in (NEWLINE, NL):
startline = True
elif startline and indents:
toks_append(indents[-1])
startline = False
|
2 |
221 222 223 224 225 |
elif toknum in (NEWLINE, NL):
startline = True
elif startline and indents:
toks_append(indents[-1])
startline = False
|
If(Attribute(Name('self'), 'reading'), [Expr(Call(Attribute(Attribute(Name('self'), 'text'), 'insert'), [Str('insert'), Str('\n')], [], None, None)), Expr(Call(Attribute(Attribute(Name('self'), 'text'), 'see'), [Str('insert')], [], None, None))], [Expr(Call(Attribute(Name('self'), 'newline_and_indent_event'), [Name('event')], [], None, None))])
1 |
1067 1068 1069 1070 1071 |
if self.reading:
self.text.insert("insert", "\n")
self.text.see("insert")
else:
self.newline_and_indent_event(event)
|
2 |
1124 1125 1126 1127 1128 |
if self.reading:
self.text.insert("insert", "\n")
self.text.see("insert")
else:
self.newline_and_indent_event(event)
|
If(Compare(Attribute(Name('self'), '_resizemode'), [Eq()], [Str('noresize')]), [Assign([Name('w')], Num(1))], [If(Compare(Attribute(Name('self'), '_resizemode'), [Eq()], [Str('auto')]), [Assign([Name('w')], Attribute(Name('self'), '_pensize'))], [Assign([Name('w')], Attribute(Name('self'), '_outlinewidth'))])])
1 |
2998 2999 3000 |
if self._resizemode == "noresize": w = 1
elif self._resizemode == "auto": w = self._pensize
else: w =self._outlinewidth
|
2 |
3048 3049 3050 |
if self._resizemode == "noresize": w = 1
elif self._resizemode == "auto": w = self._pensize
else: w =self._outlinewidth
|
If(Attribute(Name('self'), 'softspace'), [Assign([Attribute(Name('self'), 'hard_break'), Attribute(Name('self'), 'para_end'), Attribute(Name('self'), 'softspace')], Num(0)), Assign([Attribute(Name('self'), 'nospace')], Num(1)), Expr(Call(Attribute(Attribute(Name('self'), 'writer'), 'send_flowing_data'), [Str(' ')], [], None, None))], [])
1 |
233 234 235 236 |
if self.softspace:
self.hard_break = self.para_end = self.softspace = 0
self.nospace = 1
self.writer.send_flowing_data(' ')
|
2 |
278 279 280 281 |
if self.softspace:
self.hard_break = self.para_end = self.softspace = 0
self.nospace = 1
self.writer.send_flowing_data(' ')
|
If(Call(Name('isinstance'), [Name('k'), Name('bytes')], [], None, None), [Assign([Name('k')], Call(Name('quote_plus'), [Name('k'), Name('safe')], [], None, None))], [Assign([Name('k')], Call(Name('quote_plus'), [Call(Name('str'), [Name('k')], [], None, None), Name('safe'), Name('encoding'), Name('errors')], [], None, None))])
1 |
770 771 772 773 |
if isinstance(k, bytes):
k = quote_plus(k, safe)
else:
k = quote_plus(str(k), safe, encoding, errors)
|
2 |
782 783 784 785 |
if isinstance(k, bytes):
k = quote_plus(k, safe)
else:
k = quote_plus(str(k), safe, encoding, errors)
|
If(BoolOp(And(), [Compare(Call(Attribute(Name('attr'), 'lower'), [], [], None, None), [Eq()], [Str('type')]), Compare(Name('value'), [In()], [Tuple([Str('a'), Str('A'), Str('i'), Str('I'), Str('d'), Str('D')])])]), [Assign([Name('type')], Call(Attribute(Name('value'), 'upper'), [], [], None, None))], [])
1 |
1347 1348 1349 |
if attr.lower() == 'type' and \
value in ('a', 'A', 'i', 'I', 'd', 'D'):
type = value.upper()
|
2 |
1833 1834 1835 |
if attr.lower() == 'type' and \
value in ('a', 'A', 'i', 'I', 'd', 'D'):
type = value.upper()
|
If(Compare(Name('data'), [Is()], [Name('None')]), [Return(Call(Call(Name('getattr'), [Name('self'), Name('name')], [], None, None), [Name('url'), Name('realm')], [], None, None))], [Return(Call(Call(Name('getattr'), [Name('self'), Name('name')], [], None, None), [Name('url'), Name('realm'), Name('data')], [], None, None))])
1 |
1983 1984 1985 1986 |
if data is None:
return getattr(self,name)(url, realm)
else:
return getattr(self,name)(url, realm, data)
|
2 |
2009 2010 2011 2012 |
if data is None:
return getattr(self,name)(url, realm)
else:
return getattr(self,name)(url, realm, data)
|
If(Compare(Attribute(Name('self'), '_tzinfo'), [IsNot()], [Name('None')]), [Assert(Compare(Subscript(Name('s'), Slice(UnaryOp(USub(), Num(1)), None, None)), [Eq()], [Str(')')]), None), Assign([Name('s')], BinOp(BinOp(Subscript(Name('s'), Slice(None, UnaryOp(USub(), Num(1)), None)), Add(), BinOp(Str(', tzinfo=%r'), Mod(), Attribute(Name('self'), '_tzinfo'))), Add(), Str(')')))], [])
1 |
1172 1173 1174 |
if self._tzinfo is not None:
assert s[-1:] == ")"
s = s[:-1] + ", tzinfo=%r" % self._tzinfo + ")"
|
2 |
1559 1560 1561 |
if self._tzinfo is not None:
assert s[-1:] == ")"
s = s[:-1] + ", tzinfo=%r" % self._tzinfo + ")"
|
For(Name('i'), Call(Name('range'), [Num(5)], [], None, None), [Expr(Call(Name('forward'), [Num(20)], [], None, None)), Expr(Call(Name('left'), [Num(90)], [], None, None)), Expr(Call(Name('forward'), [Num(20)], [], None, None)), Expr(Call(Name('right'), [Num(90)], [], None, None))], [])
1 |
4016 4017 4018 4019 4020 |
for i in range(5):
forward(20)
left(90)
forward(20)
right(90)
|
2 |
4024 4025 4026 4027 4028 |
for i in range(5):
forward(20)
left(90)
forward(20)
right(90)
|
Return(Tuple([Call(Attribute(Name('self'), 'getnchannels'), [], [], None, None), Call(Attribute(Name('self'), 'getsampwidth'), [], [], None, None), Call(Attribute(Name('self'), 'getframerate'), [], [], None, None), Call(Attribute(Name('self'), 'getnframes'), [], [], None, None), Call(Attribute(Name('self'), 'getcomptype'), [], [], None, None), Call(Attribute(Name('self'), 'getcompname'), [], [], None, None)]))
1 |
374 375 376 |
return self.getnchannels(), self.getsampwidth(), \
self.getframerate(), self.getnframes(), \
self.getcomptype(), self.getcompname()
|
2 |
245 246 247 |
return self.getnchannels(), self.getsampwidth(), \
self.getframerate(), self.getnframes(), \
self.getcomptype(), self.getcompname()
|
3 |
384 385 386 |
return self.getnchannels(), self.getsampwidth(), \
self.getframerate(), self.getnframes(), \
self.getcomptype(), self.getcompname()
|
4 |
209 210 211 |
return self.getnchannels(), self.getsampwidth(), \
self.getframerate(), self.getnframes(), \
self.getcomptype(), self.getcompname()
|
Tuple([BinOp(Call(Attribute(Attribute(Name('self'), 'cv'), 'canvasx'), [Attribute(Name('event'), 'x')], [], None, None), Div(), Attribute(Name('self'), 'xscale')), BinOp(UnaryOp(USub(), Call(Attribute(Attribute(Name('self'), 'cv'), 'canvasy'), [Attribute(Name('event'), 'y')], [], None, None)), Div(), Attribute(Name('self'), 'yscale'))])
1 |
615 616 |
x, y = (self.cv.canvasx(event.x)/self.xscale,
-self.cv.canvasy(event.y)/self.yscale)
|
2 |
633 634 |
x, y = (self.cv.canvasx(event.x)/self.xscale,
-self.cv.canvasy(event.y)/self.yscale)
|
3 |
653 654 |
x, y = (self.cv.canvasx(event.x)/self.xscale,
-self.cv.canvasy(event.y)/self.yscale)
|
4 |
673 674 |
x, y = (self.cv.canvasx(event.x)/self.xscale,
-self.cv.canvasy(event.y)/self.yscale)
|
TryExcept([Assign([Subscript(Attribute(Name('self'), 'subwidget_list'), Index(Str('tick')))], Call(Name('_dummyButton'), [Name('self'), Str('tick')], [], None, None)), Assign([Subscript(Attribute(Name('self'), 'subwidget_list'), Index(Str('cross')))], Call(Name('_dummyButton'), [Name('self'), Str('cross')], [], None, None))], [ExceptHandler(Name('TypeError'), None, [Pass()])], [])
1 |
600 601 602 603 604 605 |
try:
self.subwidget_list['tick'] = _dummyButton(self, 'tick')
self.subwidget_list['cross'] = _dummyButton(self, 'cross')
except TypeError:
# unavailable when -fancy not specified
pass
|
2 |
1693 1694 1695 1696 1697 1698 1699 |
try:
self.subwidget_list['tick'] = _dummyButton(self, 'tick')
#cross Button : present if created with the fancy option
self.subwidget_list['cross'] = _dummyButton(self, 'cross')
except TypeError:
# unavailable when -fancy not specified
pass
|
TryExcept([Assign([Name('v')], Call(Name('int'), [Name('v')], [], None, None))], [ExceptHandler(Name('ValueError'), None, [Assign([Subscript(Name('done'), Index(Name('n')))], Call(Attribute(Name('v'), 'replace'), [Str('$$'), Str('$')], [], None, None))])], [Assign([Subscript(Name('done'), Index(Name('n')))], Name('v'))])
1 |
324 325 326 327 328 329 330 |
try:
v = int(v)
except ValueError:
# insert literal `$'
done[n] = v.replace('$$', '$')
else:
done[n] = v
|
2 |
256 257 258 259 260 261 262 |
try:
v = int(v)
except ValueError:
# insert literal `$'
done[n] = v.replace('$$', '$')
else:
done[n] = v
|
FunctionDef('before_get', arguments([arg('self', None), arg('parser', None), arg('section', None), arg('option', None), arg('value', None), arg('defaults', None)], None, None, [], None, None, [], []), [Assign([Name('L')], List([])), Expr(Call(Attribute(Name('self'), '_interpolate_some'), [Name('parser'), Name('option'), Name('L'), Name('value'), Name('section'), Name('defaults'), Num(1)], [], None, None)), Return(Call(Attribute(Str(''), 'join'), [Name('L')], [], None, None))], [], None)
1 |
389 390 391 392 |
def before_get(self, parser, section, option, value, defaults):
L = []
self._interpolate_some(parser, option, L, value, section, defaults, 1)
return ''.join(L)
|
2 |
449 450 451 452 |
def before_get(self, parser, section, option, value, defaults):
L = []
self._interpolate_some(parser, option, L, value, section, defaults, 1)
return ''.join(L)
|
BoolOp(And(), [UnaryOp(Not(), Name('skipkeys')), Name('ensure_ascii'), Name('check_circular'), Name('allow_nan'), Compare(Name('cls'), [Is()], [Name('None')]), Compare(Name('indent'), [Is()], [Name('None')]), Compare(Name('separators'), [Is()], [Name('None')]), Compare(Name('default'), [Is()], [Name('None')]), UnaryOp(Not(), Name('kw'))])
1 |
164 165 166 167 |
if (not skipkeys and ensure_ascii and
check_circular and allow_nan and
cls is None and indent is None and separators is None and
default is None and not kw):
|
2 |
222 223 224 225 |
if (not skipkeys and ensure_ascii and
check_circular and allow_nan and
cls is None and indent is None and separators is None and
default is None and not kw):
|
If(BoolOp(Or(), [BoolOp(And(), [Compare(Str('['), [In()], [Name('netloc')]), Compare(Str(']'), [NotIn()], [Name('netloc')])]), BoolOp(And(), [Compare(Str(']'), [In()], [Name('netloc')]), Compare(Str('['), [NotIn()], [Name('netloc')])])]), [Raise(Call(Name('ValueError'), [Str('Invalid IPv6 URL')], [], None, None), None)], [])
1 |
334 335 336 |
if (('[' in netloc and ']' not in netloc) or
(']' in netloc and '[' not in netloc)):
raise ValueError("Invalid IPv6 URL")
|
2 |
357 358 359 |
if (('[' in netloc and ']' not in netloc) or
(']' in netloc and '[' not in netloc)):
raise ValueError("Invalid IPv6 URL")
|
If(Compare(Attribute(Name('newChild'), 'nodeType'), [NotIn()], [Attribute(Name('self'), '_child_node_types')]), [Raise(Call(Attribute(Attribute(Name('xml'), 'dom'), 'HierarchyRequestErr'), [BinOp(Str('%s cannot be child of %s'), Mod(), Tuple([Call(Name('repr'), [Name('newChild')], [], None, None), Call(Name('repr'), [Name('self')], [], None, None)]))], [], None, None), None)], [])
1 |
87 88 89 |
if newChild.nodeType not in self._child_node_types:
raise xml.dom.HierarchyRequestErr(
"%s cannot be child of %s" % (repr(newChild), repr(self)))
|
2 |
135 136 137 |
if newChild.nodeType not in self._child_node_types:
raise xml.dom.HierarchyRequestErr(
"%s cannot be child of %s" % (repr(newChild), repr(self)))
|
While(Name('True'), [TryExcept([Assign([Name('k')], Call(Name('RegEnumKey'), [Name('handle'), Name('i')], [], None, None))], [ExceptHandler(Name('RegError'), None, [Break()])], []), Expr(Call(Attribute(Name('L'), 'append'), [Name('k')], [], None, None)), AugAssign(Name('i'), Add(), Num(1))], [])
1 |
81 82 83 84 85 86 87 |
while True:
try:
k = RegEnumKey(handle, i)
except RegError:
break
L.append(k)
i += 1
|
2 |
63 64 65 66 67 68 69 |
while True:
try:
k = RegEnumKey(handle, i)
except RegError:
break
L.append(k)
i += 1
|
If(UnaryOp(Not(), Call(Name('isinstance'), [Name('other'), Name('Set')], [], None, None)), [If(UnaryOp(Not(), Call(Name('isinstance'), [Name('other'), Name('Iterable')], [], None, None)), [Return(Name('NotImplemented'))], []), Assign([Name('other')], Call(Attribute(Name('self'), '_from_iterable'), [Name('other')], [], None, None))], [])
1 |
229 230 231 232 |
if not isinstance(other, Set):
if not isinstance(other, Iterable):
return NotImplemented
other = self._from_iterable(other)
|
2 |
237 238 239 240 |
if not isinstance(other, Set):
if not isinstance(other, Iterable):
return NotImplemented
other = self._from_iterable(other)
|
FunctionDef('delete', arguments([arg('self', None), arg('name', None)], None, None, [], None, None, [], []), [Expr(Call(Attribute(Attribute(Name('self'), 'tk'), 'call'), [Attribute(Name('self'), '_w'), Str('delete'), Name('name')], [], None, None)), Expr(Call(Attribute(Subscript(Attribute(Name('self'), 'subwidget_list'), Index(Name('name'))), 'destroy'), [], [], None, None)), Delete([Subscript(Attribute(Name('self'), 'subwidget_list'), Index(Name('name')), Del())])], [], None)
1 |
1169 1170 1171 1172 |
def delete(self, name):
self.tk.call(self._w, 'delete', name)
self.subwidget_list[name].destroy()
del self.subwidget_list[name]
|
2 |
1244 1245 1246 1247 |
def delete(self, name):
self.tk.call(self._w, 'delete', name)
self.subwidget_list[name].destroy()
del self.subwidget_list[name]
|
For(Tuple([Name('name'), Name('value')]), Name('items'), [If(UnaryOp(Not(), Call(Attribute(Name('name'), 'startswith'), [Str('_')], [], None, None)), [Expr(Call(Attribute(Name('temp'), 'append'), [BinOp(Str('%s=%r'), Mod(), Tuple([Name('name'), Name('value')]))], [], None, None))], [])], [])
1 |
122 123 124 |
for name, value in items:
if not name.startswith('_'):
temp.append('%s=%r' % (name, value))
|
2 |
944 945 946 |
for name, value in items:
if not name.startswith('_'):
temp.append('%s=%r' % (name, value))
|
ClassDef('Codec', [Attribute(Name('codecs'), 'Codec')], [], None, None, [FunctionDef('encode', arguments([arg('self', None), arg('input', None), arg('errors', None)], None, None, [], None, None, [Str('strict')], []), [Return(Call(Attribute(Name('codecs'), 'charmap_encode'), [Name('input'), Name('errors'), Name('encoding_table')], [], None, None))], [], None), FunctionDef('decode', arguments([arg('self', None), arg('input', None), arg('errors', None)], None, None, [], None, None, [Str('strict')], []), [Return(Call(Attribute(Name('codecs'), 'charmap_decode'), [Name('input'), Name('errors'), Name('decoding_table')], [], None, None))], [], None)], [])
1 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
2 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
3 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
4 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
5 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
6 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
7 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
8 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
9 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
10 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
11 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
12 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
13 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
14 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
15 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
16 |
11 12 13 14 15 16 17 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
17 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
18 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
19 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
20 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
21 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
22 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
23 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
24 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
25 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
26 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
27 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
28 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
29 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
30 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
31 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
32 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
33 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
34 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
35 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
36 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
37 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
38 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
39 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
40 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
41 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
42 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
43 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
44 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
45 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
46 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
ClassDef('Codec', [Attribute(Name('codecs'), 'Codec')], [], None, None, [FunctionDef('encode', arguments([arg('self', None), arg('input', None), arg('errors', None)], None, None, [], None, None, [Str('strict')], []), [Return(Call(Attribute(Name('codecs'), 'charmap_encode'), [Name('input'), Name('errors'), Name('encoding_map')], [], None, None))], [], None), FunctionDef('decode', arguments([arg('self', None), arg('input', None), arg('errors', None)], None, None, [], None, None, [Str('strict')], []), [Return(Call(Attribute(Name('codecs'), 'charmap_decode'), [Name('input'), Name('errors'), Name('decoding_table')], [], None, None))], [], None)], [])
1 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_map)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
2 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_map)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
3 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_map)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
4 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_map)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
5 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_map)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
6 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_map)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
7 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_map)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
8 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_map)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
9 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_map)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
10 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_map)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
11 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_map)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
12 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_map)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
13 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_map)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
14 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_map)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
15 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_map)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
16 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_map)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
17 |
9 10 11 12 13 14 15 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_map)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_table)
|
ClassDef('Codec', [Attribute(Name('codecs'), 'Codec')], [], None, None, [FunctionDef('encode', arguments([arg('self', None), arg('input', None), arg('errors', None)], None, None, [], None, None, [Str('strict')], []), [Return(Call(Attribute(Name('codecs'), 'charmap_encode'), [Name('input'), Name('errors'), Name('encoding_map')], [], None, None))], [], None), FunctionDef('decode', arguments([arg('self', None), arg('input', None), arg('errors', None)], None, None, [], None, None, [Str('strict')], []), [Return(Call(Attribute(Name('codecs'), 'charmap_decode'), [Name('input'), Name('errors'), Name('decoding_map')], [], None, None))], [], None)], [])
1 |
14 15 16 17 18 19 20 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_map)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_map)
|
2 |
14 15 16 17 18 19 20 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_map)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_map)
|
3 |
11 12 13 14 15 16 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_map)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_map)
|
4 |
14 15 16 17 18 19 20 |
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_map)
def decode(self,input,errors='strict'):
return codecs.charmap_decode(input,errors,decoding_map)
|
Tuple([Call(Attribute(Name('self'), 'getnchannels'), [], [], None, None), Call(Attribute(Name('self'), 'getsampwidth'), [], [], None, None), Call(Attribute(Name('self'), 'getframerate'), [], [], None, None), Call(Attribute(Name('self'), 'getnframes'), [], [], None, None), Call(Attribute(Name('self'), 'getcomptype'), [], [], None, None), Call(Attribute(Name('self'), 'getcompname'), [], [], None, None)])
1 |
374 375 376 |
return self.getnchannels(), self.getsampwidth(), \
self.getframerate(), self.getnframes(), \
self.getcomptype(), self.getcompname()
|
2 |
245 246 247 |
return self.getnchannels(), self.getsampwidth(), \
self.getframerate(), self.getnframes(), \
self.getcomptype(), self.getcompname()
|
3 |
384 385 386 |
return self.getnchannels(), self.getsampwidth(), \
self.getframerate(), self.getnframes(), \
self.getcomptype(), self.getcompname()
|
4 |
209 210 211 |
return self.getnchannels(), self.getsampwidth(), \
self.getframerate(), self.getnframes(), \
self.getcomptype(), self.getcompname()
|
If(UnaryOp(Not(), Call(Name('isinstance'), [Name('date'), Tuple([Attribute(Name('datetime'), 'date'), Attribute(Name('datetime'), 'date')])], [], None, None)), [Raise(Call(Name('TypeError'), [Call(Attribute(Str("the date parameter must be a date or datetime object, not '{:40}'"), 'format'), [Attribute(Attribute(Name('date'), '__class__'), '__name__')], [], None, None)], [], None, None), None)], [])
1 |
550 551 552 553 |
if not isinstance(date, (datetime.date, datetime.date)):
raise TypeError(
"the date parameter must be a date or datetime object, "
"not '{:40}'".format(date.__class__.__name__))
|
2 |
567 568 569 570 |
if not isinstance(date, (datetime.date, datetime.date)):
raise TypeError(
"the date parameter must be a date or datetime object, "
"not '{:40}'".format(date.__class__.__name__))
|
For(Name('p'), Name('paths'), [Assign([Name('np')], Call(Attribute(Attribute(Name('os'), 'path'), 'normpath'), [Name('p')], [], None, None)), If(Compare(Name('np'), [NotIn()], [Name('reduced_paths')]), [Expr(Call(Attribute(Name('reduced_paths'), 'append'), [Name('np')], [], None, None))], [])], [])
1 |
198 199 200 201 202 |
for p in paths:
np = os.path.normpath(p)
# XXX(nnorwitz): O(n**2), if reduced_paths gets long perhaps use a set.
if np not in reduced_paths:
reduced_paths.append(np)
|
2 |
189 190 191 192 193 |
for p in paths:
np = os.path.normpath(p)
# XXX(nnorwitz): O(n**2), if reduced_paths gets long perhaps use a set.
if np not in reduced_paths:
reduced_paths.append(np)
|
FunctionDef('getmark', arguments([arg('self', None), arg('id', None)], None, None, [], None, None, [], []), [For(Name('marker'), Attribute(Name('self'), '_markers'), [If(Compare(Name('id'), [Eq()], [Subscript(Name('marker'), Index(Num(0)))]), [Return(Name('marker'))], [])], []), Raise(Call(Name('Error'), [Call(Attribute(Str('marker {0!r} does not exist'), 'format'), [Name('id')], [], None, None)], [], None, None), None)], [], None)
1 |
383 384 385 386 387 |
def getmark(self, id):
for marker in self._markers:
if id == marker[0]:
return marker
raise Error('marker {0!r} does not exist'.format(id))
|
2 |
665 666 667 668 669 |
def getmark(self, id):
for marker in self._markers:
if id == marker[0]:
return marker
raise Error('marker {0!r} does not exist'.format(id))
|
If(BoolOp(Or(), [Compare(Name('tzinfo'), [Is()], [Name('None')]), Call(Name('isinstance'), [Name('tzinfo'), Name('_tzinfo_class')], [], None, None)]), [Assign([Attribute(Name('self'), '_tzinfo')], Name('tzinfo'))], [Raise(Call(Name('TypeError'), [BinOp(Str('bad tzinfo state arg %r'), Mod(), Name('tzinfo'))], [], None, None), None)])
1 |
1288 1289 1290 1291 |
if tzinfo is None or isinstance(tzinfo, _tzinfo_class):
self._tzinfo = tzinfo
else:
raise TypeError("bad tzinfo state arg %r" % tzinfo)
|
2 |
1761 1762 1763 1764 |
if tzinfo is None or isinstance(tzinfo, _tzinfo_class):
self._tzinfo = tzinfo
else:
raise TypeError("bad tzinfo state arg %r" % tzinfo)
|
If(Compare(Name('nargs'), [Eq()], [Num(1)]), [Assign([Name('value')], Call(Attribute(Name('rargs'), 'pop'), [Num(0)], [], None, None))], [Assign([Name('value')], Call(Name('tuple'), [Subscript(Name('rargs'), Slice(Num(0), Name('nargs'), None))], [], None, None)), Delete([Subscript(Name('rargs'), Slice(Num(0), Name('nargs'), None), Del())])])
1 |
1491 1492 1493 1494 1495 |
elif nargs == 1:
value = rargs.pop(0)
else:
value = tuple(rargs[0:nargs])
del rargs[0:nargs]
|
2 |
1530 1531 1532 1533 1534 |
elif nargs == 1:
value = rargs.pop(0)
else:
value = tuple(rargs[0:nargs])
del rargs[0:nargs]
|
While(Compare(Name('i'), [Lt()], [Name('num_existing')]), [If(Compare(Subscript(Subscript(Name('existing'), Index(Name('i'))), Slice(None, Name('pflen'), None)), [Eq()], [Name('prefixed')]), [Expr(Call(Attribute(Name('child_loggers'), 'append'), [Subscript(Name('existing'), Index(Name('i')))], [], None, None))], []), AugAssign(Name('i'), Add(), Num(1))], [])
1 |
233 234 235 236 |
while i < num_existing:
if existing[i][:pflen] == prefixed:
child_loggers.append(existing[i])
i += 1
|
2 |
603 604 605 606 |
while i < num_existing:
if existing[i][:pflen] == prefixed:
child_loggers.append(existing[i])
i += 1
|
FunctionDef('add_flag', arguments([arg('self', None), arg('flag', None)], None, None, [], None, None, [], []), [Expr(Str('Set the given flag(s) without changing others.')), Expr(Call(Attribute(Name('self'), 'set_flags'), [Call(Attribute(Str(''), 'join'), [BinOp(Call(Name('set'), [Call(Attribute(Name('self'), 'get_flags'), [], [], None, None)], [], None, None), BitOr(), Call(Name('set'), [Name('flag')], [], None, None))], [], None, None)], [], None, None))], [], None)
1 |
1512 1513 1514 |
def add_flag(self, flag):
"""Set the given flag(s) without changing others."""
self.set_flags(''.join(set(self.get_flags()) | set(flag)))
|
2 |
1637 1638 1639 |
def add_flag(self, flag):
"""Set the given flag(s) without changing others."""
self.set_flags(''.join(set(self.get_flags()) | set(flag)))
|
If(UnaryOp(Not(), Name('args')), [Assign([Name('mapping')], Name('kws'))], [If(Name('kws'), [Assign([Name('mapping')], Call(Name('_multimap'), [Name('kws'), Subscript(Name('args'), Index(Num(0)))], [], None, None))], [Assign([Name('mapping')], Subscript(Name('args'), Index(Num(0))))])])
1 |
116 117 118 119 120 121 |
if not args:
mapping = kws
elif kws:
mapping = _multimap(kws, args[0])
else:
mapping = args[0]
|
2 |
142 143 144 145 146 147 |
if not args:
mapping = kws
elif kws:
mapping = _multimap(kws, args[0])
else:
mapping = args[0]
|
TryExcept([Assign([Tuple([Name('value'), Name('end')])], Call(Name('scan_once'), [Name('s'), Name('end')], [], None, None))], [ExceptHandler(Name('StopIteration'), None, [Raise(Call(Name('ValueError'), [Call(Name('errmsg'), [Str('Expecting object'), Name('s'), Name('end')], [], None, None)], [], None, None), None)])], [])
1 |
197 198 199 200 |
try:
value, end = scan_once(s, end)
except StopIteration:
raise ValueError(errmsg("Expecting object", s, end))
|
2 |
240 241 242 243 |
try:
value, end = scan_once(s, end)
except StopIteration:
raise ValueError(errmsg("Expecting object", s, end))
|
If(Compare(Subscript(Name('buf'), Slice(UnaryOp(USub(), Num(2)), None, None)), [NotEq()], [Name('B_CRLF')]), [If(Compare(Subscript(Name('buf'), Index(UnaryOp(USub(), Num(1)))), [In()], [Name('B_CRLF')]), [Assign([Name('buf')], Subscript(Name('buf'), Slice(None, UnaryOp(USub(), Num(1)), None)))], []), Assign([Name('buf')], BinOp(Name('buf'), Add(), Name('B_CRLF')))], [])
1 |
494 495 496 |
if buf[-2:] != B_CRLF:
if buf[-1] in B_CRLF: buf = buf[:-1]
buf = buf + B_CRLF
|
2 |
779 780 781 |
if buf[-2:] != B_CRLF:
if buf[-1] in B_CRLF: buf = buf[:-1]
buf = buf + B_CRLF
|
If(Call(Name('isinstance'), [Name('x'), Name('tuple')], [], None, None), [Assign([Name('pos')], Call(Name('Vec2D'), [], [], Name('x'), None))], [If(Call(Name('isinstance'), [Name('x'), Name('TNavigator')], [], None, None), [Assign([Name('pos')], Attribute(Name('x'), '_position'))], [])])
1 |
1847 1848 1849 1850 |
elif isinstance(x, tuple):
pos = Vec2D(*x)
elif isinstance(x, TNavigator):
pos = x._position
|
2 |
1879 1880 1881 1882 |
elif isinstance(x, tuple):
pos = Vec2D(*x)
elif isinstance(x, TNavigator):
pos = x._position
|
If(Subscript(Attribute(Name('sys'), 'argv'), Slice(Num(1), None, None)), [Expr(Call(Name('testall'), [Subscript(Attribute(Name('sys'), 'argv'), Slice(Num(1), None, None)), Name('recursive'), Num(1)], [], None, None))], [Expr(Call(Name('testall'), [List([Str('.')]), Name('recursive'), Num(1)], [], None, None))])
1 |
126 127 128 129 |
if sys.argv[1:]:
testall(sys.argv[1:], recursive, 1)
else:
testall(['.'], recursive, 1)
|
2 |
207 208 209 210 |
if sys.argv[1:]:
testall(sys.argv[1:], recursive, 1)
else:
testall(['.'], recursive, 1)
|
For(Tuple([Name('elem'), Name('count')]), Call(Attribute(Name('other'), 'items'), [], [], None, None), [If(BoolOp(And(), [Compare(Name('elem'), [NotIn()], [Name('self')]), Compare(Name('count'), [Gt()], [Num(0)])]), [Assign([Subscript(Name('result'), Index(Name('elem')))], Name('count'))], [])], [])
1 |
616 617 618 |
for elem, count in other.items():
if elem not in self and count > 0:
result[elem] = count
|
2 |
655 656 657 |
for elem, count in other.items():
if elem not in self and count > 0:
result[elem] = count
|
If(Compare(Name('topad'), [Gt()], [Num(0)]), [Assign([Name('rotdig')], BinOp(BinOp(Str('0'), Mult(), Name('topad')), Add(), Name('rotdig')))], [If(Compare(Name('topad'), [Lt()], [Num(0)]), [Assign([Name('rotdig')], Subscript(Name('rotdig'), Slice(UnaryOp(USub(), Name('topad')), None, None)))], [])])
1 |
3586 3587 3588 3589 |
if topad > 0:
rotdig = '0'*topad + rotdig
elif topad < 0:
rotdig = rotdig[-topad:]
|
2 |
3644 3645 3646 3647 |
if topad > 0:
rotdig = '0'*topad + rotdig
elif topad < 0:
rotdig = rotdig[-topad:]
|
If(BinOp(Name('coeff'), Mod(), BinOp(Num(5), Mult(), BinOp(Num(10), Pow(), BinOp(BinOp(Call(Name('len'), [Call(Name('str'), [Call(Name('abs'), [Name('coeff')], [], None, None)], [], None, None)], [], None, None), Sub(), Name('p')), Sub(), Num(1))))), [Break()], [])
1 |
3158 3159 |
if coeff % (5*10**(len(str(abs(coeff)))-p-1)):
break
|
2 |
3239 3240 |
if coeff % (5*10**(len(str(abs(coeff)))-p-1)):
break
|
BoolOp(And(), [Compare(Name('end'), [Gt()], [Num(0)]), BinOp(BinOp(Call(Attribute(Name('s'), 'count'), [Str('"'), Num(0), Name('end')], [], None, None), Sub(), Call(Attribute(Name('s'), 'count'), [Str('\\"'), Num(0), Name('end')], [], None, None)), Mod(), Num(2))])
1 |
294 |
while end > 0 and (s.count('"', 0, end) - s.count('\\"', 0, end)) % 2:
|
2 |
99 |
while end > 0 and (s.count('"', 0, end) - s.count('\\"', 0, end)) % 2:
|
Assign([Name('nhops')], BinOp(Num(1), Add(), Call(Name('int'), [BinOp(BinOp(Name('diffsq'), Pow(), Num(0.5)), Div(), BinOp(BinOp(Num(3), Mult(), BinOp(Num(1.1), Pow(), Attribute(Name('self'), '_speed'))), Mult(), Attribute(Name('self'), '_speed')))], [], None, None)))
1 |
3160 |
nhops = 1+int((diffsq**0.5)/(3*(1.1**self._speed)*self._speed))
|
2 |
3219 |
nhops = 1+int((diffsq**0.5)/(3*(1.1**self._speed)*self._speed))
|
If(Compare(Subscript(Name('path'), Slice(None, Num(1), None)), [Eq()], [Str('/')]), [Assign([Name('path')], BinOp(Str('.'), Add(), Name('path'))), Expr(Call(Attribute(Name('warnings'), 'warn'), [BinOp(Str('This search is broken in 1.3 and earlier, and will be fixed in a future version. If you rely on the current behaviour, change it to %r'), Mod(), Name('path')), Name('FutureWarning')], [keyword('stacklevel', Num(2))], None, None))], [])
1 |
718 719 720 721 722 723 724 |
if path[:1] == "/":
path = "." + path
warnings.warn(
"This search is broken in 1.3 and earlier, and will be "
"fixed in a future version. If you rely on the current "
"behaviour, change it to %r" % path,
FutureWarning, stacklevel=2
|
2 |
743 744 745 746 747 748 749 |
if path[:1] == "/":
path = "." + path
warnings.warn(
"This search is broken in 1.3 and earlier, and will be "
"fixed in a future version. If you rely on the current "
"behaviour, change it to %r" % path,
FutureWarning, stacklevel=2
|
3 |
765 766 767 768 769 770 771 |
if path[:1] == "/":
path = "." + path
warnings.warn(
"This search is broken in 1.3 and earlier, and will be "
"fixed in a future version. If you rely on the current "
"behaviour, change it to %r" % path,
FutureWarning, stacklevel=2
|
4 |
787 788 789 790 791 792 793 |
if path[:1] == "/":
path = "." + path
warnings.warn(
"This search is broken in 1.3 and earlier, and will be "
"fixed in a future version. If you rely on the current "
"behaviour, change it to %r" % path,
FutureWarning, stacklevel=2
|
Expr(Call(Attribute(Name('UnixCCompiler'), 'link'), [Name('self'), Name('target_desc'), Name('objects'), Name('output_filename'), Name('output_dir'), Name('libraries'), Name('library_dirs'), Name('runtime_library_dirs'), Name('None'), Name('debug'), Name('extra_preargs'), Name('extra_postargs'), Name('build_temp'), Name('target_lang')], [], None, None))
1 |
239 240 241 242 243 244 |
UnixCCompiler.link(self, target_desc, objects, output_filename,
output_dir, libraries, library_dirs,
runtime_library_dirs,
None, # export_symbols, we do this in our def-file
debug, extra_preargs, extra_postargs, build_temp,
target_lang)
|
2 |
159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
UnixCCompiler.link(self,
target_desc,
objects,
output_filename,
output_dir,
libraries,
library_dirs,
runtime_library_dirs,
None, # export_symbols, we do this in our def-file
debug,
extra_preargs,
extra_postargs,
build_temp,
target_lang)
|
If(BoolOp(Or(), [Compare(Name('sources'), [Is()], [Name('None')]), UnaryOp(Not(), Call(Name('isinstance'), [Name('sources'), Tuple([Name('list'), Name('tuple')])], [], None, None))]), [Raise(Call(Name('DistutilsSetupError'), [BinOp(Str("in 'libraries' option (library '%s'), 'sources' must be present and must be a list of source filenames"), Mod(), Name('lib_name'))], [], None, None), None)], [])
1 |
171 172 173 174 175 |
if sources is None or not isinstance(sources, (list, tuple)):
raise DistutilsSetupError(
"in 'libraries' option (library '%s'), "
"'sources' must be present and must be "
"a list of source filenames" % lib_name)
|
2 |
184 185 186 187 188 |
if sources is None or not isinstance(sources, (list, tuple)):
raise DistutilsSetupError(
"in 'libraries' option (library '%s'), "
"'sources' must be present and must be "
"a list of source filenames" % lib_name)
|
If(Compare(Name('archs'), [Eq()], [Tuple([Str('i386'), Str('ppc'), Str('ppc64'), Str('x86_64')])]), [Assign([Name('machine')], Str('universal'))], [Raise(Call(Name('ValueError'), [BinOp(Str("Don't know machine value for archs=%r"), Mod(), Tuple([Name('archs')]))], [], None, None), None)])
1 |
165 166 167 168 169 |
elif archs == ('i386', 'ppc', 'ppc64', 'x86_64'):
machine = 'universal'
else:
raise ValueError(
"Don't know machine value for archs=%r"%(archs,))
|
2 |
745 746 747 748 749 |
elif archs == ('i386', 'ppc', 'ppc64', 'x86_64'):
machine = 'universal'
else:
raise ValueError(
"Don't know machine value for archs=%r"%(archs,))
|
If(Call(Name('isinstance'), [Name('message'), Attribute(Name('io'), 'StringIO')], [], None, None), [Expr(Call(Attribute(Name('warnings'), 'warn'), [Str('Use of StringIO input is deprecated, use BytesIO instead'), Name('DeprecationWarning'), Num(3)], [], None, None)), Assign([Name('message')], Call(Attribute(Name('message'), 'getvalue'), [], [], None, None))], [])
1 |
223 224 225 226 |
if isinstance(message, io.StringIO):
warnings.warn("Use of StringIO input is deprecated, "
"use BytesIO instead", DeprecationWarning, 3)
message = message.getvalue()
|
2 |
1396 1397 1398 1399 |
if isinstance(message, io.StringIO):
warnings.warn("Use of StringIO input is deprecated, "
"use BytesIO instead", DeprecationWarning, 3)
message = message.getvalue()
|
TryExcept([Assign([Name('value')], Call(Name('int'), [Name('value')], [], None, None))], [ExceptHandler(Name('ValueError'), None, [Assign([Subscript(Name('done'), Index(Name('name')))], Call(Attribute(Name('value'), 'strip'), [], [], None, None))])], [Assign([Subscript(Name('done'), Index(Name('name')))], Name('value'))])
1 |
372 373 374 375 376 |
try: value = int(value)
except ValueError:
done[name] = value.strip()
else:
done[name] = value
|
2 |
308 309 310 311 312 313 |
try:
value = int(value)
except ValueError:
done[name] = value.strip()
else:
done[name] = value
|
If(Compare(Attribute(Name('self'), 'define'), [IsNot()], [Name('None')]), [For(Tuple([Name('name'), Name('value')]), Attribute(Name('self'), 'define'), [Expr(Call(Attribute(Attribute(Name('self'), 'compiler'), 'define_macro'), [Name('name'), Name('value')], [], None, None))], [])], [])
1 |
107 108 109 110 |
if self.define is not None:
# 'define' option is a list of (name,value) tuples
for (name,value) in self.define:
self.compiler.define_macro(name, value)
|
2 |
327 328 329 330 |
if self.define is not None:
# 'define' option is a list of (name,value) tuples
for (name, value) in self.define:
self.compiler.define_macro(name, value)
|
If(Compare(Name('output_dir'), [Is()], [Name('None')]), [Assign([Name('output_dir')], Attribute(Name('self'), 'output_dir'))], [If(UnaryOp(Not(), Call(Name('isinstance'), [Name('output_dir'), Name('str')], [], None, None)), [Raise(Call(Name('TypeError'), [Str("'output_dir' must be a string or None")], [], None, None), None)], [])])
1 |
372 373 374 375 |
if output_dir is None:
output_dir = self.output_dir
elif not isinstance(output_dir, str):
raise TypeError("'output_dir' must be a string or None")
|
2 |
420 421 422 423 |
if output_dir is None:
output_dir = self.output_dir
elif not isinstance(output_dir, str):
raise TypeError("'output_dir' must be a string or None")
|
If(Name('selfdot'), [Expr(Call(Attribute(Name('results'), 'append'), [BinOp(Str('self.<strong>%s</strong>'), Mod(), Name('name'))], [], None, None))], [Expr(Call(Attribute(Name('results'), 'append'), [Call(Attribute(Name('self'), 'namelink'), [Name('name'), Name('classes')], [], None, None)], [], None, None))])
1 |
572 573 574 575 |
elif selfdot:
results.append('self.<strong>%s</strong>' % name)
else:
results.append(self.namelink(name, classes))
|
2 |
736 737 738 739 |
elif selfdot:
results.append('self.<strong>%s</strong>' % name)
else:
results.append(self.namelink(name, classes))
|
If(Name('deep'), [For(Name('child'), Attribute(Name('node'), 'childNodes'), [Assign([Name('c')], Call(Name('_clone_node'), [Name('child'), Name('deep'), Name('newOwnerDocument')], [], None, None)), Expr(Call(Attribute(Name('clone'), 'appendChild'), [Name('c')], [], None, None))], [])], [])
1 |
1861 1862 1863 1864 |
if deep:
for child in node.childNodes:
c = _clone_node(child, deep, newOwnerDocument)
clone.appendChild(c)
|
2 |
1868 1869 1870 1871 |
if deep:
for child in node.childNodes:
c = _clone_node(child, deep, newOwnerDocument)
clone.appendChild(c)
|