code stringlengths 1 1.49M | vector listlengths 0 7.38k | snippet listlengths 0 7.38k |
|---|---|---|
# Copyright 2007 Google, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""Fixer for callable().
This converts callable(obj) into isinstance(obj, collections.Callable), adding a
collections import if needed."""
# Local imports
from lib2to3 import fixer_base
from lib2to3.fixer_util import ... | [
[
8,
0,
0.1528,
0.1111,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.2778,
0.0278,
0,
0.66,
0.3333,
617,
0,
1,
0,
0,
617,
0,
0
],
[
1,
0,
0.3056,
0.0278,
0,
0.66... | [
"\"\"\"Fixer for callable().\n\nThis converts callable(obj) into isinstance(obj, collections.Callable), adding a\ncollections import if needed.\"\"\"",
"from lib2to3 import fixer_base",
"from lib2to3.fixer_util import Call, Name, String, Attr, touch_import",
"class FixCallable(fixer_base.BaseFix):\n\n BM_c... |
"""Fix function attribute names (f.func_x -> f.__x__)."""
# Author: Collin Winter
# Local imports
from .. import fixer_base
from ..fixer_util import Name
class FixFuncattrs(fixer_base.BaseFix):
BM_compatible = True
PATTERN = """
power< any+ trailer< '.' attr=('func_closure' | 'func_doc' | 'func_glo... | [
[
8,
0,
0.0417,
0.0417,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.2083,
0.0417,
0,
0.66,
0.3333,
0,
0,
1,
0,
0,
0,
0,
0
],
[
1,
0,
0.25,
0.0417,
0,
0.66,
... | [
"\"\"\"Fix function attribute names (f.func_x -> f.__x__).\"\"\"",
"from .. import fixer_base",
"from ..fixer_util import Name",
"class FixFuncattrs(fixer_base.BaseFix):\n\n BM_compatible = True\n \n PATTERN = \"\"\"\n power< any+ trailer< '.' attr=('func_closure' | 'func_doc' | 'func_globals'\n ... |
# Copyright 2007 Google, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""Fixer that changes map(F, ...) into list(map(F, ...)) unless there
exists a 'from future_builtins import map' statement in the top-level
namespace.
As a special case, map(None, X) is changed into list(X). (This is
... | [
[
8,
0,
0.1304,
0.1848,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.25,
0.0109,
0,
0.66,
0.2,
607,
0,
1,
0,
0,
607,
0,
0
],
[
1,
0,
0.2609,
0.0109,
0,
0.66,
... | [
"\"\"\"Fixer that changes map(F, ...) into list(map(F, ...)) unless there\nexists a 'from future_builtins import map' statement in the top-level\nnamespace.\n\nAs a special case, map(None, X) is changed into list(X). (This is\nnecessary because the semantics are changed in this case -- the new\nmap(None, X) is equ... |
# Copyright 2006 Google, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""Fixer that transforms `xyzzy` into repr(xyzzy)."""
# Local imports
from .. import fixer_base
from ..fixer_util import Call, Name, parenthesize
class FixRepr(fixer_base.BaseFix):
BM_compatible = True
PATT... | [
[
8,
0,
0.1667,
0.0417,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.2917,
0.0417,
0,
0.66,
0.3333,
0,
0,
1,
0,
0,
0,
0,
0
],
[
1,
0,
0.3333,
0.0417,
0,
0.66,
... | [
"\"\"\"Fixer that transforms `xyzzy` into repr(xyzzy).\"\"\"",
"from .. import fixer_base",
"from ..fixer_util import Call, Name, parenthesize",
"class FixRepr(fixer_base.BaseFix):\n\n BM_compatible = True\n\n PATTERN = \"\"\"\n atom < '`' expr=any '`' >\n \"\"\"",
" BM_co... |
# Copyright 2006 Google, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""Refactoring framework.
Used as a main program, this can refactor any number of files and/or
recursively descend down directories. Imported as a module, this
provides infrastructure to write your own refactoring too... | [
[
8,
0,
0.0088,
0.0081,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0149,
0.0014,
0,
0.66,
0.0385,
777,
0,
1,
0,
0,
777,
0,
0
],
[
14,
0,
0.0176,
0.0014,
0,
0.6... | [
"\"\"\"Refactoring framework.\n\nUsed as a main program, this can refactor any number of files and/or\nrecursively descend down directories. Imported as a module, this\nprovides infrastructure to write your own refactoring tool.\n\"\"\"",
"from __future__ import with_statement",
"__author__ = \"Guido van Rossu... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
print u'ßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ'
def f(x):
print '%s\t-> α(%2i):%s β(%s)'
| [
[
8,
0,
0.5,
0.1667,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
],
[
2,
0,
0.9167,
0.3333,
0,
0.66,
1,
899,
0,
1,
0,
0,
0,
0,
1
],
[
8,
1,
1,
0.1667,
1,
0.05,
0,
... | [
"print(u'ßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ')",
"def f(x):\n print('%s\\t-> α(%2i):%s β(%s)')",
" print('%s\\t-> α(%2i):%s β(%s)')"
] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
print u'ßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ'
def f(x):
print '%s\t-> α(%2i):%s β(%s)'
| [
[
8,
0,
0.5,
0.1667,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
],
[
2,
0,
0.9167,
0.3333,
0,
0.66,
1,
899,
0,
1,
0,
0,
0,
0,
1
],
[
8,
1,
1,
0.1667,
1,
0.68,
0,
... | [
"print(u'ßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ')",
"def f(x):\n print('%s\\t-> α(%2i):%s β(%s)')",
" print('%s\\t-> α(%2i):%s β(%s)')"
] |
# Python test set -- part 1, grammar.
# This just tests whether the parser accepts them all.
# NOTE: When you run this test as a script from the command line, you
# get warnings about certain hex/oct constants. Since those are
# issued by the parser, you can't suppress them by adding a
# filterwarnings() call to this... | [
[
1,
0,
0.0119,
0.0011,
0,
0.66,
0,
364,
0,
2,
0,
0,
364,
0,
0
],
[
1,
0,
0.013,
0.0011,
0,
0.66,
0.1429,
88,
0,
1,
0,
0,
88,
0,
0
],
[
1,
0,
0.0141,
0.0011,
0,
0.6... | [
"from test.support import run_unittest, check_syntax_error",
"import unittest",
"import sys",
"from sys import *",
"class TokenTests(unittest.TestCase):\n\n def testBackslash(self):\n # Backslash means line continuation:\n x = 1 \\\n + 1\n self.assertEquals(x, 2, 'backslash fo... |
# coding: utf-8
print "BOM BOOM!"
| [
[
8,
0,
0.5,
0.5,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"print(\"BOM BOOM!\")"
] |
print "hi"
print "Like bad Windows newlines?"
| [
[
8,
0,
0.3333,
0.3333,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
],
[
8,
0,
1,
0.3333,
0,
0.66,
1,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"print(\"hi\")",
"print(\"Like bad Windows newlines?\")"
] |
# This file is used to verify that 2to3 falls back to a slower, iterative pattern matching
# scheme in the event that the faster recursive system fails due to infinite recursion.
from ctypes import *
STRING = c_char_p
OSUnknownByteOrder = 0
UIT_PROMPT = 1
P_PGID = 2
P_PID = 1
UIT_ERROR = 5
UIT_INFO = 4
UIT_NONE = 0
P... | [
[
1,
0,
0.0011,
0.0004,
0,
0.66,
0,
182,
0,
1,
0,
0,
182,
0,
0
],
[
14,
0,
0.0015,
0.0004,
0,
0.66,
0.0014,
560,
2,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.0026,
0.0004,
0,
... | [
"from ctypes import *",
"STRING = c_char_p",
"OSUnknownByteOrder = 0",
"UIT_PROMPT = 1",
"P_PGID = 2",
"P_PID = 1",
"UIT_ERROR = 5",
"UIT_INFO = 4",
"UIT_NONE = 0",
"P_ALL = 0",
"UIT_VERIFY = 2",
"OSBigEndian = 2",
"UIT_BOOLEAN = 3",
"OSLittleEndian = 1",
"__darwin_nl_item = c_int",
"_... |
def parrot():
pass
| [
[
2,
0,
0.75,
1,
0,
0.66,
0,
862,
0,
0,
0,
0,
0,
0,
0
]
] | [
"def parrot():\n pass"
] |
# This is empty so trying to fetch the fixer class gives an AttributeError
| [] | [] |
from lib2to3.fixer_base import BaseFix
from lib2to3.fixer_util import Name
class FixParrot(BaseFix):
"""
Change functions named 'parrot' to 'cheese'.
"""
PATTERN = """funcdef < 'def' name='parrot' any* >"""
def transform(self, node, results):
name = results["name"]
name.replace(Na... | [
[
1,
0,
0.0769,
0.0769,
0,
0.66,
0,
67,
0,
1,
0,
0,
67,
0,
0
],
[
1,
0,
0.1538,
0.0769,
0,
0.66,
0.5,
500,
0,
1,
0,
0,
500,
0,
0
],
[
3,
0,
0.6538,
0.7692,
0,
0.66,... | [
"from lib2to3.fixer_base import BaseFix",
"from lib2to3.fixer_util import Name",
"class FixParrot(BaseFix):\n \"\"\"\n Change functions named 'parrot' to 'cheese'.\n \"\"\"\n\n PATTERN = \"\"\"funcdef < 'def' name='parrot' any* >\"\"\"\n\n def transform(self, node, results):",
" \"\"\"\n ... |
from lib2to3.fixer_base import BaseFix
class FixPreorder(BaseFix):
order = "pre"
def match(self, node): return False
| [
[
1,
0,
0.1667,
0.1667,
0,
0.66,
0,
67,
0,
1,
0,
0,
67,
0,
0
],
[
3,
0,
0.75,
0.6667,
0,
0.66,
1,
216,
0,
1,
0,
0,
343,
0,
0
],
[
14,
1,
0.6667,
0.1667,
1,
0.48,
... | [
"from lib2to3.fixer_base import BaseFix",
"class FixPreorder(BaseFix):\n order = \"pre\"\n\n def match(self, node): return False",
" order = \"pre\"",
" def match(self, node): return False",
" def match(self, node): return False"
] |
from lib2to3.fixer_base import BaseFix
class FixLast(BaseFix):
run_order = 10
def match(self, node): return False
| [
[
1,
0,
0.1429,
0.1429,
0,
0.66,
0,
67,
0,
1,
0,
0,
67,
0,
0
],
[
3,
0,
0.7143,
0.7143,
0,
0.66,
1,
615,
0,
1,
0,
0,
343,
0,
0
],
[
14,
1,
0.7143,
0.1429,
1,
0.54,
... | [
"from lib2to3.fixer_base import BaseFix",
"class FixLast(BaseFix):\n\n run_order = 10\n\n def match(self, node): return False",
" run_order = 10",
" def match(self, node): return False",
" def match(self, node): return False"
] |
from lib2to3.fixer_base import BaseFix
class FixFirst(BaseFix):
run_order = 1
def match(self, node): return False
| [
[
1,
0,
0.1667,
0.1667,
0,
0.66,
0,
67,
0,
1,
0,
0,
67,
0,
0
],
[
3,
0,
0.75,
0.6667,
0,
0.66,
1,
280,
0,
1,
0,
0,
343,
0,
0
],
[
14,
1,
0.6667,
0.1667,
1,
0.4,
... | [
"from lib2to3.fixer_base import BaseFix",
"class FixFirst(BaseFix):\n run_order = 1\n\n def match(self, node): return False",
" run_order = 1",
" def match(self, node): return False",
" def match(self, node): return False"
] |
from lib2to3.fixer_base import BaseFix
class FixExplicit(BaseFix):
explicit = True
def match(self): return False
| [
[
1,
0,
0.1667,
0.1667,
0,
0.66,
0,
67,
0,
1,
0,
0,
67,
0,
0
],
[
3,
0,
0.75,
0.6667,
0,
0.66,
1,
884,
0,
1,
0,
0,
343,
0,
0
],
[
14,
1,
0.6667,
0.1667,
1,
0.45,
... | [
"from lib2to3.fixer_base import BaseFix",
"class FixExplicit(BaseFix):\n explicit = True\n\n def match(self): return False",
" explicit = True",
" def match(self): return False",
" def match(self): return False"
] |
from lib2to3.fixer_base import BaseFix
class FixBadOrder(BaseFix):
order = "crazy"
| [
[
1,
0,
0.2,
0.2,
0,
0.66,
0,
67,
0,
1,
0,
0,
67,
0,
0
],
[
3,
0,
0.8,
0.6,
0,
0.66,
1,
233,
0,
0,
0,
0,
343,
0,
0
],
[
14,
1,
1,
0.2,
1,
0.47,
0,
234,
... | [
"from lib2to3.fixer_base import BaseFix",
"class FixBadOrder(BaseFix):\n\n order = \"crazy\"",
" order = \"crazy\""
] |
#!/usr/bin/env python3
# Copyright 2006 Google, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""Main program for testing the infrastructure."""
__author__ = "Guido van Rossum <guido@python.org>"
# Support imports (need to be imported first)
from . import support
# Python imports
import... | [
[
8,
0,
0.0543,
0.0109,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.0761,
0.0109,
0,
0.66,
0.0833,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.1087,
0.0109,
0,
0.66,... | [
"\"\"\"Main program for testing the infrastructure.\"\"\"",
"__author__ = \"Guido van Rossum <guido@python.org>\"",
"from . import support",
"import os",
"import sys",
"import logging",
"from .. import pytree",
"import pgen2",
"from pgen2 import driver",
"logging.basicConfig()",
"def main():\n ... |
"""Support code for test_*.py files"""
# Author: Collin Winter
# Python imports
import unittest
import sys
import os
import os.path
import re
from textwrap import dedent
# Local imports
from lib2to3 import pytree, refactor
from lib2to3.pgen2 import driver
test_dir = os.path.dirname(__file__)
proj_dir = os.path.normp... | [
[
8,
0,
0.0185,
0.0185,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0926,
0.0185,
0,
0.66,
0.0526,
88,
0,
1,
0,
0,
88,
0,
0
],
[
1,
0,
0.1111,
0.0185,
0,
0.66,
... | [
"\"\"\"Support code for test_*.py files\"\"\"",
"import unittest",
"import sys",
"import os",
"import os.path",
"import re",
"from textwrap import dedent",
"from lib2to3 import pytree, refactor",
"from lib2to3.pgen2 import driver",
"test_dir = os.path.dirname(__file__)",
"proj_dir = os.path.norm... |
#!/usr/bin/env python3
# Copyright 2006 Google, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""Main program for testing the infrastructure."""
__author__ = "Guido van Rossum <guido@python.org>"
# Support imports (need to be imported first)
from . import support
# Python imports
import... | [
[
8,
0,
0.0543,
0.0109,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.0761,
0.0109,
0,
0.66,
0.0833,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.1087,
0.0109,
0,
0.66,... | [
"\"\"\"Main program for testing the infrastructure.\"\"\"",
"__author__ = \"Guido van Rossum <guido@python.org>\"",
"from . import support",
"import os",
"import sys",
"import logging",
"from .. import pytree",
"import pgen2",
"from pgen2 import driver",
"logging.basicConfig()",
"def main():\n ... |
"""Make tests/ into a package. This allows us to "import tests" and
have tests.all_tests be a TestSuite representing all test cases
from all test_*.py files in tests/."""
# Author: Collin Winter
import os
import os.path
import unittest
import types
from . import support
all_tests = unittest.TestSuite()
tests_dir = ... | [
[
8,
0,
0.0833,
0.125,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.25,
0.0417,
0,
0.66,
0.1,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.2917,
0.0417,
0,
0.66,
... | [
"\"\"\"Make tests/ into a package. This allows us to \"import tests\" and\nhave tests.all_tests be a TestSuite representing all test cases\nfrom all test_*.py files in tests/.\"\"\"",
"import os",
"import os.path",
"import unittest",
"import types",
"from . import support",
"all_tests = unittest.TestSui... |
#empty
| [] | [] |
from __future__ import with_statement
from flask import Flask, request, session, g, redirect, url_for, abort, jsonify
import sqlite3
from contextlib import closing
import os
#config
DATABASE = './data/notel.db'
DEBUG = True
SECRET_KEY = 'notel_dev'
app = Flask(__name__)
app.config.from_object(__name__)
app.config.fro... | [
[
1,
0,
0.0115,
0.0115,
0,
0.66,
0,
777,
0,
1,
0,
0,
777,
0,
0
],
[
1,
0,
0.023,
0.0115,
0,
0.66,
0.0556,
782,
0,
8,
0,
0,
782,
0,
0
],
[
1,
0,
0.0345,
0.0115,
0,
0... | [
"from __future__ import with_statement",
"from flask import Flask, request, session, g, redirect, url_for, abort, jsonify",
"import sqlite3",
"from contextlib import closing",
"import os",
"DATABASE = './data/notel.db'",
"DEBUG = True",
"SECRET_KEY = 'notel_dev'",
"app = Flask(__name__)",
"app.con... |
import os
import sys
import warnings
import opcode # opcode is not a virtualenv module, so we can use it to find the stdlib
# Important! To work on pypy, this must be a module that resides in the
# lib-python/modified-x.y.z directory
dirname = os.path.dirname
distutils_path = os.path.join... | [
[
1,
0,
0.0103,
0.0103,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.0206,
0.0103,
0,
0.66,
0.0417,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0309,
0.0103,
0,
... | [
"import os",
"import sys",
"import warnings",
"import opcode # opcode is not a virtualenv module, so we can use it to find the stdlib",
"dirname = os.path.dirname",
"distutils_path = os.path.join(os.path.dirname(opcode.__file__), 'distutils')",
"if os.path.normpath(distutils_path) == os.path.dirname(os.... |
"""Append module search paths for third-party packages to sys.path.
****************************************************************
* This module is automatically imported during initialization. *
****************************************************************
In earlier versions of Python (up to 1.5a3), scripts or... | [
[
8,
0,
0.0441,
0.0868,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0896,
0.0014,
0,
0.66,
0.0256,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0909,
0.0014,
0,
0.66... | [
"\"\"\"Append module search paths for third-party packages to sys.path.\n\n****************************************************************\n* This module is automatically imported during initialization. *\n****************************************************************\n\nIn earlier versions of Python (up to 1.5a... |
#!/usr/bin/python
# Copyright 2011 Google, Inc. All Rights Reserved.
# simple script to walk source tree looking for third-party licenses
# dumps resulting html page to stdout
import os, re, mimetypes, sys
# read source directories to scan from command line
SOURCE = sys.argv[1:]
# regex to find /* */ style commen... | [
[
1,
0,
0.0816,
0.0102,
0,
0.66,
0,
688,
0,
4,
0,
0,
688,
0,
0
],
[
14,
0,
0.1224,
0.0102,
0,
0.66,
0.0714,
792,
6,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.1531,
0.0102,
0,
... | [
"import os, re, mimetypes, sys",
"SOURCE = sys.argv[1:]",
"COMMENT_BLOCK = re.compile(r\"(/\\*.+?\\*/)\", re.MULTILINE | re.DOTALL)",
"COMMENT_LICENSE = re.compile(r\"(license)\", re.IGNORECASE)",
"COMMENT_COPYRIGHT = re.compile(r\"(copyright)\", re.IGNORECASE)",
"EXCLUDE_TYPES = [\n \"application/xml\... |
# Copyright 2006 Google, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""Base class for fixers (optional, but recommended)."""
# Python imports
import logging
import itertools
# Local imports
from .patcomp import PatternCompiler
from . import pygram
from .fixer_util import does_tree_imp... | [
[
8,
0,
0.0209,
0.0052,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0366,
0.0052,
0,
0.66,
0.125,
715,
0,
1,
0,
0,
715,
0,
0
],
[
1,
0,
0.0419,
0.0052,
0,
0.66,... | [
"\"\"\"Base class for fixers (optional, but recommended).\"\"\"",
"import logging",
"import itertools",
"from .patcomp import PatternCompiler",
"from . import pygram",
"from .fixer_util import does_tree_import",
"from . import node_sm",
"class BaseFix(object):\n\n \"\"\"Optional base class for fixe... |
"""Utility functions, node construction macros, etc."""
# Author: Collin Winter
# Local imports
from .pgen2 import token
from .pytree import Leaf, Node
from .pygram import python_symbols as syms
from . import patcomp
###########################################################
### Common node-construction "macros"
##... | [
[
8,
0,
0.0024,
0.0024,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0119,
0.0024,
0,
0.66,
0.0238,
607,
0,
1,
0,
0,
607,
0,
0
],
[
1,
0,
0.0143,
0.0024,
0,
0.66... | [
"\"\"\"Utility functions, node construction macros, etc.\"\"\"",
"from .pgen2 import token",
"from .pytree import Leaf, Node",
"from .pygram import python_symbols as syms",
"from . import patcomp",
"def KeywordArg(keyword, value):\n return Node(syms.argument,\n [keyword, Leaf(token.EQUAL... |
# Copyright 2007 Google, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""Fixer that changes buffer(...) into memoryview(...)."""
# Local imports
from .. import fixer_base
from ..fixer_util import Name
class FixBuffer(fixer_base.BaseFix):
#TODO Matt: Change this back after testing
... | [
[
8,
0,
0.1905,
0.0476,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.3333,
0.0476,
0,
0.66,
0.3333,
0,
0,
1,
0,
0,
0,
0,
0
],
[
1,
0,
0.381,
0.0476,
0,
0.66,
... | [
"\"\"\"Fixer that changes buffer(...) into memoryview(...).\"\"\"",
"from .. import fixer_base",
"from ..fixer_util import Name",
"class FixBuffer(fixer_base.BaseFix):\n #TODO Matt: Change this back after testing\n #explicit = True # The user must ask for this fixer\n\n PATTERN = \"\"\"\n ... |
"""Fixer for it.next() -> next(it), per PEP 3114."""
# Author: Collin Winter
# Things that currently aren't covered:
# - listcomp "next" names aren't warned
# - "with" statement targets aren't checked
# Local imports
from ..pgen2 import token
from ..pygram import python_symbols as syms
from .. import fixer_base
f... | [
[
8,
0,
0.0098,
0.0098,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0882,
0.0098,
0,
0.66,
0.1111,
607,
0,
1,
0,
0,
607,
0,
0
],
[
1,
0,
0.098,
0.0098,
0,
0.66,... | [
"\"\"\"Fixer for it.next() -> next(it), per PEP 3114.\"\"\"",
"from ..pgen2 import token",
"from ..pygram import python_symbols as syms",
"from .. import fixer_base",
"from ..fixer_util import Name, Call, find_binding",
"bind_warning = \"Calls to builtin next() possibly shadowed by global binding\"",
"c... |
# Dummy file to make this directory a package.
| [] | [] |
# Copyright 2010 G. M. Bond. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""
State machine based node matcher.
"""
EPSILON = 0 #Empty transition
TYPE = 1 #Transition based on type
STRING = 2 #Transition based on string matching
ANY = 3 #Transition matches any node
CLOSE = 4 #Transi... | [
[
8,
0,
0.0368,
0.0221,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.0588,
0.0074,
0,
0.66,
0.1429,
602,
1,
0,
0,
0,
0,
1,
0
],
[
14,
0,
0.0662,
0.0074,
0,
0.66... | [
"\"\"\"\nState machine based node matcher.\n\"\"\"",
"EPSILON = 0 #Empty transition",
"TYPE = 1 #Transition based on type",
"STRING = 2 #Transition based on string matching",
"ANY = 3 #Transition matches any node",
"CLOSE = 4 #Transition matches end of specific node",
"class Pattern_Matcher(ob... |
# Copyright 2006 Google, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""
Python parse tree definitions.
This is a very concrete parse tree; we need to keep every token and
even the comments and whitespace between tokens.
There's also a pattern matching implementation here.
"""
__autho... | [
[
8,
0,
0.0069,
0.0074,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.012,
0.0009,
0,
0.66,
0.0556,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.0138,
0.0009,
0,
0.66,
... | [
"\"\"\"\nPython parse tree definitions.\n\nThis is a very concrete parse tree; we need to keep every token and\neven the comments and whitespace between tokens.\n\nThere's also a pattern matching implementation here.\n\"\"\"",
"__author__ = \"Guido van Rossum <guido@python.org>\"",
"import sys",
"import warni... |
# coding: utf-8
print "BOM BOOM!"
| [
[
8,
0,
0.5,
0.5,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"print(\"BOM BOOM!\")"
] |
# This file is used to verify that 2to3 falls back to a slower, iterative pattern matching
# scheme in the event that the faster recursive system fails due to infinite recursion.
from ctypes import *
STRING = c_char_p
OSUnknownByteOrder = 0
UIT_PROMPT = 1
P_PGID = 2
P_PID = 1
UIT_ERROR = 5
UIT_INFO = 4
UIT_NONE = 0
P... | [
[
1,
0,
0.0011,
0.0004,
0,
0.66,
0,
182,
0,
1,
0,
0,
182,
0,
0
],
[
14,
0,
0.0015,
0.0004,
0,
0.66,
0.0014,
560,
2,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.0026,
0.0004,
0,
... | [
"from ctypes import *",
"STRING = c_char_p",
"OSUnknownByteOrder = 0",
"UIT_PROMPT = 1",
"P_PGID = 2",
"P_PID = 1",
"UIT_ERROR = 5",
"UIT_INFO = 4",
"UIT_NONE = 0",
"P_ALL = 0",
"UIT_VERIFY = 2",
"OSBigEndian = 2",
"UIT_BOOLEAN = 3",
"OSLittleEndian = 1",
"__darwin_nl_item = c_int",
"_... |
from lib2to3.fixer_base import BaseFix
from lib2to3.fixer_util import Name
class FixParrot(BaseFix):
"""
Change functions named 'parrot' to 'cheese'.
"""
PATTERN = """funcdef < 'def' name='parrot' any* >"""
def transform(self, node, results):
name = results["name"]
name.replace(Na... | [
[
1,
0,
0.0769,
0.0769,
0,
0.66,
0,
67,
0,
1,
0,
0,
67,
0,
0
],
[
1,
0,
0.1538,
0.0769,
0,
0.66,
0.5,
500,
0,
1,
0,
0,
500,
0,
0
],
[
3,
0,
0.6538,
0.7692,
0,
0.66,... | [
"from lib2to3.fixer_base import BaseFix",
"from lib2to3.fixer_util import Name",
"class FixParrot(BaseFix):\n \"\"\"\n Change functions named 'parrot' to 'cheese'.\n \"\"\"\n\n PATTERN = \"\"\"funcdef < 'def' name='parrot' any* >\"\"\"\n\n def transform(self, node, results):",
" \"\"\"\n ... |
from lib2to3.fixer_base import BaseFix
class FixLast(BaseFix):
run_order = 10
def match(self, node): return False
| [
[
1,
0,
0.1429,
0.1429,
0,
0.66,
0,
67,
0,
1,
0,
0,
67,
0,
0
],
[
3,
0,
0.7143,
0.7143,
0,
0.66,
1,
615,
0,
1,
0,
0,
343,
0,
0
],
[
14,
1,
0.7143,
0.1429,
1,
0.72,
... | [
"from lib2to3.fixer_base import BaseFix",
"class FixLast(BaseFix):\n\n run_order = 10\n\n def match(self, node): return False",
" run_order = 10",
" def match(self, node): return False",
" def match(self, node): return False"
] |
from lib2to3.fixer_base import BaseFix
class FixPreorder(BaseFix):
order = "pre"
def match(self, node): return False
| [
[
1,
0,
0.1667,
0.1667,
0,
0.66,
0,
67,
0,
1,
0,
0,
67,
0,
0
],
[
3,
0,
0.75,
0.6667,
0,
0.66,
1,
216,
0,
1,
0,
0,
343,
0,
0
],
[
14,
1,
0.6667,
0.1667,
1,
0.61,
... | [
"from lib2to3.fixer_base import BaseFix",
"class FixPreorder(BaseFix):\n order = \"pre\"\n\n def match(self, node): return False",
" order = \"pre\"",
" def match(self, node): return False",
" def match(self, node): return False"
] |
from lib2to3.fixer_base import BaseFix
class FixFirst(BaseFix):
run_order = 1
def match(self, node): return False
| [
[
1,
0,
0.1667,
0.1667,
0,
0.66,
0,
67,
0,
1,
0,
0,
67,
0,
0
],
[
3,
0,
0.75,
0.6667,
0,
0.66,
1,
280,
0,
1,
0,
0,
343,
0,
0
],
[
14,
1,
0.6667,
0.1667,
1,
0.15,
... | [
"from lib2to3.fixer_base import BaseFix",
"class FixFirst(BaseFix):\n run_order = 1\n\n def match(self, node): return False",
" run_order = 1",
" def match(self, node): return False",
" def match(self, node): return False"
] |
from lib2to3.fixer_base import BaseFix
class FixExplicit(BaseFix):
explicit = True
def match(self): return False
| [
[
1,
0,
0.1667,
0.1667,
0,
0.66,
0,
67,
0,
1,
0,
0,
67,
0,
0
],
[
3,
0,
0.75,
0.6667,
0,
0.66,
1,
884,
0,
1,
0,
0,
343,
0,
0
],
[
14,
1,
0.6667,
0.1667,
1,
0.25,
... | [
"from lib2to3.fixer_base import BaseFix",
"class FixExplicit(BaseFix):\n explicit = True\n\n def match(self): return False",
" explicit = True",
" def match(self): return False",
" def match(self): return False"
] |
def parrot():
pass
| [
[
2,
0,
0.75,
1,
0,
0.66,
0,
862,
0,
0,
0,
0,
0,
0,
0
]
] | [
"def parrot():\n pass"
] |
from lib2to3.fixer_base import BaseFix
class FixBadOrder(BaseFix):
order = "crazy"
| [
[
1,
0,
0.2,
0.2,
0,
0.66,
0,
67,
0,
1,
0,
0,
67,
0,
0
],
[
3,
0,
0.8,
0.6,
0,
0.66,
1,
233,
0,
0,
0,
0,
343,
0,
0
],
[
14,
1,
1,
0.2,
1,
0.62,
0,
234,
... | [
"from lib2to3.fixer_base import BaseFix",
"class FixBadOrder(BaseFix):\n\n order = \"crazy\"",
" order = \"crazy\""
] |
# This is empty so trying to fetch the fixer class gives an AttributeError
| [] | [] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
print u'ßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ'
def f(x):
print '%s\t-> α(%2i):%s β(%s)'
| [
[
8,
0,
0.5,
0.1667,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
],
[
2,
0,
0.9167,
0.3333,
0,
0.66,
1,
899,
0,
1,
0,
0,
0,
0,
1
],
[
8,
1,
1,
0.1667,
1,
0.39,
0,
... | [
"print(u'ßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ')",
"def f(x):\n print('%s\\t-> α(%2i):%s β(%s)')",
" print('%s\\t-> α(%2i):%s β(%s)')"
] |
# Python test set -- part 1, grammar.
# This just tests whether the parser accepts them all.
# NOTE: When you run this test as a script from the command line, you
# get warnings about certain hex/oct constants. Since those are
# issued by the parser, you can't suppress them by adding a
# filterwarnings() call to this... | [
[
1,
0,
0.0119,
0.0011,
0,
0.66,
0,
364,
0,
2,
0,
0,
364,
0,
0
],
[
1,
0,
0.013,
0.0011,
0,
0.66,
0.1429,
88,
0,
1,
0,
0,
88,
0,
0
],
[
1,
0,
0.0141,
0.0011,
0,
0.6... | [
"from test.support import run_unittest, check_syntax_error",
"import unittest",
"import sys",
"from sys import *",
"class TokenTests(unittest.TestCase):\n\n def testBackslash(self):\n # Backslash means line continuation:\n x = 1 \\\n + 1\n self.assertEquals(x, 2, 'backslash fo... |
print "hi"
print "Like bad Windows newlines?"
| [
[
8,
0,
0.3333,
0.3333,
0,
0.66,
0,
535,
3,
1,
0,
0,
0,
0,
1
],
[
8,
0,
1,
0.3333,
0,
0.66,
1,
535,
3,
1,
0,
0,
0,
0,
1
]
] | [
"print(\"hi\")",
"print(\"Like bad Windows newlines?\")"
] |
"""Support code for test_*.py files"""
# Author: Collin Winter
# Python imports
import unittest
import sys
import os
import os.path
import re
from textwrap import dedent
# Local imports
from lib2to3 import pytree, refactor
from lib2to3.pgen2 import driver
test_dir = os.path.dirname(__file__)
proj_dir = os.path.normp... | [
[
8,
0,
0.0185,
0.0185,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.0926,
0.0185,
0,
0.66,
0.0526,
88,
0,
1,
0,
0,
88,
0,
0
],
[
1,
0,
0.1111,
0.0185,
0,
0.66,
... | [
"\"\"\"Support code for test_*.py files\"\"\"",
"import unittest",
"import sys",
"import os",
"import os.path",
"import re",
"from textwrap import dedent",
"from lib2to3 import pytree, refactor",
"from lib2to3.pgen2 import driver",
"test_dir = os.path.dirname(__file__)",
"proj_dir = os.path.norm... |
"""Make tests/ into a package. This allows us to "import tests" and
have tests.all_tests be a TestSuite representing all test cases
from all test_*.py files in tests/."""
# Author: Collin Winter
import os
import os.path
import unittest
import types
from . import support
all_tests = unittest.TestSuite()
tests_dir = ... | [
[
8,
0,
0.0833,
0.125,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.25,
0.0417,
0,
0.66,
0.1,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.2917,
0.0417,
0,
0.66,
... | [
"\"\"\"Make tests/ into a package. This allows us to \"import tests\" and\nhave tests.all_tests be a TestSuite representing all test cases\nfrom all test_*.py files in tests/.\"\"\"",
"import os",
"import os.path",
"import unittest",
"import types",
"from . import support",
"all_tests = unittest.TestSui... |
# Copyright 2004-2005 Elemental Security, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
# Pgen imports
from . import grammar, token, tokenize
class PgenGrammar(grammar.Grammar):
pass
class ParserGenerator(object):
def __init__(self, filename, stream=None):
close_stream =... | [
[
1,
0,
0.013,
0.0026,
0,
0.66,
0,
0,
0,
3,
0,
0,
0,
0,
0
],
[
3,
0,
0.0194,
0.0052,
0,
0.66,
0.2,
344,
0,
0,
0,
0,
407,
0,
0
],
[
3,
0,
0.4469,
0.8446,
0,
0.66,
... | [
"from . import grammar, token, tokenize",
"class PgenGrammar(grammar.Grammar):\n pass",
"class ParserGenerator(object):\n\n def __init__(self, filename, stream=None):\n close_stream = None\n if stream is None:\n stream = open(filename)\n close_stream = stream.close\n ... |
#! /usr/bin/env python
"""Token constants (from "token.h")."""
# Taken from Python (r53757) and modified to include some tokens
# originally monkeypatched in by pgen2.tokenize
#--start constants--
ENDMARKER = 0
NAME = 1
NUMBER = 2
STRING = 3
NEWLINE = 4
INDENT = 5
DEDENT = 6
LPAR = 7
RPAR = 8
LSQB = 9
RSQB = 10
C... | [
[
8,
0,
0.0366,
0.0122,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.1098,
0.0122,
0,
0.66,
0.0159,
977,
1,
0,
0,
0,
0,
1,
0
],
[
14,
0,
0.122,
0.0122,
0,
0.66,... | [
"\"\"\"Token constants (from \"token.h\").\"\"\"",
"ENDMARKER = 0",
"NAME = 1",
"NUMBER = 2",
"STRING = 3",
"NEWLINE = 4",
"INDENT = 5",
"DEDENT = 6",
"LPAR = 7",
"RPAR = 8",
"LSQB = 9",
"RSQB = 10",
"COLON = 11",
"COMMA = 12",
"SEMI = 13",
"PLUS = 14",
"MINUS = 15",
"STAR = 16",
... |
# Copyright 2004-2005 Elemental Security, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""Safely evaluate Python string literals without using eval()."""
import re
simple_escapes = {"a": "\a",
"b": "\b",
"f": "\f",
"n": "\n",
... | [
[
8,
0,
0.0667,
0.0167,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1,
0.0167,
0,
0.66,
0.1667,
540,
0,
1,
0,
0,
540,
0,
0
],
[
14,
0,
0.2083,
0.1667,
0,
0.66,
... | [
"\"\"\"Safely evaluate Python string literals without using eval().\"\"\"",
"import re",
"simple_escapes = {\"a\": \"\\a\",\n \"b\": \"\\b\",\n \"f\": \"\\f\",\n \"n\": \"\\n\",\n \"r\": \"\\r\",\n \"t\": \"\\t\",\n ... |
# Copyright 2004-2005 Elemental Security, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""The pgen2 package."""
| [
[
8,
0,
1,
0.25,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
]
] | [
"\"\"\"The pgen2 package.\"\"\""
] |
# Copyright 2004-2005 Elemental Security, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""This module defines the data structures used to represent a grammar.
These are a bit arcane because they are derived from the data
structures used by Python's 'pgen' parser generator.
There's also ... | [
[
8,
0,
0.0462,
0.0543,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.087,
0.0054,
0,
0.66,
0.1667,
848,
0,
1,
0,
0,
848,
0,
0
],
[
1,
0,
0.1033,
0.0054,
0,
0.66,... | [
"\"\"\"This module defines the data structures used to represent a grammar.\n\nThese are a bit arcane because they are derived from the data\nstructures used by Python's 'pgen' parser generator.\n\nThere's also a table here mapping operators to their names in the\ntoken module; the Python tokenize module reports al... |
# Copyright 2006 Google, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""Export the Python grammar and symbols."""
# Python imports
import os
# Local imports
from .pgen2 import token
from .pgen2 import driver
from . import pytree
# The grammar file
_GRAMMAR_FILE = os.path.join(os.path.... | [
[
8,
0,
0.1143,
0.0286,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.2,
0.0286,
0,
0.66,
0.1111,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.2857,
0.0286,
0,
0.66,
... | [
"\"\"\"Export the Python grammar and symbols.\"\"\"",
"import os",
"from .pgen2 import token",
"from .pgen2 import driver",
"from . import pytree",
"_GRAMMAR_FILE = os.path.join(os.path.dirname(__file__), \"Grammar.txt\")",
"class Symbols(object):\n\n def __init__(self, grammar):\n \"\"\"Initi... |
#empty
| [] | [] |
#!/usr/bin/env python
import sys
from lib2to3.main import main
sys.exit(main("lib2to3.fixes"))
| [
[
1,
0,
0.4,
0.2,
0,
0.66,
0,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.6,
0.2,
0,
0.66,
0.5,
821,
0,
1,
0,
0,
821,
0,
0
],
[
8,
0,
1,
0.2,
0,
0.66,
1,
436,
... | [
"import sys",
"from lib2to3.main import main",
"sys.exit(main(\"lib2to3.fixes\"))"
] |
#!/usr/bin/env python2.5
"""
This is a benchmarking script to test the speed of 2to3's pattern matching
system. It's equivalent to "refactor.py -f all" for every Python module
in sys.modules, but without engaging the actual transformations.
"""
__author__ = "Collin Winter <collinw at gmail.com>"
# Python imports
impo... | [
[
8,
0,
0.069,
0.0862,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.1379,
0.0172,
0,
0.66,
0.0588,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.1897,
0.0172,
0,
0.66,
... | [
"\"\"\"\nThis is a benchmarking script to test the speed of 2to3's pattern matching\nsystem. It's equivalent to \"refactor.py -f all\" for every Python module\nin sys.modules, but without engaging the actual transformations.\n\"\"\"",
"__author__ = \"Collin Winter <collinw at gmail.com>\"",
"import os.path",
... |
#!/usr/bin/env python
"""Script that makes determining PATTERN for a new fix much easier.
Figuring out exactly what PATTERN I want for a given fixer class is
getting tedious. This script will step through each possible subtree
for a given string, allowing you to select which one you want. It will
then try to figure o... | [
[
8,
0,
0.224,
0.3958,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
14,
0,
0.4375,
0.0104,
0,
0.66,
0.0769,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.4688,
0.0104,
0,
0.66,
... | [
"\"\"\"Script that makes determining PATTERN for a new fix much easier.\n\nFiguring out exactly what PATTERN I want for a given fixer class is\ngetting tedious. This script will step through each possible subtree\nfor a given string, allowing you to select which one you want. It will\nthen try to figure out an appr... |
# Copyright 2010 G. M. Bond. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
__author__ = "G. Matthew Bond <gmattbond+python@gmail.com>"
import sys
import gvgen
from . import graph
class GvGraph(graph.Graph):
"""This is an implementation of the Graph class using GvGen."""
def __init__... | [
[
14,
0,
0.1429,
0.0357,
0,
0.66,
0,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.2143,
0.0357,
0,
0.66,
0.25,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.25,
0.0357,
0,
0.66,... | [
"__author__ = \"G. Matthew Bond <gmattbond+python@gmail.com>\"",
"import sys",
"import gvgen",
"from . import graph",
"class GvGraph(graph.Graph):\n\n \"\"\"This is an implementation of the Graph class using GvGen.\"\"\"\n\n def __init__(self):\n \"\"\"Set up the graph.\"\"\"\n self.grap... |
#!/usr/bin/env python
"""Main test file for 2to3.
Running "python test.py" will run all tests in tests/test_*.py.
"""
# Author: Collin Winter
import unittest
from lib2to3 import tests
import lib2to3.tests.support
from sys import exit, argv
if "-h" in argv or "--help" in argv or len(argv) > 2:
print "Usage: %s [... | [
[
8,
0,
0.1098,
0.0976,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.2195,
0.0244,
0,
0.66,
0.1429,
88,
0,
1,
0,
0,
88,
0,
0
],
[
1,
0,
0.2439,
0.0244,
0,
0.66,
... | [
"\"\"\"Main test file for 2to3.\n\nRunning \"python test.py\" will run all tests in tests/test_*.py.\n\"\"\"",
"import unittest",
"from lib2to3 import tests",
"import lib2to3.tests.support",
"from sys import exit, argv",
"if \"-h\" in argv or \"--help\" in argv or len(argv) > 2:\n print(\"Usage: %s [-h... |
#!/usr/bin/python
def buffer_examples():
x = buffer(y)
| [
[
2,
0,
0.875,
0.5,
0,
0.66,
0,
356,
0,
0,
0,
0,
0,
0,
1
],
[
14,
1,
1,
0.25,
1,
0.07,
0,
190,
3,
1,
0,
0,
640,
10,
1
]
] | [
"def buffer_examples():\n x = buffer(y)",
" x = buffer(y)"
] |
#!/usr/bin/env python
# Copyright 2010 G. M. Bond. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
#Python imports
import sys
import re
import graph
#import lib2to3.pytree as pytree
#For testing, let's just import one fixer by hand. Later this should take
# a list of fixers on the command lin... | [
[
1,
0,
0.0609,
0.0087,
0,
0.66,
0,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0696,
0.0087,
0,
0.66,
0.1667,
540,
0,
1,
0,
0,
540,
0,
0
],
[
1,
0,
0.087,
0.0087,
0,
0... | [
"import sys",
"import re",
"import graph",
"from lib2to3.fixes import fix_next",
"def graph_node(graph, node):\n ##For Nodes\n #print \"Doing: %s\" % node.__repr__\n #print \"Node ID: %d (%d children)\" % (id(node), len(node.children))\n #this = node\n #this = graph.newItem(\"%s\\\\nTYPE: %s\... |
# Copyright 2010 G. M. Bond. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
__author__ = "G. Matthew Bond <gmattbond+python@gmail.com>"
import sys
class Graph(object):
"""
Base class for adapting graphviz dot libraries for use in lib2to3.
This class provides the interface tha... | [
[
14,
0,
0.125,
0.0312,
0,
0.66,
0,
777,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.1875,
0.0312,
0,
0.66,
0.5,
509,
0,
1,
0,
0,
509,
0,
0
],
[
3,
0,
0.5781,
0.6875,
0,
0.66,... | [
"__author__ = \"G. Matthew Bond <gmattbond+python@gmail.com>\"",
"import sys",
"class Graph(object):\n \n \"\"\"\n Base class for adapting graphviz dot libraries for use in lib2to3.\n\n This class provides the interface that should be used for adapting a\n graphviz library for use with the graph_... |
#!/usr/bin/python
# Copyright (C) 2007-2009 Mihai Preda.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | [
[
14,
0,
0.2727,
0.3147,
0,
0.66,
0,
680,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.458,
0.042,
0,
0.66,
0.0625,
888,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.6014,
0.2308,
0,
0.6... | [
"bytecodesStr = '''RESERVED 0\nCONST 0\nCALL -1\nADD 2\nSUB 2\nMUL 2\nDIV 2\nMOD 2",
"builtins = \"\"\"rnd sqrt cbrt \nsin cos tan asin acos atan \nsinh cosh tanh asinh acosh atanh \nexp ln \nabs floor ceil sign min max \ngcd comb perm mod real imag\"\"\"",
"template = '''// This file is automatically generated... |
##############################################################################
#
# Copyright (c) 2006 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SO... | [
[
8,
0,
0.1364,
0.0496,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1736,
0.0083,
0,
0.66,
0.04,
688,
0,
5,
0,
0,
688,
0,
0
],
[
1,
0,
0.1818,
0.0083,
0,
0.66,
... | [
"\"\"\"Bootstrap a buildout-based project\n\nSimply run this script in a directory containing a buildout.cfg.\nThe script accepts buildout command-line options, so you can\nuse the -c option to specify an alternate configuration file.\n\"\"\"",
"import os, shutil, sys, tempfile, urllib2",
"from optparse import ... |
#!/usr/bin/python2.6
#
# Simple http server to emulate api.playfoursquare.com
import logging
import shutil
import sys
import urlparse
import SimpleHTTPServer
import BaseHTTPServer
class RequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
"""Handle playfoursquare.com requests, for testing."""
def do_GET(self... | [
[
1,
0,
0.0588,
0.0118,
0,
0.66,
0,
715,
0,
1,
0,
0,
715,
0,
0
],
[
1,
0,
0.0706,
0.0118,
0,
0.66,
0.125,
614,
0,
1,
0,
0,
614,
0,
0
],
[
1,
0,
0.0824,
0.0118,
0,
0... | [
"import logging",
"import shutil",
"import sys",
"import urlparse",
"import SimpleHTTPServer",
"import BaseHTTPServer",
"class RequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):\n \"\"\"Handle playfoursquare.com requests, for testing.\"\"\"\n\n def do_GET(self):\n logging.warn('do_GET: %s, %s',... |
#!/usr/bin/python
import os
import subprocess
import sys
BASEDIR = '../main/src/com/joelapenna/foursquare'
TYPESDIR = '../captures/types/v1'
captures = sys.argv[1:]
if not captures:
captures = os.listdir(TYPESDIR)
for f in captures:
basename = f.split('.')[0]
javaname = ''.join([c.capitalize() for c in basena... | [
[
1,
0,
0.1111,
0.037,
0,
0.66,
0,
688,
0,
1,
0,
0,
688,
0,
0
],
[
1,
0,
0.1481,
0.037,
0,
0.66,
0.1429,
394,
0,
1,
0,
0,
394,
0,
0
],
[
1,
0,
0.1852,
0.037,
0,
0.6... | [
"import os",
"import subprocess",
"import sys",
"BASEDIR = '../main/src/com/joelapenna/foursquare'",
"TYPESDIR = '../captures/types/v1'",
"captures = sys.argv[1:]",
"if not captures:\n captures = os.listdir(TYPESDIR)",
" captures = os.listdir(TYPESDIR)",
"for f in captures:\n basename = f.split('... |
#!/usr/bin/python
"""
Pull a oAuth protected page from foursquare.
Expects ~/.oget to contain (one on each line):
CONSUMER_KEY
CONSUMER_KEY_SECRET
USERNAME
PASSWORD
Don't forget to chmod 600 the file!
"""
import httplib
import os
import re
import sys
import urllib
import urllib2
import urlparse
import user
from xml.... | [
[
8,
0,
0.0631,
0.0991,
0,
0.66,
0,
0,
1,
0,
0,
0,
0,
0,
0
],
[
1,
0,
0.1261,
0.009,
0,
0.66,
0.05,
2,
0,
1,
0,
0,
2,
0,
0
],
[
1,
0,
0.1351,
0.009,
0,
0.66,
0.... | [
"\"\"\"\nPull a oAuth protected page from foursquare.\n\nExpects ~/.oget to contain (one on each line):\nCONSUMER_KEY\nCONSUMER_KEY_SECRET\nUSERNAME\nPASSWORD",
"import httplib",
"import os",
"import re",
"import sys",
"import urllib",
"import urllib2",
"import urlparse",
"import user",
"from xml.... |
#!/usr/bin/python
import datetime
import sys
import textwrap
import common
from xml.dom import pulldom
PARSER = """\
/**
* Copyright 2009 Joe LaPenna
*/
package com.joelapenna.foursquare.parsers;
import com.joelapenna.foursquare.Foursquare;
import com.joelapenna.foursquare.error.FoursquareError;
import com.joel... | [
[
1,
0,
0.0201,
0.0067,
0,
0.66,
0,
426,
0,
1,
0,
0,
426,
0,
0
],
[
1,
0,
0.0268,
0.0067,
0,
0.66,
0.0769,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0336,
0.0067,
0,
... | [
"import datetime",
"import sys",
"import textwrap",
"import common",
"from xml.dom import pulldom",
"PARSER = \"\"\"\\\n/**\n * Copyright 2009 Joe LaPenna\n */\n\npackage com.joelapenna.foursquare.parsers;\n\nimport com.joelapenna.foursquare.Foursquare;",
"BOOLEAN_STANZA = \"\"\"\\\n } else i... |
#!/usr/bin/python
import logging
from xml.dom import minidom
from xml.dom import pulldom
BOOLEAN = "boolean"
STRING = "String"
GROUP = "Group"
# Interfaces that all FoursquareTypes implement.
DEFAULT_INTERFACES = ['FoursquareType']
# Interfaces that specific FoursqureTypes implement.
INTERFACES = {
}
DEFAULT_CLA... | [
[
1,
0,
0.0263,
0.0088,
0,
0.66,
0,
715,
0,
1,
0,
0,
715,
0,
0
],
[
1,
0,
0.0439,
0.0088,
0,
0.66,
0.0833,
290,
0,
1,
0,
0,
290,
0,
0
],
[
1,
0,
0.0526,
0.0088,
0,
... | [
"import logging",
"from xml.dom import minidom",
"from xml.dom import pulldom",
"BOOLEAN = \"boolean\"",
"STRING = \"String\"",
"GROUP = \"Group\"",
"DEFAULT_INTERFACES = ['FoursquareType']",
"INTERFACES = {\n}",
"DEFAULT_CLASS_IMPORTS = [\n]",
"CLASS_IMPORTS = {\n# 'Checkin': DEFAULT_CLASS_IMP... |
#!/usr/bin/env python
#
# Copyright (c) 2005 Niels Provos <provos@citi.umich.edu>
# All rights reserved.
#
# Generates marshaling code based on libevent.
import sys
import re
#
_NAME = "event_rpcgen.py"
_VERSION = "0.1"
_STRUCT_RE = '[a-z][a-z_0-9]*'
# Globals
line_count = 0
white = re.compile(r'^\s+')
cppcomment =... | [
[
1,
0,
0.0056,
0.0007,
0,
0.66,
0,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0063,
0.0007,
0,
0.66,
0.0357,
540,
0,
1,
0,
0,
540,
0,
0
],
[
14,
0,
0.0084,
0.0007,
0,
... | [
"import sys",
"import re",
"_NAME = \"event_rpcgen.py\"",
"_VERSION = \"0.1\"",
"_STRUCT_RE = '[a-z][a-z_0-9]*'",
"line_count = 0",
"white = re.compile(r'^\\s+')",
"cppcomment = re.compile(r'\\/\\/.*$')",
"headerdirect = []",
"cppdirect = []",
"class Struct:\n def __init__(self, name):\n ... |
#!/usr/bin/env python
#
# Copyright (c) 2005 Niels Provos <provos@citi.umich.edu>
# All rights reserved.
#
# Generates marshaling code based on libevent.
import sys
import re
#
_NAME = "event_rpcgen.py"
_VERSION = "0.1"
_STRUCT_RE = '[a-z][a-z_0-9]*'
# Globals
line_count = 0
white = re.compile(r'^\s+')
cppcomment =... | [
[
1,
0,
0.0056,
0.0007,
0,
0.66,
0,
509,
0,
1,
0,
0,
509,
0,
0
],
[
1,
0,
0.0063,
0.0007,
0,
0.66,
0.0357,
540,
0,
1,
0,
0,
540,
0,
0
],
[
14,
0,
0.0084,
0.0007,
0,
... | [
"import sys",
"import re",
"_NAME = \"event_rpcgen.py\"",
"_VERSION = \"0.1\"",
"_STRUCT_RE = '[a-z][a-z_0-9]*'",
"line_count = 0",
"white = re.compile(r'^\\s+')",
"cppcomment = re.compile(r'\\/\\/.*$')",
"headerdirect = []",
"cppdirect = []",
"class Struct:\n def __init__(self, name):\n ... |
# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
try:
__import__('pkg_resources').declare_namespace(__name__)
except ImportError:
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
| [
[
7,
0,
0.6667,
0.8333,
0,
0.66,
0,
0,
0,
1,
0,
0,
0,
0,
3
],
[
8,
1,
0.5,
0.1667,
1,
0.24,
0,
736,
3,
1,
0,
0,
0,
0,
2
],
[
1,
1,
0.8333,
0.1667,
1,
0.24,
0,
... | [
"try:\n __import__('pkg_resources').declare_namespace(__name__)\nexcept ImportError:\n from pkgutil import extend_path\n __path__ = extend_path(__path__, __name__)",
" __import__('pkg_resources').declare_namespace(__name__)",
" from pkgutil import extend_path",
" __path__ = extend_path(__pat... |
# -*- coding: utf-8 -*-
__author__ = """RedTurtle Technology"""
__docformat__ = 'plaintext'
import string
from Products.CMFCore.utils import getToolByName
from Products.CMFPlone.utils import getFSVersionTuple
from StringIO import StringIO
from Products.PloneboardNotify import config
def install(self, re... | [
[
14,
0,
0.0882,
0.0294,
0,
0.66,
0,
777,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.1176,
0.0294,
0,
0.66,
0.125,
959,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.1765,
0.0294,
0,
0.6... | [
"__author__ = \"\"\"RedTurtle Technology\"\"\"",
"__docformat__ = 'plaintext'",
"import string",
"from Products.CMFCore.utils import getToolByName",
"from Products.CMFPlone.utils import getFSVersionTuple",
"from StringIO import StringIO",
"from Products.PloneboardNotify import config",
"def install(se... |
# -*- coding: utf-8 -*-
from Products.Five.browser import BrowserView
# from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
from Products.Five.browser.pagetemplatefile import ZopeTwoPageTemplateFile # Plone 2.5 compatibility
from Products.CMFCore.utils import getToolByName
from Products.Ploneboard... | [
[
1,
0,
0.0448,
0.0149,
0,
0.66,
0,
595,
0,
1,
0,
0,
595,
0,
0
],
[
1,
0,
0.0746,
0.0149,
0,
0.66,
0.2,
624,
0,
1,
0,
0,
624,
0,
0
],
[
1,
0,
0.0896,
0.0149,
0,
0.6... | [
"from Products.Five.browser import BrowserView",
"from Products.Five.browser.pagetemplatefile import ZopeTwoPageTemplateFile # Plone 2.5 compatibility",
"from Products.CMFCore.utils import getToolByName",
"from Products.Ploneboard.interfaces import IPloneboard, IForum",
"from Products.PloneboardNotify.inter... |
# -*- coding: utf-8 -*-
import zope.interface
from Products.Five.browser import BrowserView
# from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
from Products.Five.browser.pagetemplatefile import ZopeTwoPageTemplateFile # Plone 2.5 compatibility
from Products.CMFCore.utils import getToolByName
f... | [
[
1,
0,
0.0423,
0.0141,
0,
0.66,
0,
443,
0,
1,
0,
0,
443,
0,
0
],
[
1,
0,
0.0704,
0.0141,
0,
0.66,
0.1667,
595,
0,
1,
0,
0,
595,
0,
0
],
[
1,
0,
0.0986,
0.0141,
0,
... | [
"import zope.interface",
"from Products.Five.browser import BrowserView",
"from Products.Five.browser.pagetemplatefile import ZopeTwoPageTemplateFile # Plone 2.5 compatibility",
"from Products.CMFCore.utils import getToolByName",
"from Products.Ploneboard.interfaces import IPloneboard, IForum",
"from Prod... |
from zope.interface import Interface
class ILocalBoardNotify(Interface):
"""
Marker interface for Ploneboard objects that use local notification parameters
"""
| [
[
1,
0,
0.1667,
0.1667,
0,
0.66,
0,
443,
0,
1,
0,
0,
443,
0,
0
],
[
3,
0,
0.75,
0.6667,
0,
0.66,
1,
857,
0,
0,
0,
0,
270,
0,
0
],
[
8,
1,
0.8333,
0.5,
1,
0.86,
... | [
"from zope.interface import Interface",
"class ILocalBoardNotify(Interface):\n \"\"\"\n Marker interface for Ploneboard objects that use local notification parameters\n \"\"\"",
" \"\"\"\n Marker interface for Ploneboard objects that use local notification parameters\n \"\"\""
] |
def initialize(context):
"""Initializer called when used as a Zope 2 product."""
| [
[
2,
0,
0.8333,
0.6667,
0,
0.66,
0,
393,
0,
1,
0,
0,
0,
0,
0
],
[
8,
1,
1,
0.3333,
1,
0.29,
0,
0,
1,
0,
0,
0,
0,
0,
0
]
] | [
"def initialize(context):\n \"\"\"Initializer called when used as a Zope 2 product.\"\"\"",
" \"\"\"Initializer called when used as a Zope 2 product.\"\"\""
] |
PROJECTNAME = "PloneboardNotify" | [
[
14,
0,
1,
1,
0,
0.66,
0,
239,
1,
0,
0,
0,
0,
3,
0
]
] | [
"PROJECTNAME = \"PloneboardNotify\""
] |
from setuptools import setup, find_packages
import os
version = '0.3.0'
setup(name='Products.PloneboardNotify',
version=version,
description="A configurable product that rely on Zope 3 events, for sending emails when new message is added on Ploneboard forum",
long_description=open("README.txt").read... | [
[
1,
0,
0.0244,
0.0244,
0,
0.66,
0,
182,
0,
2,
0,
0,
182,
0,
0
],
[
1,
0,
0.0488,
0.0244,
0,
0.66,
0.3333,
688,
0,
1,
0,
0,
688,
0,
0
],
[
14,
0,
0.0976,
0.0244,
0,
... | [
"from setuptools import setup, find_packages",
"import os",
"version = '0.3.0'",
"setup(name='Products.PloneboardNotify',\n version=version,\n description=\"A configurable product that rely on Zope 3 events, for sending emails when new message is added on Ploneboard forum\",\n long_description=... |
# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
try:
__import__('pkg_resources').declare_namespace(__name__)
except ImportError:
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
| [
[
7,
0,
0.6667,
0.8333,
0,
0.66,
0,
0,
0,
1,
0,
0,
0,
0,
3
],
[
8,
1,
0.5,
0.1667,
1,
0.76,
0,
736,
3,
1,
0,
0,
0,
0,
2
],
[
1,
1,
0.8333,
0.1667,
1,
0.76,
0,
... | [
"try:\n __import__('pkg_resources').declare_namespace(__name__)\nexcept ImportError:\n from pkgutil import extend_path\n __path__ = extend_path(__path__, __name__)",
" __import__('pkg_resources').declare_namespace(__name__)",
" from pkgutil import extend_path",
" __path__ = extend_path(__pat... |
from Acquisition import Explicit
from DateTime import DateTime
from Products.CMFCore.utils import getToolByName
from Products.Five import BrowserView
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
from zope.interface import implements
from zope.viewlet.interfaces import IViewlet
from zope impor... | [
[
1,
0,
0.0024,
0.0024,
0,
0.66,
0,
62,
0,
1,
0,
0,
62,
0,
0
],
[
1,
0,
0.0048,
0.0024,
0,
0.66,
0.0714,
556,
0,
1,
0,
0,
556,
0,
0
],
[
1,
0,
0.0072,
0.0024,
0,
0.... | [
"from Acquisition import Explicit",
"from DateTime import DateTime",
"from Products.CMFCore.utils import getToolByName",
"from Products.Five import BrowserView",
"from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile",
"from zope.interface import implements",
"from zope.viewlet.interfa... |
from Acquisition import aq_inner
from DateTime import DateTime
from kss.core import kssaction, KSSView
from zope.event import notify
from Products.Archetypes.event import ObjectInitializedEvent
from Products.CMFCore.utils import getToolByName
from zope.i18n import translate
from plonehrm.contracts import ContractsMess... | [
[
1,
0,
0.0021,
0.0021,
0,
0.66,
0,
62,
0,
1,
0,
0,
62,
0,
0
],
[
1,
0,
0.0043,
0.0021,
0,
0.66,
0.125,
556,
0,
1,
0,
0,
556,
0,
0
],
[
1,
0,
0.0064,
0.0021,
0,
0.6... | [
"from Acquisition import aq_inner",
"from DateTime import DateTime",
"from kss.core import kssaction, KSSView",
"from zope.event import notify",
"from Products.Archetypes.event import ObjectInitializedEvent",
"from Products.CMFCore.utils import getToolByName",
"from zope.i18n import translate",
"from ... |
from zope.interface import Interface
class IContractView(Interface):
"""Provide a view for an Employee specifically for Contracts.
"""
def current_contract():
"""Return a link to the contract"""
def expires():
"""Return the expiration date of the current contract."""
def trial_p... | [
[
1,
0,
0.0217,
0.0217,
0,
0.66,
0,
443,
0,
1,
0,
0,
443,
0,
0
],
[
3,
0,
0.2065,
0.2609,
0,
0.66,
0.5,
557,
0,
3,
0,
0,
270,
0,
0
],
[
8,
1,
0.1196,
0.0435,
1,
0.0... | [
"from zope.interface import Interface",
"class IContractView(Interface):\n \"\"\"Provide a view for an Employee specifically for Contracts.\n \"\"\"\n\n def current_contract():\n \"\"\"Return a link to the contract\"\"\"\n\n def expires():",
" \"\"\"Provide a view for an Employee specifica... |
# python package
| [] | [] |
__author__ = """Jean-Paul Ladage <j.ladage@zestsoftware.nl>"""
__docformat__ = 'plaintext'
from AccessControl import ClassSecurityInfo
from Acquisition import aq_chain, aq_inner
from DateTime import DateTime
from Products.Archetypes.utils import IntDisplayList
from Products.Archetypes.interfaces import IBaseContent
fr... | [
[
14,
0,
0.0022,
0.0022,
0,
0.66,
0,
777,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.0043,
0.0022,
0,
0.66,
0.0256,
959,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.0086,
0.0022,
0,
0.... | [
"__author__ = \"\"\"Jean-Paul Ladage <j.ladage@zestsoftware.nl>\"\"\"",
"__docformat__ = 'plaintext'",
"from AccessControl import ClassSecurityInfo",
"from Acquisition import aq_chain, aq_inner",
"from DateTime import DateTime",
"from Products.Archetypes.utils import IntDisplayList",
"from Products.Arch... |
__author__ = """Jean-Paul Ladage <j.ladage@zestsoftware.nl>"""
__docformat__ = 'plaintext'
from Acquisition import aq_parent, aq_chain
from Products.Archetypes.atapi import registerType
from zope import component
from zope.interface import implements
from AccessControl import ClassSecurityInfo
from Products.Archetypes... | [
[
14,
0,
0.0213,
0.0213,
0,
0.66,
0,
777,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.0426,
0.0213,
0,
0.66,
0.0625,
959,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.0851,
0.0213,
0,
0.... | [
"__author__ = \"\"\"Jean-Paul Ladage <j.ladage@zestsoftware.nl>\"\"\"",
"__docformat__ = 'plaintext'",
"from Acquisition import aq_parent, aq_chain",
"from Products.Archetypes.atapi import registerType",
"from zope import component",
"from zope.interface import implements",
"from AccessControl import Cl... |
__author__ = """Jean-Paul Ladage <j.ladage@zestsoftware.nl>"""
__docformat__ = 'plaintext'
# # Classes
import contract
import letter
| [
[
14,
0,
0.1667,
0.1667,
0,
0.66,
0,
777,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.3333,
0.1667,
0,
0.66,
0.3333,
959,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.8333,
0.1667,
0,
0.... | [
"__author__ = \"\"\"Jean-Paul Ladage <j.ladage@zestsoftware.nl>\"\"\"",
"__docformat__ = 'plaintext'",
"import contract",
"import letter"
] |
__author__ = """Jean-Paul Ladage <j.ladage@zestsoftware.nl>"""
__docformat__ = 'plaintext'
from AccessControl import ClassSecurityInfo
from Acquisition import aq_inner, aq_parent
from Products.Archetypes.atapi import BaseFolder
from Products.Archetypes.atapi import BaseFolderSchema
from Products.Archetypes.atapi impor... | [
[
14,
0,
0.0076,
0.0076,
0,
0.66,
0,
777,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.0153,
0.0076,
0,
0.66,
0.05,
959,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.0305,
0.0076,
0,
0.66... | [
"__author__ = \"\"\"Jean-Paul Ladage <j.ladage@zestsoftware.nl>\"\"\"",
"__docformat__ = 'plaintext'",
"from AccessControl import ClassSecurityInfo",
"from Acquisition import aq_inner, aq_parent",
"from Products.Archetypes.atapi import BaseFolder",
"from Products.Archetypes.atapi import BaseFolderSchema",... |
from Products.CMFCore.utils import getToolByName
def setup(context):
# This is the main method that gets called by genericsetup.
if context.readDataFile('plonehrm.contracts.txt') is None:
return
site = context.getSite()
logger = context.getLogger('plonehrm')
add_currency_property(site, log... | [
[
1,
0,
0.0323,
0.0323,
0,
0.66,
0,
287,
0,
1,
0,
0,
287,
0,
0
],
[
2,
0,
0.2258,
0.2258,
0,
0.66,
0.5,
234,
0,
1,
0,
0,
0,
0,
4
],
[
4,
1,
0.2097,
0.0645,
1,
0.69,... | [
"from Products.CMFCore.utils import getToolByName",
"def setup(context):\n # This is the main method that gets called by genericsetup.\n if context.readDataFile('plonehrm.contracts.txt') is None:\n return\n site = context.getSite()\n logger = context.getLogger('plonehrm')\n add_currency_prop... |
from zope.interface import Interface
class IContract(Interface):
def getId():
""" """
def setId():
""" """
def Title():
""" """
def Description():
""" """
def setDescription():
""" """
def getWage():
"""return the current wage"""
def s... | [
[
1,
0,
0.0145,
0.0145,
0,
0.66,
0,
443,
0,
1,
0,
0,
443,
0,
0
],
[
3,
0,
0.471,
0.8406,
0,
0.66,
0.3333,
11,
0,
19,
0,
0,
270,
0,
0
],
[
2,
1,
0.0942,
0.029,
1,
0.... | [
"from zope.interface import Interface",
"class IContract(Interface):\n\n def getId():\n \"\"\" \"\"\"\n\n def setId():\n \"\"\" \"\"\"",
" def getId():\n \"\"\" \"\"\"",
" \"\"\" \"\"\"",
" def setId():\n \"\"\" \"\"\"",
" \"\"\" \"\"\"",
" def Ti... |
import logging
from DateTime import DateTime
from Products.Five.browser.pagetemplatefile import ZopeTwoPageTemplateFile
from Products.CMFCore.utils import getToolByName
from Acquisition import aq_parent
from Products.plonehrm import utils
from Products.plonehrm.controlpanel import IHRMNotificationsPanelSchema
from pl... | [
[
1,
0,
0.008,
0.008,
0,
0.66,
0,
715,
0,
1,
0,
0,
715,
0,
0
],
[
1,
0,
0.024,
0.008,
0,
0.66,
0.0556,
556,
0,
1,
0,
0,
556,
0,
0
],
[
1,
0,
0.032,
0.008,
0,
0.66,
... | [
"import logging",
"from DateTime import DateTime",
"from Products.Five.browser.pagetemplatefile import ZopeTwoPageTemplateFile",
"from Products.CMFCore.utils import getToolByName",
"from Acquisition import aq_parent",
"from Products.plonehrm import utils",
"from Products.plonehrm.controlpanel import IHR... |
from plonehrm.notifications.interfaces import IHRMModuleEvent
from plonehrm.notifications.interfaces import IHRMEmailer
class IContractEvent(IHRMModuleEvent):
pass
class IContractEmailer(IHRMEmailer):
pass
| [
[
1,
0,
0.1,
0.1,
0,
0.66,
0,
835,
0,
1,
0,
0,
835,
0,
0
],
[
1,
0,
0.2,
0.1,
0,
0.66,
0.3333,
835,
0,
1,
0,
0,
835,
0,
0
],
[
3,
0,
0.55,
0.2,
0,
0.66,
0.6667,... | [
"from plonehrm.notifications.interfaces import IHRMModuleEvent",
"from plonehrm.notifications.interfaces import IHRMEmailer",
"class IContractEvent(IHRMModuleEvent):\n pass",
"class IContractEmailer(IHRMEmailer):\n pass"
] |
try:
import zope.annotation
except ImportError:
# BBB for Zope 2.9
import zope.app.annotation
import zope.app.annotation.interfaces
import sys
sys.modules['zope.annotation'] = zope.app.annotation
sys.modules['zope.annotation.interfaces'] = zope.app.annotation.interfaces
| [
[
7,
0,
0.5556,
1,
0,
0.66,
0,
0,
0,
1,
0,
0,
0,
0,
0
],
[
1,
1,
0.2222,
0.1111,
1,
0.47,
0,
951,
0,
1,
0,
0,
951,
0,
0
],
[
1,
1,
0.5556,
0.1111,
1,
0.47,
0,
... | [
"try:\n import zope.annotation\nexcept ImportError:\n # BBB for Zope 2.9\n import zope.app.annotation\n import zope.app.annotation.interfaces\n import sys\n sys.modules['zope.annotation'] = zope.app.annotation",
" import zope.annotation",
" import zope.app.annotation",
" import zope... |
from zope.i18n import translate
from zope.interface import implements
from zope.component.interfaces import ObjectEvent
from Acquisition import aq_parent
from Products.CMFCore.utils import getToolByName
from plonehrm.contracts import ContractsMessageFactory as _
from plonehrm.contracts.notifications.interfaces import ... | [
[
1,
0,
0.0125,
0.0125,
0,
0.66,
0,
500,
0,
1,
0,
0,
500,
0,
0
],
[
1,
0,
0.025,
0.0125,
0,
0.66,
0.1111,
443,
0,
1,
0,
0,
443,
0,
0
],
[
1,
0,
0.0375,
0.0125,
0,
0... | [
"from zope.i18n import translate",
"from zope.interface import implements",
"from zope.component.interfaces import ObjectEvent",
"from Acquisition import aq_parent",
"from Products.CMFCore.utils import getToolByName",
"from plonehrm.contracts import ContractsMessageFactory as _",
"from plonehrm.contract... |
from Products.PloneTestCase import PloneTestCase as ptc
from Products.plonehrm.tests.base import PlonehrmLayer
ptc.setupPloneSite()
class BaseTestCase(ptc.PloneTestCase):
layer = PlonehrmLayer
| [
[
1,
0,
0.1111,
0.1111,
0,
0.66,
0,
104,
0,
1,
0,
0,
104,
0,
0
],
[
1,
0,
0.2222,
0.1111,
0,
0.66,
0.3333,
313,
0,
1,
0,
0,
313,
0,
0
],
[
8,
0,
0.4444,
0.1111,
0,
... | [
"from Products.PloneTestCase import PloneTestCase as ptc",
"from Products.plonehrm.tests.base import PlonehrmLayer",
"ptc.setupPloneSite()",
"class BaseTestCase(ptc.PloneTestCase):\n\n layer = PlonehrmLayer",
" layer = PlonehrmLayer"
] |
# -*- coding: utf-8 -*-
#
# File: tests.py
#
# Copyright (c) 2007 by []
# Generator: ArchGenXML Version 1.6.0-beta-svn
# http://plone.org/products/archgenxml
#
# GNU General Public License (GPL)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General P... | [
[
14,
0,
0.9643,
0.0357,
0,
0.66,
0,
777,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
1,
0.0357,
0,
0.66,
1,
959,
1,
0,
0,
0,
0,
3,
0
]
] | [
"__author__ = \"\"\"unknown <unknown>\"\"\"",
"__docformat__ = 'plaintext'"
] |
__author__ = """Jean-Paul Ladage <j.ladage@zestsoftware.nl>"""
__docformat__ = 'plaintext'
import logging
from zope.i18nmessageid import MessageFactory
from Products.Archetypes import listTypes
from Products.Archetypes.atapi import process_types
from Products.CMFCore import utils as cmfutils
from Products.validation.... | [
[
14,
0,
0.025,
0.025,
0,
0.66,
0,
777,
1,
0,
0,
0,
0,
3,
0
],
[
14,
0,
0.05,
0.025,
0,
0.66,
0.0625,
959,
1,
0,
0,
0,
0,
3,
0
],
[
1,
0,
0.1,
0.025,
0,
0.66,
0... | [
"__author__ = \"\"\"Jean-Paul Ladage <j.ladage@zestsoftware.nl>\"\"\"",
"__docformat__ = 'plaintext'",
"import logging",
"from zope.i18nmessageid import MessageFactory",
"from Products.Archetypes import listTypes",
"from Products.Archetypes.atapi import process_types",
"from Products.CMFCore import util... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.