code
stringlengths
1
1.49M
vector
listlengths
0
7.38k
snippet
listlengths
0
7.38k
from math import ceil as float_ceil ceil = lambda f: int(float_ceil(f)) import gtk, cairo import gobject from OverlayWindow import OverlayWindow POSITIONS_COUNT = 5 NORTH, EAST, SOUTH, WEST, CENTER = range(POSITIONS_COUNT) DX_DY = ((0,-1), (1,0), (0,1), (-1,0), (0,0)) PADDING_X = 0.2 # Amount of button width PADDING...
[ [ 1, 0, 0.0053, 0.0053, 0, 0.66, 0, 526, 0, 1, 0, 0, 526, 0, 0 ], [ 14, 0, 0.0105, 0.0053, 0, 0.66, 0.0909, 211, 9, 0, 0, 0, 0, 0, 2 ], [ 1, 0, 0.0211, 0.0053, 0, 0...
[ "from math import ceil as float_ceil", "ceil = lambda f: int(float_ceil(f))", "import gtk, cairo", "import gobject", "from OverlayWindow import OverlayWindow", "POSITIONS_COUNT = 5", "NORTH, EAST, SOUTH, WEST, CENTER = range(POSITIONS_COUNT)", "DX_DY = ((0,-1), (1,0), (0,1), (-1,0), (0,0))", "PADDIN...
import gtk #=============================================================================== # Composite Constants #=============================================================================== POSITIONS_COUNT = 5 NORTH, EAST, SOUTH, WEST, CENTER = range(POSITIONS_COUNT) #===========================================...
[ [ 1, 0, 0.0075, 0.0075, 0, 0.66, 0, 166, 0, 1, 0, 0, 166, 0, 0 ], [ 14, 0, 0.0526, 0.0075, 0, 0.66, 0.1429, 373, 1, 0, 0, 0, 0, 1, 0 ], [ 14, 0, 0.0602, 0.0075, 0, ...
[ "import gtk", "POSITIONS_COUNT = 5", "NORTH, EAST, SOUTH, WEST, CENTER = range(POSITIONS_COUNT)", "class DockComponent (object):\n def dock (self, widget, position, title, id):\n abstract", " def dock (self, widget, position, title, id):\n abstract", " abstract", "class TabRec...
from Throbber import Throbber from pychess.Players.engineNest import discoverer from pychess.System import conf, uistuff from pychess.System.glock import glock_connect from pychess.System.prefix import addDataPrefix import gtk.glade import os uistuff.cacheGladefile("discovererDialog.glade") class DiscovererDialog...
[ [ 1, 0, 0.0128, 0.0128, 0, 0.66, 0, 695, 0, 1, 0, 0, 695, 0, 0 ], [ 1, 0, 0.0256, 0.0128, 0, 0.66, 0.125, 535, 0, 1, 0, 0, 535, 0, 0 ], [ 1, 0, 0.0385, 0.0128, 0, 0...
[ "from Throbber import Throbber", "from pychess.Players.engineNest import discoverer", "from pychess.System import conf, uistuff", "from pychess.System.glock import glock_connect", "from pychess.System.prefix import addDataPrefix", "import gtk.glade", "import os", "uistuff.cacheGladefile(\"discovererDi...
import gtk, gobject import gamewidget firstRun = True def run(widgets): global firstRun if firstRun: initialize(widgets) firstRun = False widgets["player_info"].show_all() def initialize(widgets): def addColumns (treeview, *columns): model = gtk.ListStore(*((str,)*len(columns)...
[ [ 1, 0, 0.0141, 0.0141, 0, 0.66, 0, 166, 0, 2, 0, 0, 166, 0, 0 ], [ 1, 0, 0.0423, 0.0141, 0, 0.66, 0.2, 632, 0, 1, 0, 0, 632, 0, 0 ], [ 14, 0, 0.0704, 0.0141, 0, 0....
[ "import gtk, gobject", "import gamewidget", "firstRun = True", "def run(widgets):\n global firstRun\n if firstRun:\n initialize(widgets)\n firstRun = False\n widgets[\"player_info\"].show_all()", " if firstRun:\n initialize(widgets)\n firstRun = False", " ini...
import sys, os import gtk from pychess.System.prefix import addDataPrefix from pychess.System import conf, gstreamer, uistuff from pychess.Players.engineNest import discoverer from pychess.Utils.const import * from pychess.Utils.IconLoader import load_icon firstRun = True def run(widgets): global firstRun if ...
[ [ 1, 0, 0.0021, 0.0021, 0, 0.66, 0, 509, 0, 2, 0, 0, 509, 0, 0 ], [ 1, 0, 0.0043, 0.0021, 0, 0.66, 0.0435, 166, 0, 1, 0, 0, 166, 0, 0 ], [ 1, 0, 0.0085, 0.0021, 0, ...
[ "import sys, os", "import gtk", "from pychess.System.prefix import addDataPrefix", "from pychess.System import conf, gstreamer, uistuff", "from pychess.Players.engineNest import discoverer", "from pychess.Utils.const import *", "from pychess.Utils.IconLoader import load_icon", "firstRun = True", "de...
import gtk from pychess.System import uistuff from pychess.System.prefix import addDataPrefix from pychess.Utils.Piece import Piece,QUEEN,ROOK,BISHOP,KNIGHT from pychess.Utils.const import WHITE,BLACK from PieceWidget import PieceWidget uistuff.cacheGladefile("promotion.glade") class PromotionDialog: def...
[ [ 1, 0, 0.0233, 0.0233, 0, 0.66, 0, 166, 0, 1, 0, 0, 166, 0, 0 ], [ 1, 0, 0.0698, 0.0233, 0, 0.66, 0.1429, 336, 0, 1, 0, 0, 336, 0, 0 ], [ 1, 0, 0.093, 0.0233, 0, 0...
[ "import gtk", "from pychess.System import uistuff", "from pychess.System.prefix import addDataPrefix", "from pychess.Utils.Piece import Piece,QUEEN,ROOK,BISHOP,KNIGHT", "from pychess.Utils.const import WHITE,BLACK", "from PieceWidget import PieceWidget", "uistuff.cacheGladefile(\"promotion.glade\")", ...
import gtk import cairo from pychess.gfx.Pieces import drawPiece class PieceWidget (gtk.DrawingArea): def __init__(self, piece): gtk.DrawingArea.__init__(self) self.connect("expose_event", self.expose) self.piece = piece def setPiece(self, piece): self.piece = piece ...
[ [ 1, 0, 0.0417, 0.0417, 0, 0.66, 0, 166, 0, 1, 0, 0, 166, 0, 0 ], [ 1, 0, 0.0833, 0.0417, 0, 0.66, 0.3333, 747, 0, 1, 0, 0, 747, 0, 0 ], [ 1, 0, 0.1667, 0.0417, 0, ...
[ "import gtk", "import cairo", "from pychess.gfx.Pieces import drawPiece", "class PieceWidget (gtk.DrawingArea):\n def __init__(self, piece):\n gtk.DrawingArea.__init__(self)\n self.connect(\"expose_event\", self.expose)\n self.piece = piece\n \n def setPiece(self, piece):\n ...
import math, random import gtk, pango from gtk.gdk import pixbuf_new_from_file from gobject import SIGNAL_RUN_FIRST from pychess.System.prefix import addDataPrefix from pychess.System import uistuff from pychess.System.glock import glock_connect_after from ToggleComboBox import ToggleComboBox from Background import ...
[ [ 1, 0, 0.004, 0.004, 0, 0.66, 0, 526, 0, 2, 0, 0, 526, 0, 0 ], [ 1, 0, 0.0119, 0.004, 0, 0.66, 0.0455, 166, 0, 2, 0, 0, 166, 0, 0 ], [ 1, 0, 0.0158, 0.004, 0, 0.66...
[ "import math, random", "import gtk, pango", "from gtk.gdk import pixbuf_new_from_file", "from gobject import SIGNAL_RUN_FIRST", "from pychess.System.prefix import addDataPrefix", "from pychess.System import uistuff", "from pychess.System.glock import glock_connect_after", "from ToggleComboBox import T...
import pygtk pygtk.require("2.0") import gtk from gobject import * from pychess.System.Log import log from pychess.Utils.IconLoader import load_icon class ToggleComboBox (gtk.ToggleButton): __gsignals__ = {'changed' : (SIGNAL_RUN_FIRST, TYPE_NONE, (TYPE_INT,))} def __init__ (self): gtk.ToggleButton...
[ [ 1, 0, 0.0076, 0.0076, 0, 0.66, 0, 106, 0, 1, 0, 0, 106, 0, 0 ], [ 8, 0, 0.0153, 0.0076, 0, 0.66, 0.1667, 66, 3, 1, 0, 0, 0, 0, 1 ], [ 1, 0, 0.0229, 0.0076, 0, 0.6...
[ "import pygtk", "pygtk.require(\"2.0\")", "import gtk", "from gobject import *", "from pychess.System.Log import log", "from pychess.Utils.IconLoader import load_icon", "class ToggleComboBox (gtk.ToggleButton):\n\n __gsignals__ = {'changed' : (SIGNAL_RUN_FIRST, TYPE_NONE, (TYPE_INT,))}\n\n def __i...
import gamewidget firstRun = True def run(widgets, gameDic): global firstRun if firstRun: initialize(widgets, gameDic) firstRun = False widgets["game_info"].show() def initialize(widgets, gameDic): gamemodel = gameDic[gamewidget.cur_gmwidg()] widgets["event_entry"].set_text(gamemod...
[ [ 1, 0, 0.0244, 0.0244, 0, 0.66, 0, 632, 0, 1, 0, 0, 632, 0, 0 ], [ 14, 0, 0.0732, 0.0244, 0, 0.66, 0.3333, 351, 1, 0, 0, 0, 0, 4, 0 ], [ 2, 0, 0.1585, 0.1463, 0, 0...
[ "import gamewidget", "firstRun = True", "def run(widgets, gameDic):\n global firstRun\n if firstRun:\n initialize(widgets, gameDic)\n firstRun = False\n widgets[\"game_info\"].show()", " if firstRun:\n initialize(widgets, gameDic)\n firstRun = False", " initial...
import gtk class BorderBox (gtk.Alignment): def __init__ (self, widget=None, top=False, right=False, bottom=False, left=False): gtk.Alignment.__init__(self, 0, 0, 1, 1) self.connect("expose-event", self._onExpose) if widget: self.add(...
[ [ 1, 0, 0.0114, 0.0114, 0, 0.66, 0, 166, 0, 1, 0, 0, 166, 0, 0 ], [ 3, 0, 0.5114, 0.9886, 0, 0.66, 1, 48, 0, 11, 0, 0, 264, 0, 27 ], [ 2, 1, 0.1023, 0.1477, 1, 0.44...
[ "import gtk", "class BorderBox (gtk.Alignment):\n def __init__ (self, widget=None, top=False, right=False,\n bottom=False, left=False):\n gtk.Alignment.__init__(self, 0, 0, 1, 1)\n self.connect(\"expose-event\", self._onExpose)\n \n if widget:\n ...
import datetime from pychess.Utils.const import RUNNING class LoadingError (Exception): pass class ChessFile: """ This class descripes an opened chessfile. It is lazy in the sense of not parsing any games, that the user don't request. It has no catching. """ def __init__ (self, ga...
[ [ 1, 0, 0.0149, 0.0149, 0, 0.66, 0, 426, 0, 1, 0, 0, 426, 0, 0 ], [ 1, 0, 0.0299, 0.0149, 0, 0.66, 0.3333, 297, 0, 1, 0, 0, 297, 0, 0 ], [ 3, 0, 0.0597, 0.0149, 0, ...
[ "import datetime", "from pychess.Utils.const import RUNNING", "class LoadingError (Exception): pass", "class ChessFile:\n \"\"\" This class descripes an opened chessfile.\n It is lazy in the sense of not parsing any games,\n that the user don't request.\n It has no catching. \"\"\"\n ...
from pychess.Utils.Cord import Cord from pychess.Utils.Board import Board from pychess.Utils.Piece import Piece from pychess.Utils.Move import Move from pychess.Utils.const import * from pychess.Utils.logic import getStatus __label__ = _("Simple Chess Position") __endings__ = "fen", __append__ = True def save (file, ...
[ [ 1, 0, 0.0256, 0.0256, 0, 0.66, 0, 507, 0, 1, 0, 0, 507, 0, 0 ], [ 1, 0, 0.0513, 0.0256, 0, 0.66, 0.0833, 208, 0, 1, 0, 0, 208, 0, 0 ], [ 1, 0, 0.0769, 0.0256, 0, ...
[ "from pychess.Utils.Cord import Cord", "from pychess.Utils.Board import Board", "from pychess.Utils.Piece import Piece", "from pychess.Utils.Move import Move", "from pychess.Utils.const import *", "from pychess.Utils.logic import getStatus", "__label__ = _(\"Simple Chess Position\")", "__endings__ = \...
__all__ = ["fen", "epd", "pgn",'chessalpha2']
[ [ 14, 0, 1, 1, 0, 0.66, 0, 272, 0, 0, 0, 0, 0, 5, 0 ] ]
[ "__all__ = [\"fen\", \"epd\", \"pgn\",'chessalpha2']" ]
# -*- coding: utf-8 -*- import re from htmlentitydefs import * from pychess.Utils.Cord import Cord from pychess.Utils.Piece import Piece from pychess.Utils.Move import * from pychess.Utils.const import * from pychess.Utils.lutils.leval import evaluateComplete from pychess.Utils.logic import getStatus from ChessFile ...
[ [ 1, 0, 0.0204, 0.0068, 0, 0.66, 0, 540, 0, 1, 0, 0, 540, 0, 0 ], [ 1, 0, 0.0272, 0.0068, 0, 0.66, 0.0345, 744, 0, 1, 0, 0, 744, 0, 0 ], [ 1, 0, 0.0408, 0.0068, 0, ...
[ "import re", "from htmlentitydefs import *", "from pychess.Utils.Cord import Cord", "from pychess.Utils.Piece import Piece", "from pychess.Utils.Move import *", "from pychess.Utils.const import *", "from pychess.Utils.lutils.leval import evaluateComplete", "from pychess.Utils.logic import getStatus", ...
from __future__ import with_statement import os import webbrowser import math import atexit import signal import gobject, gtk from gtk import DEST_DEFAULT_MOTION, DEST_DEFAULT_HIGHLIGHT, DEST_DEFAULT_DROP from pychess.System import conf, glock, uistuff, prefix, SubProcess from pychess.System.uistuff import POSITION_N...
[ [ 1, 0, 0.0032, 0.0032, 0, 0.66, 0, 777, 0, 1, 0, 0, 777, 0, 0 ], [ 1, 0, 0.0065, 0.0032, 0, 0.66, 0.0323, 688, 0, 1, 0, 0, 688, 0, 0 ], [ 1, 0, 0.0097, 0.0032, 0, ...
[ "from __future__ import with_statement", "import os", "import webbrowser", "import math", "import atexit", "import signal", "import gobject, gtk", "from gtk import DEST_DEFAULT_MOTION, DEST_DEFAULT_HIGHLIGHT, DEST_DEFAULT_DROP", "from pychess.System import conf, glock, uistuff, prefix, SubProcess", ...
""" This module contains chess logic functins for the pychess client. They are based upon the lutils modules, but supports standard object types and is therefore not as fast. """ from lutils import lmovegen from lutils.validator import validateMove from lutils.lmove import FCORD, TCORD from lutils import ldraw...
[ [ 8, 0, 0.0146, 0.0219, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.0365, 0.0073, 0, 0.66, 0.0526, 839, 0, 1, 0, 0, 839, 0, 0 ], [ 1, 0, 0.0438, 0.0073, 0, 0.66...
[ "\"\"\" This module contains chess logic functins for the pychess client. They are\n based upon the lutils modules, but supports standard object types and is\n therefore not as fast. \"\"\"", "from lutils import lmovegen", "from lutils.validator import validateMove", "from lutils.lmove import FCORD, TCO...
# -*- coding: UTF-8 -*- ################################################################################ # PyChess information # ################################################################################ NAME = "PyChess" ENGINES_XML_API_VERSION = "0.10.1"...
[ [ 14, 0, 0.0318, 0.0045, 0, 0.66, 0, 181, 1, 0, 0, 0, 0, 3, 0 ], [ 14, 0, 0.0364, 0.0045, 0, 0.66, 0.0156, 501, 1, 0, 0, 0, 0, 3, 0 ], [ 14, 0, 0.0682, 0.0045, 0, 0...
[ "NAME = \"PyChess\"", "ENGINES_XML_API_VERSION = \"0.10.1\"", "LOCAL, ARTIFICIAL, REMOTE = range(3)", "EASY, INTERMEDIATE, EXPERT = range(3)", "WHITE, BLACK = range(2)", "reprColor = [_(\"White\"), _(\"Black\")]", "WAITING_TO_START, PAUSED, RUNNING, DRAW, WHITEWON, BLACKWON, KILLED, \\\n ADJOURNED, A...
from pychess.Utils.const import ACTIONS class Offer: def __init__(self, type_, param=None, index=None): assert type_ in ACTIONS, "Offer.__init__(): type not in ACTIONS: %s" % repr(type_) assert index is None or type(index) is int, \ "Offer.__init__(): index not int: %s" % repr(index) ...
[ [ 1, 0, 0.04, 0.04, 0, 0.66, 0, 297, 0, 1, 0, 0, 297, 0, 0 ], [ 3, 0, 0.56, 0.92, 0, 0.66, 1, 531, 0, 4, 0, 0, 0, 0, 12 ], [ 2, 1, 0.28, 0.28, 1, 0.57, 0, 5...
[ "from pychess.Utils.const import ACTIONS", "class Offer:\n def __init__(self, type_, param=None, index=None):\n assert type_ in ACTIONS, \"Offer.__init__(): type not in ACTIONS: %s\" % repr(type_)\n assert index is None or type(index) is int, \\\n \"Offer.__init__(): index not int: %s\...
from copy import copy from lutils.LBoard import LBoard from lutils.bitboard import iterBits from lutils.lmove import RANK, FILE, FLAG, PROMOTE_PIECE, toAN from Piece import Piece from Cord import Cord from const import * class Board: """ Board is a thin layer above LBoard, adding the Piece objects, which are ...
[ [ 1, 0, 0.0042, 0.0042, 0, 0.66, 0, 739, 0, 1, 0, 0, 739, 0, 0 ], [ 1, 0, 0.0126, 0.0042, 0, 0.66, 0.1429, 33, 0, 1, 0, 0, 33, 0, 0 ], [ 1, 0, 0.0167, 0.0042, 0, 0....
[ "from copy import copy", "from lutils.LBoard import LBoard", "from lutils.bitboard import iterBits", "from lutils.lmove import RANK, FILE, FLAG, PROMOTE_PIECE, toAN", "from Piece import Piece", "from Cord import Cord", "from const import *", "class Board:\n \"\"\" Board is a thin layer above LBoard...
################################################################################ # The purpose of this module, is to give a certain position a score. The # # greater the score, the better the position # ############################################################################...
[ [ 1, 0, 0.0117, 0.0017, 0, 0.66, 0, 297, 0, 1, 0, 0, 297, 0, 0 ], [ 1, 0, 0.0133, 0.0017, 0, 0.66, 0.0435, 17, 0, 1, 0, 0, 17, 0, 0 ], [ 1, 0, 0.015, 0.0017, 0, 0.6...
[ "from pychess.Utils.const import *", "from ldata import *", "from LBoard import LBoard", "from lsort import staticExchangeEvaluate", "from lmove import newMove", "randomval = 0 #randint(8,12)/10.", "def evaluateComplete (board, color, balanced=False):\n \"\"\" A detailed evaluation function, taking i...
from UserDict import UserDict from pychess.Utils.const import hashfALPHA, hashfBETA, hashfEXACT, hashfBAD, WHITE from ldata import MATE_VALUE from pychess.System.LimitedDict import LimitedDict from types import InstanceType from lmove import TCORD, FCORD class TranspositionTable: def __init__ (self, maxSize): ...
[ [ 1, 0, 0.0119, 0.0119, 0, 0.66, 0, 351, 0, 1, 0, 0, 351, 0, 0 ], [ 1, 0, 0.0238, 0.0119, 0, 0.66, 0.1667, 297, 0, 5, 0, 0, 297, 0, 0 ], [ 1, 0, 0.0357, 0.0119, 0, ...
[ "from UserDict import UserDict", "from pychess.Utils.const import hashfALPHA, hashfBETA, hashfEXACT, hashfBAD, WHITE", "from ldata import MATE_VALUE", "from pychess.System.LimitedDict import LimitedDict", "from types import InstanceType", "from lmove import TCORD, FCORD", "class TranspositionTable:\n ...
from lmove import * from pychess.Utils.const import * from bitboard import * from attack import * ################################################################################ # Validate move # ###########################################################...
[ [ 1, 0, 0.005, 0.005, 0, 0.66, 0, 960, 0, 1, 0, 0, 960, 0, 0 ], [ 1, 0, 0.01, 0.005, 0, 0.66, 0.2, 297, 0, 1, 0, 0, 297, 0, 0 ], [ 1, 0, 0.015, 0.005, 0, 0.66, ...
[ "from lmove import *", "from pychess.Utils.const import *", "from bitboard import *", "from attack import *", "def validateMove (board, move):\n \n fcord = (move >> 6) & 63\n \n fpiece = board.arBoard[fcord]\n \n # Empty from square \n if fpiece == EMPTY:", " fcord = (move >> 6) &...
from time import time from random import random from heapq import heappush, heappop from lmovegen import genAllMoves, genCheckEvasions, genCaptures from pychess.Utils.const import * from leval import evaluateComplete from lsort import getCaptureValue, getMoveValue from lmove import toSAN from ldata import MATE_VALUE f...
[ [ 1, 0, 0.0035, 0.0035, 0, 0.66, 0, 654, 0, 1, 0, 0, 654, 0, 0 ], [ 1, 0, 0.007, 0.0035, 0, 0.66, 0.0435, 715, 0, 1, 0, 0, 715, 0, 0 ], [ 1, 0, 0.0105, 0.0035, 0, 0...
[ "from time import time", "from random import random", "from heapq import heappush, heappop", "from lmovegen import genAllMoves, genCheckEvasions, genCaptures", "from pychess.Utils.const import *", "from leval import evaluateComplete", "from lsort import getCaptureValue, getMoveValue", "from lmove impo...
from array import array from operator import or_ from pychess.Utils.const import * #from pychess.Utils.lutils.lmove import RANK, FILE from bitboard import * def RANK (cord): return cord >> 3 def FILE (cord): return cord & 7 ################################################################################ ###############...
[ [ 1, 0, 0.0017, 0.0017, 0, 0.66, 0, 80, 0, 1, 0, 0, 80, 0, 0 ], [ 1, 0, 0.0033, 0.0017, 0, 0.66, 0.0095, 616, 0, 1, 0, 0, 616, 0, 0 ], [ 1, 0, 0.005, 0.0017, 0, 0.6...
[ "from array import array", "from operator import or_", "from pychess.Utils.const import *", "from bitboard import *", "def RANK (cord): return cord >> 3", "def RANK (cord): return cord >> 3", "def FILE (cord): return cord & 7", "def FILE (cord): return cord & 7", "PAWN_VALUE = 100", "KNIGHT_VALUE ...
from bitboard import * from attack import * from pychess.Utils.const import * from lmove import newMove ################################################################################ # Generate all moves # ####################################################...
[ [ 1, 0, 0.0042, 0.0021, 0, 0.66, 0, 866, 0, 1, 0, 0, 866, 0, 0 ], [ 1, 0, 0.0063, 0.0021, 0, 0.66, 0.125, 424, 0, 1, 0, 0, 424, 0, 0 ], [ 1, 0, 0.0084, 0.0021, 0, 0...
[ "from bitboard import *", "from attack import *", "from pychess.Utils.const import *", "from lmove import newMove", "def genCastles (board):\n def generateOne (color, rooknum, king_after, rook_after):\n if rooknum == 0:\n castle = QUEEN_CASTLE\n else:\n castle = KING_C...
from attack import getAttacks, staticExchangeEvaluate from pychess.Utils.eval import pos as positionValues from sys import maxint from ldata import * def getCaptureValue (board, move): mpV = PIECE_VALUES[board.arBoard[move>>6 & 63]] cpV = PIECE_VALUES[board.arBoard[move & 63]] if mpV < cpV: retur...
[ [ 1, 0, 0.0263, 0.0132, 0, 0.66, 0, 424, 0, 2, 0, 0, 424, 0, 0 ], [ 1, 0, 0.0395, 0.0132, 0, 0.66, 0.1429, 600, 0, 1, 0, 0, 600, 0, 0 ], [ 1, 0, 0.0658, 0.0132, 0, ...
[ "from attack import getAttacks, staticExchangeEvaluate", "from pychess.Utils.eval import pos as positionValues", "from sys import maxint", "from ldata import *", "def getCaptureValue (board, move):\n mpV = PIECE_VALUES[board.arBoard[move>>6 & 63]]\n cpV = PIECE_VALUES[board.arBoard[move & 63]]\n if...
from bitboard import bitLength from ldata import BLACK_SQUARES from pychess.Utils.const import * def repetitionCount (board, drawThreshold=3): rc = 1 for ply in xrange(4, 1+min(len(board.history), board.fifty), 2): if board.history[-ply][4] == board.hash: rc += 1 if rc >= drawTh...
[ [ 1, 0, 0.0112, 0.0112, 0, 0.66, 0, 866, 0, 1, 0, 0, 866, 0, 0 ], [ 1, 0, 0.0225, 0.0112, 0, 0.66, 0.1111, 17, 0, 1, 0, 0, 17, 0, 0 ], [ 1, 0, 0.0337, 0.0112, 0, 0....
[ "from bitboard import bitLength", "from ldata import BLACK_SQUARES", "from pychess.Utils.const import *", "def repetitionCount (board, drawThreshold=3):\n rc = 1\n for ply in xrange(4, 1+min(len(board.history), board.fifty), 2):\n if board.history[-ply][4] == board.hash:\n rc += 1\n ...
import os import sys try: from gmpy import mpz uselp = False except ImportError: uselp = True from array import array #=============================================================================== # createBoard returns a new bitboard in the format preferred by this module #==============...
[ [ 1, 0, 0.0057, 0.0057, 0, 0.66, 0, 688, 0, 1, 0, 0, 688, 0, 0 ], [ 1, 0, 0.0115, 0.0057, 0, 0.66, 0.0556, 509, 0, 1, 0, 0, 509, 0, 0 ], [ 7, 0, 0.0374, 0.0345, 0, ...
[ "import os", "import sys", "try:\n from gmpy import mpz\n uselp = False\nexcept ImportError:\n uselp = True\n from array import array", " from gmpy import mpz", " uselp = False", " uselp = True", " from array import array", "def createBoard (number):\n return mpz(number)", ...
from bitboard import * from ldata import * from pychess.Utils.const import * # # Caveat: Many functions in this module has very similar code. If you fix a # bug, or write a perforance enchace, please update all functions. Apologies # for the inconvenience # def isAttacked (board, cord, color): """ To determine if...
[ [ 1, 0, 0.0032, 0.0032, 0, 0.66, 0, 866, 0, 1, 0, 0, 866, 0, 0 ], [ 1, 0, 0.0063, 0.0032, 0, 0.66, 0.1, 17, 0, 1, 0, 0, 17, 0, 0 ], [ 1, 0, 0.0095, 0.0032, 0, 0.66,...
[ "from bitboard import *", "from ldata import *", "from pychess.Utils.const import *", "def isAttacked (board, cord, color):\n \"\"\" To determine if cord is attacked by any pieces from color. \"\"\"\n pboards = board.boards[color]\n \n # Knights\n if pboards[KNIGHT] & moveArray[KNIGHT][cord]:\n...
""" This module differs from leval in that it is not optimized for speed. It checks differences between last and current board, and returns not scores, but strings describing the differences. Can be used for commenting on board changes. """ import leval from pychess.Utils.const import * from lmove imp...
[ [ 8, 0, 0.0066, 0.0088, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.0133, 0.0015, 0, 0.66, 0.04, 418, 0, 1, 0, 0, 418, 0, 0 ], [ 1, 0, 0.0147, 0.0015, 0, 0.66, ...
[ "\"\"\"\n This module differs from leval in that it is not optimized for speed.\n It checks differences between last and current board, and returns not\n scores, but strings describing the differences.\n Can be used for commenting on board changes.\n\"\"\"", "import leval", "from pychess.Utils.const...
class Rating: def __init__(self, type, elo, deviation = 0, wins = 0, losses = 0, draws = 0, bestElo = 0, bestTime = 0): self.type = type self.elo = elo self.deviation = deviation self.wins = wins self.losses = losses self.draws = draw...
[ [ 3, 0, 0.5455, 1, 0, 0.66, 0, 458, 0, 1, 0, 0, 0, 0, 0 ], [ 2, 1, 0.5909, 0.9091, 1, 0.21, 0, 555, 0, 9, 0, 0, 0, 0, 0 ], [ 14, 2, 0.3636, 0.0909, 2, 0.59, 0, ...
[ "class Rating:\n def __init__(self, type, elo, deviation = 0, wins = 0, losses = 0,\n draws = 0, bestElo = 0, bestTime = 0):\n self.type = type\n self.elo = elo\n self.deviation = deviation\n self.wins = wins\n self.losses = losses", " def ...
from const import * reprResult_long = { DRAW: _("The game ended in a draw"), WHITEWON: _("%(white)s won the game"), BLACKWON: _("%(black)s won the game"), KILLED: _("The game has been killed"), ADJOURNED: _("The game has been adjourned"), ABORTED: _("The game has been aborted"), } reprReason_l...
[ [ 1, 0, 0.0217, 0.0217, 0, 0.66, 0, 798, 0, 1, 0, 0, 798, 0, 0 ], [ 14, 0, 0.1413, 0.1739, 0, 0.66, 0.5, 919, 0, 0, 0, 0, 0, 6, 6 ], [ 14, 0, 0.6304, 0.7609, 0, 0.6...
[ "from const import *", "reprResult_long = {\n DRAW: _(\"The game ended in a draw\"),\n WHITEWON: _(\"%(white)s won the game\"),\n BLACKWON: _(\"%(black)s won the game\"),\n KILLED: _(\"The game has been killed\"),\n ADJOURNED: _(\"The game has been adjourned\"),\n ABORTED: _(\"The game has been ...
import os.path from pychess.Utils.const import * from pychess.System import tsqlite from pychess.System.prefix import addDataPrefix path = os.path.join(addDataPrefix("open.db")) tsqlite.connect(path) import atexit atexit.register(tsqlite.close) def getOpenings (board): return tsqlite.execSQL ( "select m...
[ [ 1, 0, 0.0065, 0.0065, 0, 0.66, 0, 79, 0, 1, 0, 0, 79, 0, 0 ], [ 1, 0, 0.0195, 0.0065, 0, 0.66, 0.0714, 297, 0, 1, 0, 0, 297, 0, 0 ], [ 1, 0, 0.026, 0.0065, 0, 0.6...
[ "import os.path", "from pychess.Utils.const import *", "from pychess.System import tsqlite", "from pychess.System.prefix import addDataPrefix", "path = os.path.join(addDataPrefix(\"open.db\"))", "tsqlite.connect(path)", "import atexit", "atexit.register(tsqlite.close)", "def getOpenings (board):\n ...
import heapq from time import time from gobject import SIGNAL_RUN_FIRST, TYPE_NONE, GObject from pychess.Utils.const import WHITE, BLACK from pychess.System import repeat class TimeModel (GObject): __gsignals__ = { "player_changed": (SIGNAL_RUN_FIRST, TYPE_NONE, ()), "time_changed": (SIGNAL_RU...
[ [ 1, 0, 0.0048, 0.0048, 0, 0.66, 0, 251, 0, 1, 0, 0, 251, 0, 0 ], [ 1, 0, 0.0096, 0.0048, 0, 0.66, 0.2, 654, 0, 1, 0, 0, 654, 0, 0 ], [ 1, 0, 0.0144, 0.0048, 0, 0.6...
[ "import heapq", "from time import time", "from gobject import SIGNAL_RUN_FIRST, TYPE_NONE, GObject", "from pychess.Utils.const import WHITE, BLACK", "from pychess.System import repeat", "class TimeModel (GObject):\n \n __gsignals__ = {\n \"player_changed\": (SIGNAL_RUN_FIRST, TYPE_NONE, ()),\...
from const import KING, QUEEN, ROOK, BISHOP, KNIGHT, PAWN from const import reprSign, reprColor, reprPiece class Piece: def __init__ (self, color, piece): self.color = color self.piece = piece self.opacity = 1.0 self.x = None self.y = None # Sign is a depre...
[ [ 1, 0, 0.0312, 0.0312, 0, 0.66, 0, 798, 0, 6, 0, 0, 798, 0, 0 ], [ 1, 0, 0.0625, 0.0312, 0, 0.66, 0.5, 798, 0, 3, 0, 0, 798, 0, 0 ], [ 3, 0, 0.5625, 0.9062, 0, 0.6...
[ "from const import KING, QUEEN, ROOK, BISHOP, KNIGHT, PAWN", "from const import reprSign, reprColor, reprPiece", "class Piece:\n def __init__ (self, color, piece):\n self.color = color\n self.piece = piece\n \n self.opacity = 1.0\n self.x = None\n self.y = None", "...
from gtk import icon_theme_get_default, ICON_LOOKUP_USE_BUILTIN from pychess.System.Log import log it = icon_theme_get_default() def load_icon(size, *alternatives): alternatives = list(alternatives) name = alternatives.pop(0) try: return it.load_icon(name, size, ICON_LOOKUP_USE_BUILTIN) except:...
[ [ 1, 0, 0.0769, 0.0769, 0, 0.66, 0, 166, 0, 2, 0, 0, 166, 0, 0 ], [ 1, 0, 0.1538, 0.0769, 0, 0.66, 0.3333, 954, 0, 1, 0, 0, 954, 0, 0 ], [ 14, 0, 0.3077, 0.0769, 0, ...
[ "from gtk import icon_theme_get_default, ICON_LOOKUP_USE_BUILTIN", "from pychess.System.Log import log", "it = icon_theme_get_default()", "def load_icon(size, *alternatives):\n alternatives = list(alternatives)\n name = alternatives.pop(0)\n try:\n return it.load_icon(name, size, ICON_LOOKUP_U...
### DEPRECATED ### SHOULD ONLY BE USED AS A REFERENCE TO MAKE leval pieceValues = [0, 900, 500, 350, 300, 100] from pychess.Utils.const import * # these tables will be used for positional bonuses: # from array import array whiteknight = array('b', [ -20, -35,-10, -10, -10,-10, -35, -20, -1...
[ [ 14, 0, 0.0083, 0.0017, 0, 0.66, 0, 106, 0, 0, 0, 0, 0, 5, 0 ], [ 1, 0, 0.0117, 0.0017, 0, 0.66, 0.0303, 297, 0, 1, 0, 0, 297, 0, 0 ], [ 1, 0, 0.0184, 0.0017, 0, 0...
[ "pieceValues = [0, 900, 500, 350, 300, 100]", "from pychess.Utils.const import *", "from array import array", "whiteknight = array('b', [\n -20, -35,-10, -10, -10,-10, -35, -20,\n -10, 0, 0, 3, 3, 0, 0, -10,\n -10, 0, 15, 15, 15, 15, 0, -10,\n -10, ...
""" This module provides some basic functions for accessing pychess datefiles in system or user space """ import os import sys from os import makedirs from os.path import isdir, join, dirname, abspath ################################################################################ # Locate files in system space ...
[ [ 1, 0, 0.0244, 0.0244, 0, 0.66, 0, 688, 0, 1, 0, 0, 688, 0, 0 ], [ 1, 0, 0.0488, 0.0244, 0, 0.66, 0.0833, 509, 0, 1, 0, 0, 509, 0, 0 ], [ 1, 0, 0.0732, 0.0244, 0, ...
[ "import os", "import sys", "from os import makedirs", "from os.path import isdir, join, dirname, abspath", "def addDataPrefix (subpath):\n return abspath (join (_prefix, subpath))", " return abspath (join (_prefix, subpath))", "def getDataPrefix ():\n return _prefix", " return _prefix", ...
import traceback from threading import RLock, currentThread from gtk.gdk import threads_enter, threads_leave _rlock = RLock() def has(): me = currentThread() if type(_rlock._RLock__owner) == int: return _rlock._RLock__owner == me._Thread__ident return _rlock._RLock__owner == me def acquire(): ...
[ [ 1, 0, 0.013, 0.013, 0, 0.66, 0, 423, 0, 1, 0, 0, 423, 0, 0 ], [ 1, 0, 0.026, 0.013, 0, 0.66, 0.1, 83, 0, 2, 0, 0, 83, 0, 0 ], [ 1, 0, 0.039, 0.013, 0, 0.66, 0...
[ "import traceback", "from threading import RLock, currentThread", "from gtk.gdk import threads_enter, threads_leave", "_rlock = RLock()", "def has():\n me = currentThread()\n if type(_rlock._RLock__owner) == int:\n return _rlock._RLock__owner == me._Thread__ident\n return _rlock._RLock__owne...
from array import array class MultiArray: def __init__ (self, oneLineData, *lengths): self.lengths = lengths self.data = oneLineData def get (self, *indexes): index = 0 for depth, i in enumerate(indexes[::-1]): index += i*self.lengths[depth]**depth retu...
[ [ 1, 0, 0.0769, 0.0769, 0, 0.66, 0, 80, 0, 1, 0, 0, 80, 0, 0 ], [ 3, 0, 0.6154, 0.8462, 0, 0.66, 1, 356, 0, 2, 0, 0, 0, 0, 1 ], [ 2, 1, 0.4615, 0.2308, 1, 0.36, ...
[ "from array import array", "class MultiArray:\n\n def __init__ (self, oneLineData, *lengths):\n self.lengths = lengths\n self.data = oneLineData\n \n def get (self, *indexes):\n index = 0", " def __init__ (self, oneLineData, *lengths):\n self.lengths = lengths\n se...
# -*- coding: UTF-8 -*- import time from pychess.System.ThreadPool import pool def repeat (func, *args, **kwargs): """ Repeats a function in a new thread until it returns False """ def run (): while func(*args, **kwargs): pass pool.start(run) def repeat_sleep (func, sleeptime, recur=F...
[ [ 1, 0, 0.0909, 0.0303, 0, 0.66, 0, 654, 0, 1, 0, 0, 654, 0, 0 ], [ 1, 0, 0.1212, 0.0303, 0, 0.66, 0.3333, 626, 0, 1, 0, 0, 626, 0, 0 ], [ 2, 0, 0.2576, 0.1818, 0, ...
[ "import time", "from pychess.System.ThreadPool import pool", "def repeat (func, *args, **kwargs):\n \"\"\" Repeats a function in a new thread until it returns False \"\"\"\n def run ():\n while func(*args, **kwargs):\n pass\n pool.start(run)", " \"\"\" Repeats a function in a new...
""" This is a dictionary, that supports a max of items. This is good for the transportation table, as some old entries might not be useable any more, as the position has totally changed """ from UserDict import UserDict from threading import Lock class LimitedDict (UserDict): def __init__ (self, maxSize):...
[ [ 8, 0, 0.0714, 0.1071, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.1786, 0.0357, 0, 0.66, 0.3333, 351, 0, 1, 0, 0, 351, 0, 0 ], [ 1, 0, 0.2143, 0.0357, 0, 0.66...
[ "\"\"\" This is a dictionary, that supports a max of items.\n This is good for the transportation table, as some old entries might not\n be useable any more, as the position has totally changed \"\"\"", "from UserDict import UserDict", "from threading import Lock", "class LimitedDict (UserDict):\n de...
import gconf from os.path import normpath GDIR = '/apps/pychess/' c = gconf.client_get_default() c.add_dir(GDIR[:-1], gconf.CLIENT_PRELOAD_NONE) def notify_add (key, func): key = normpath(GDIR+key) return c.notify_add(key, func) def notify_remove (conid): c.notify_remove(conid) def get (key): key = ...
[ [ 1, 0, 0.0213, 0.0213, 0, 0.66, 0, 367, 0, 1, 0, 0, 367, 0, 0 ], [ 1, 0, 0.0426, 0.0213, 0, 0.66, 0.1, 79, 0, 1, 0, 0, 79, 0, 0 ], [ 14, 0, 0.0851, 0.0213, 0, 0.66...
[ "import gconf", "from os.path import normpath", "GDIR = '/apps/pychess/'", "c = gconf.client_get_default()", "c.add_dir(GDIR[:-1], gconf.CLIENT_PRELOAD_NONE)", "def notify_add (key, func):\n key = normpath(GDIR+key)\n return c.notify_add(key, func)", " key = normpath(GDIR+key)", " return c...
# -*- coding: UTF-8 -*- from threading import Thread from subprocess import * import select, signal, re, os, atexit from gobject import GObject, SIGNAL_RUN_FIRST from pychess.System import glock from pychess.System.Log import log from pychess.System.SubProcess import SubProcess, SubProcessError, searchPath from pych...
[ [ 1, 0, 0.0312, 0.0104, 0, 0.66, 0, 83, 0, 1, 0, 0, 83, 0, 0 ], [ 1, 0, 0.0417, 0.0104, 0, 0.66, 0.1, 394, 0, 1, 0, 0, 394, 0, 0 ], [ 1, 0, 0.0521, 0.0104, 0, 0.66,...
[ "from threading import Thread", "from subprocess import *", "import select, signal, re, os, atexit", "from gobject import GObject, SIGNAL_RUN_FIRST", "from pychess.System import glock", "from pychess.System.Log import log", "from pychess.System.SubProcess import SubProcess, SubProcessError, searchPath",...
from threading import Thread import Queue from gobject import GObject, SIGNAL_RUN_FIRST from ThreadPool import PooledThread import glock # # IDEA: We could implement gdk prioritizing by using a global PriorityQueue # class Publisher (PooledThread): """ Publisher can be used when a thread is often spitting out r...
[ [ 1, 0, 0.0032, 0.0032, 0, 0.66, 0, 83, 0, 1, 0, 0, 83, 0, 0 ], [ 1, 0, 0.0065, 0.0032, 0, 0.66, 0.125, 952, 0, 1, 0, 0, 952, 0, 0 ], [ 1, 0, 0.013, 0.0032, 0, 0.66...
[ "from threading import Thread", "import Queue", "from gobject import GObject, SIGNAL_RUN_FIRST", "from ThreadPool import PooledThread", "import glock", "class Publisher (PooledThread):\n \"\"\" Publisher can be used when a thread is often spitting out results,\n and you want to process these res...
# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/475160 # Was accepted into Python 2.5, but earlier versions still have # to do stuff manually import threading from Queue import Queue def TaskQueue (): if hasattr(Queue, "task_done"): return Queue() return _TaskQueue() class _TaskQueue(Queue)...
[ [ 1, 0, 0.0794, 0.0159, 0, 0.66, 0, 83, 0, 1, 0, 0, 83, 0, 0 ], [ 1, 0, 0.0952, 0.0159, 0, 0.66, 0.3333, 952, 0, 1, 0, 0, 952, 0, 0 ], [ 2, 0, 0.1508, 0.0635, 0, 0....
[ "import threading", "from Queue import Queue", "def TaskQueue ():\n if hasattr(Queue, \"task_done\"):\n return Queue()\n return _TaskQueue()", " if hasattr(Queue, \"task_done\"):\n return Queue()", " return Queue()", " return _TaskQueue()", "class _TaskQueue(Queue):\n\n ...
""" The task of this module is to provide easy saving/loading of configurations It also supports gconf like connection, so you get notices when a property has changed. """ # gconf's notify all seams to be broken #try: # import gconf # import conf_gconf as confmodule #except: import conf_configParser as c...
[ [ 8, 0, 0.0385, 0.0577, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.1923, 0.0192, 0, 0.66, 0.1, 535, 0, 1, 0, 0, 535, 0, 0 ], [ 8, 0, 0.2308, 0.0192, 0, 0.66, ...
[ "\"\"\" The task of this module is to provide easy saving/loading of configurations\n It also supports gconf like connection, so you get notices when a property\n has changed. \"\"\"", "import conf_configParser as confmodule", "\"\"\"Module for using gconf without having to care about types\"\"\"", "def...
from ctypes import * l=CDLL('librsvg-2-2.dll') g=CDLL('libgobject-2.0-0.dll') g.g_type_init() class rsvgHandle(): class RsvgDimensionData(Structure): _fields_ = [("width", c_int), ("height", c_int), ("em",c_double), ("ex",c_double)] class Py...
[ [ 1, 0, 0.0238, 0.0238, 0, 0.66, 0, 182, 0, 1, 0, 0, 182, 0, 0 ], [ 14, 0, 0.0714, 0.0238, 0, 0.66, 0.1667, 810, 3, 1, 0, 0, 453, 10, 1 ], [ 14, 0, 0.0952, 0.0238, 0, ...
[ "from ctypes import *", "l=CDLL('librsvg-2-2.dll')", "g=CDLL('libgobject-2.0-0.dll')", "g.g_type_init()", "class rsvgHandle():\n class RsvgDimensionData(Structure):\n _fields_ = [(\"width\", c_int),\n (\"height\", c_int),\n (\"em\",c_double),\n ...
# Upside-down Chess # http://en.wikipedia.org/wiki/Chess_variant#Chess_with_different_starting_positions from pychess.Utils.const import * from pychess.Utils.Board import Board UPSIDEDOWNSTART = "RNBQKBNR/PPPPPPPP/8/8/8/8/pppppppp/rnbqkbnr w - - 0 1" class UpsideDownBoard(Board): variant = UPSIDEDOWNCHESS ...
[ [ 1, 0, 0.1481, 0.037, 0, 0.66, 0, 297, 0, 1, 0, 0, 297, 0, 0 ], [ 1, 0, 0.1852, 0.037, 0, 0.66, 0.25, 208, 0, 1, 0, 0, 208, 0, 0 ], [ 14, 0, 0.2593, 0.037, 0, 0.66...
[ "from pychess.Utils.const import *", "from pychess.Utils.Board import Board", "UPSIDEDOWNSTART = \"RNBQKBNR/PPPPPPPP/8/8/8/8/pppppppp/rnbqkbnr w - - 0 1\"", "class UpsideDownBoard(Board):\n variant = UPSIDEDOWNCHESS\n\n def __init__ (self, setup=False):\n if setup is True:\n Board.__in...
# Corner Chess # http://brainking.com/en/GameRules?tp=2 # * placement of the pieces on the 1st and 8th row are randomized # * the king is in the right hand corner # * bishops must start on opposite color squares # * black's starting position is obtained by rotating white's position 180 degrees around the board's cente...
[ [ 1, 0, 0.2, 0.02, 0, 0.66, 0, 715, 0, 1, 0, 0, 715, 0, 0 ], [ 1, 0, 0.24, 0.02, 0, 0.66, 0.2, 297, 0, 1, 0, 0, 297, 0, 0 ], [ 1, 0, 0.26, 0.02, 0, 0.66, 0.4, ...
[ "import random", "from pychess.Utils.const import *", "from pychess.Utils.Board import Board", "class CornerBoard(Board):\n variant = CORNERCHESS\n\n def __init__ (self, setup=False):\n if setup is True:\n Board.__init__(self, setup=self.shuffle_start())\n else:\n Boa...
# Shuffle Chess # nocastle variant in xboard terms: http://tim-mann.org/xboard/engine-intf.html#8 # This is FICS wild/2 (http://www.freechess.org/Help/HelpFiles/wild.html) # * Random arrangement of the pieces behind the pawns # * No castling # * Black's arrangement mirrors white's import random from pychess.Utils.con...
[ [ 1, 0, 0.1818, 0.0227, 0, 0.66, 0, 715, 0, 1, 0, 0, 715, 0, 0 ], [ 1, 0, 0.2273, 0.0227, 0, 0.66, 0.2, 297, 0, 1, 0, 0, 297, 0, 0 ], [ 1, 0, 0.25, 0.0227, 0, 0.66,...
[ "import random", "from pychess.Utils.const import *", "from pychess.Utils.Board import Board", "class ShuffleBoard(Board):\n variant = SHUFFLECHESS\n\n def __init__ (self, setup=False):\n if setup is True:\n Board.__init__(self, setup=self.shuffle_start())\n else:\n B...
# Losers Chess # http://www.freechess.org/Help/HelpFiles/losers_chess.html from pychess.Utils.const import * from pychess.Utils.lutils.bitboard import bitLength from pychess.Utils.Board import Board class LosersBoard(Board): variant = LOSERSCHESS class LosersChess: name = _("Losers") cecp_name = "loser...
[ [ 1, 0, 0.1481, 0.037, 0, 0.66, 0, 297, 0, 1, 0, 0, 297, 0, 0 ], [ 1, 0, 0.1852, 0.037, 0, 0.66, 0.2, 396, 0, 1, 0, 0, 396, 0, 0 ], [ 1, 0, 0.2222, 0.037, 0, 0.66, ...
[ "from pychess.Utils.const import *", "from pychess.Utils.lutils.bitboard import bitLength", "from pychess.Utils.Board import Board", "class LosersBoard(Board):\n variant = LOSERSCHESS", " variant = LOSERSCHESS", "class LosersChess:\n name = _(\"Losers\")\n cecp_name = \"losers\"\n board = L...
# Random Chess # This is FICS wild/3 (http://www.freechess.org/Help/HelpFiles/wild.html) # * Randomly chosen pieces (two queens or three rooks possible) # * Exactly one king of each color # * Pieces placed randomly behind the pawns # * No castling # * Black's arrangement mirrors white's import random from pychess.Uti...
[ [ 1, 0, 0.1957, 0.0217, 0, 0.66, 0, 715, 0, 1, 0, 0, 715, 0, 0 ], [ 1, 0, 0.2391, 0.0217, 0, 0.66, 0.2, 297, 0, 1, 0, 0, 297, 0, 0 ], [ 1, 0, 0.2609, 0.0217, 0, 0.6...
[ "import random", "from pychess.Utils.const import *", "from pychess.Utils.Board import Board", "class RandomBoard(Board):\n variant = RANDOMCHESS\n\n def __init__ (self, setup=False):\n if setup is True:\n Board.__init__(self, setup=self.random_start())\n else:\n Boar...
from pychess.Utils.const import * from pychess.Utils.Board import Board QUEENODDSSTART = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNB1KBNR w KQkq - 0 1" class QueenOddsBoard(Board): variant = QUEENODDSCHESS def __init__ (self, setup=False): if setup is True: Board.__init__(self, setup=QUEENODD...
[ [ 1, 0, 0.0435, 0.0435, 0, 0.66, 0, 297, 0, 1, 0, 0, 297, 0, 0 ], [ 1, 0, 0.087, 0.0435, 0, 0.66, 0.25, 208, 0, 1, 0, 0, 208, 0, 0 ], [ 14, 0, 0.1739, 0.0435, 0, 0....
[ "from pychess.Utils.const import *", "from pychess.Utils.Board import Board", "QUEENODDSSTART = \"rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNB1KBNR w KQkq - 0 1\"", "class QueenOddsBoard(Board):\n variant = QUEENODDSCHESS\n\n def __init__ (self, setup=False):\n if setup is True:\n Board.__in...
from pychess.Utils.const import * from pychess.Utils.Board import Board PAWNODDSSTART = "rnbqkbnr/ppppp1pp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1" class PawnOddsBoard(Board): variant = PAWNODDSCHESS def __init__ (self, setup=False): if setup is True: Board.__init__(self, setup=PAWNODDSSTA...
[ [ 1, 0, 0.0435, 0.0435, 0, 0.66, 0, 297, 0, 1, 0, 0, 297, 0, 0 ], [ 1, 0, 0.087, 0.0435, 0, 0.66, 0.25, 208, 0, 1, 0, 0, 208, 0, 0 ], [ 14, 0, 0.1739, 0.0435, 0, 0....
[ "from pychess.Utils.const import *", "from pychess.Utils.Board import Board", "PAWNODDSSTART = \"rnbqkbnr/ppppp1pp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1\"", "class PawnOddsBoard(Board):\n variant = PAWNODDSCHESS\n\n def __init__ (self, setup=False):\n if setup is True:\n Board.__init_...
# AsymmetricRandom Chess # This is FICS wild/4 (http://www.freechess.org/Help/HelpFiles/wild.html) # * Randomly chosen pieces (two queens or three rooks possible) # * Exactly one king of each color # * Pieces placed randomly behind the pawns, SUBJECT TO THE CONSTRAINT # THAT THE BISHOPS ARE BALANCED # * No...
[ [ 1, 0, 0.0971, 0.0097, 0, 0.66, 0, 715, 0, 1, 0, 0, 715, 0, 0 ], [ 1, 0, 0.1165, 0.0097, 0, 0.66, 0.2, 297, 0, 1, 0, 0, 297, 0, 0 ], [ 1, 0, 0.1262, 0.0097, 0, 0.6...
[ "import random", "from pychess.Utils.const import *", "from pychess.Utils.Board import Board", "class AsymmetricRandomBoard(Board):\n variant = ASYMMETRICRANDOMCHESS\n\n def __init__ (self, setup=False):\n if setup is True:\n Board.__init__(self, setup=self.asymmetricrandom_start())\n ...
# Pawns Passed Chess # White pawns start on 5th rank and black pawns on the 4th rank from pychess.Utils.const import * from pychess.Utils.Board import Board PAWNSPASSEDSTART = "rnbqkbnr/8/8/PPPPPPPP/pppppppp/8/8/RNBQKBNR w - - 0 1" class PawnsPassedBoard(Board): variant = PAWNSPASSEDCHESS def __init__ (sel...
[ [ 1, 0, 0.1538, 0.0385, 0, 0.66, 0, 297, 0, 1, 0, 0, 297, 0, 0 ], [ 1, 0, 0.1923, 0.0385, 0, 0.66, 0.25, 208, 0, 1, 0, 0, 208, 0, 0 ], [ 14, 0, 0.2692, 0.0385, 0, 0...
[ "from pychess.Utils.const import *", "from pychess.Utils.Board import Board", "PAWNSPASSEDSTART = \"rnbqkbnr/8/8/PPPPPPPP/pppppppp/8/8/RNBQKBNR w - - 0 1\"", "class PawnsPassedBoard(Board):\n variant = PAWNSPASSEDCHESS\n\n def __init__ (self, setup=False):\n if setup is True:\n Board._...
from pychess.Utils.Board import Board class NormalChess: name = _("Normal") cecp_name = "normal" board = Board need_initial_board = False standard_rules = True
[ [ 1, 0, 0.1, 0.1, 0, 0.66, 0, 208, 0, 1, 0, 0, 208, 0, 0 ], [ 3, 0, 0.65, 0.6, 0, 0.66, 1, 214, 0, 0, 0, 0, 0, 0, 1 ], [ 14, 1, 0.5, 0.1, 1, 0.09, 0, 57, ...
[ "from pychess.Utils.Board import Board", "class NormalChess:\n name = _(\"Normal\")\n cecp_name = \"normal\"\n board = Board\n need_initial_board = False\n standard_rules = True", " name = _(\"Normal\")", " cecp_name = \"normal\"", " board = Board", " need_initial_board = False"...
from pychess.Utils.const import * from normal import NormalChess from corner import CornerChess from shuffle import ShuffleChess from fischerandom import FischerRandomChess from randomchess import RandomChess from asymmetricrandom import AsymmetricRandomChess from upsidedown import UpsideDownChess from pawnspushed impo...
[ [ 1, 0, 0.0323, 0.0323, 0, 0.66, 0, 297, 0, 1, 0, 0, 297, 0, 0 ], [ 1, 0, 0.0645, 0.0323, 0, 0.66, 0.0667, 444, 0, 1, 0, 0, 444, 0, 0 ], [ 1, 0, 0.0968, 0.0323, 0, ...
[ "from pychess.Utils.const import *", "from normal import NormalChess", "from corner import CornerChess", "from shuffle import ShuffleChess", "from fischerandom import FischerRandomChess", "from randomchess import RandomChess", "from asymmetricrandom import AsymmetricRandomChess", "from upsidedown impo...
from pychess.Utils.const import * from pychess.Utils.Board import Board KNIGHTODDSSTART = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/R1BQKBNR w KQkq - 0 1" class KnightOddsBoard(Board): variant = KNIGHTODDSCHESS def __init__ (self, setup=False): if setup is True: Board.__init__(self, setup=KNIGH...
[ [ 1, 0, 0.0435, 0.0435, 0, 0.66, 0, 297, 0, 1, 0, 0, 297, 0, 0 ], [ 1, 0, 0.087, 0.0435, 0, 0.66, 0.25, 208, 0, 1, 0, 0, 208, 0, 0 ], [ 14, 0, 0.1739, 0.0435, 0, 0....
[ "from pychess.Utils.const import *", "from pychess.Utils.Board import Board", "KNIGHTODDSSTART = \"rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/R1BQKBNR w KQkq - 0 1\"", "class KnightOddsBoard(Board):\n variant = KNIGHTODDSCHESS\n\n def __init__ (self, setup=False):\n if setup is True:\n Board._...
# Pawns Pushed Chess # Pawns start on 4th and 5th ranks rather than 2nd and 7th from pychess.Utils.const import * from pychess.Utils.Board import Board PAWNSPUSHEDSTART = "rnbqkbnr/8/8/pppppppp/PPPPPPPP/8/8/RNBQKBNR w - - 0 1" class PawnsPushedBoard(Board): variant = PAWNSPUSHEDCHESS def __init__ (self, se...
[ [ 1, 0, 0.1538, 0.0385, 0, 0.66, 0, 297, 0, 1, 0, 0, 297, 0, 0 ], [ 1, 0, 0.1923, 0.0385, 0, 0.66, 0.25, 208, 0, 1, 0, 0, 208, 0, 0 ], [ 14, 0, 0.2692, 0.0385, 0, 0...
[ "from pychess.Utils.const import *", "from pychess.Utils.Board import Board", "PAWNSPUSHEDSTART = \"rnbqkbnr/8/8/pppppppp/PPPPPPPP/8/8/RNBQKBNR w - - 0 1\"", "class PawnsPushedBoard(Board):\n variant = PAWNSPUSHEDCHESS\n\n def __init__ (self, setup=False):\n if setup is True:\n Board._...
# Chess960 (Fischer Random Chess) # http://en.wikipedia.org/wiki/Chess960 import random from copy import copy from pychess.Utils.const import * from pychess.Utils.Cord import Cord from pychess.Utils.Board import Board from pychess.Utils.Piece import Piece from pychess.Utils.lutils.bitboard import * from pychess.Utils...
[ [ 1, 0, 0.0097, 0.0024, 0, 0.66, 0, 715, 0, 1, 0, 0, 715, 0, 0 ], [ 1, 0, 0.0121, 0.0024, 0, 0.66, 0.0833, 739, 0, 1, 0, 0, 739, 0, 0 ], [ 1, 0, 0.017, 0.0024, 0, 0...
[ "import random", "from copy import copy", "from pychess.Utils.const import *", "from pychess.Utils.Cord import Cord", "from pychess.Utils.Board import Board", "from pychess.Utils.Piece import Piece", "from pychess.Utils.lutils.bitboard import *", "from pychess.Utils.lutils.attack import *", "from py...
from pychess.Utils.const import * from pychess.Utils.Board import Board ROOKODDSSTART = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/1NBQKBNR w Kkq - 0 1" class RookOddsBoard(Board): variant = ROOKODDSCHESS def __init__ (self, setup=False): if setup is True: Board.__init__(self, setup=ROOKODDSSTAR...
[ [ 1, 0, 0.0435, 0.0435, 0, 0.66, 0, 297, 0, 1, 0, 0, 297, 0, 0 ], [ 1, 0, 0.087, 0.0435, 0, 0.66, 0.25, 208, 0, 1, 0, 0, 208, 0, 0 ], [ 14, 0, 0.1739, 0.0435, 0, 0....
[ "from pychess.Utils.const import *", "from pychess.Utils.Board import Board", "ROOKODDSSTART = \"rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/1NBQKBNR w Kkq - 0 1\"", "class RookOddsBoard(Board):\n variant = ROOKODDSCHESS\n\n def __init__ (self, setup=False):\n if setup is True:\n Board.__init__...
VERSION = "0.10" VERSION_NAME = "Staunton"
[ [ 14, 0, 0.5, 0.5, 0, 0.66, 0, 557, 1, 0, 0, 0, 0, 3, 0 ], [ 14, 0, 1, 0.5, 0, 0.66, 1, 916, 1, 0, 0, 0, 0, 3, 0 ] ]
[ "VERSION = \"0.10\"", "VERSION_NAME = \"Staunton\"" ]
#!/usr/bin/env python # Copyright 2012 Google Inc. All Rights Reserved. # 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...
[ [ 8, 0, 0.1635, 0.1195, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.2327, 0.0063, 0, 0.66, 0.1667, 540, 0, 1, 0, 0, 540, 0, 0 ], [ 3, 0, 0.2547, 0.0126, 0, 0.66...
[ "\"\"\"Valgrind-style suppressions for find_js_leaks reports.\n\nThe format of the suppressions is modelled after the suppression format used\nby valgrind.\n\nSuppressions are defined as follows (short description, name of the leaking\nclass, and at least one frame is required):", "import re", "class Error(Exce...
#!/usr/bin/env python # Copyright 2012 Google Inc. All Rights Reserved. # 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...
[ [ 8, 0, 0.2931, 0.0172, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.3276, 0.0172, 0, 0.66, 0.5, 540, 0, 1, 0, 0, 540, 0, 0 ], [ 3, 0, 0.6897, 0.6379, 0, 0.66, ...
[ "\"\"\"Helper for parsing stacktraces generated by V8 and JSC.\"\"\"", "import re", "class Stack(object):\n \"\"\"Represents a stack trace as generated by WebKit.\"\"\"\n\n # The member vm will be set to one of these constants to indiciate what\n # JavaScript vm generated the stack trace.\n V8 = 'v8'\n JSC...
#!/usr/bin/env python # Copyright 2012 Google Inc. All Rights Reserved. # 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...
[ [ 8, 0, 0.1181, 0.0069, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.1319, 0.0069, 0, 0.66, 0.1429, 641, 0, 1, 0, 0, 641, 0, 0 ], [ 1, 0, 0.1458, 0.0069, 0, 0.66...
[ "\"\"\"Tests stacktrace.\"\"\"", "import textwrap", "import googletest", "import stacktrace", "class ParseV8FrameTest(googletest.TestCase):\n def _ParseV8Frame(self, frame):\n return stacktrace.Stack('Error\\n%s' % frame).frames[0]\n\n def testConstructor(self):\n fun = self._ParseV8Frame(' at ne...
#!/usr/bin/env python # Copyright 2012 Google Inc. All Rights Reserved. # 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...
[ [ 8, 0, 0.0489, 0.0474, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.0765, 0.0015, 0, 0.66, 0.125, 386, 0, 1, 0, 0, 386, 0, 0 ], [ 1, 0, 0.0795, 0.0015, 0, 0.66,...
[ "\"\"\"Tool for finding possibly leaking JavaScript objects based on heap snapshots.\n\nHow does it work?\n\nSince JavaScript is a garbage collected language, all objects have one or\nseveral retaining paths which keep the object alive.\n\nThis tool finds objects which are only retained (kept alive) by a specified ...
#!/usr/bin/env python # Copyright 2012 Google Inc. All Rights Reserved. # 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...
[ [ 8, 0, 0.1371, 0.0081, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.1532, 0.0081, 0, 0.66, 0.1429, 609, 0, 1, 0, 0, 609, 0, 0 ], [ 1, 0, 0.1613, 0.0081, 0, 0.66...
[ "\"\"\"Tests Suppressions.\"\"\"", "import StringIO", "import textwrap", "import googletest", "import suppressions", "class SuppressionTest(googletest.TestCase):\n def testEmpty(self):\n supp = suppressions.Suppression('', '', [])\n self.assertFalse(supp.Match('', []))\n self.assertFalse(supp.Ma...
#!/usr/bin/env python # Copyright 2012 Google Inc. All Rights Reserved. # 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...
[ [ 8, 0, 0.0612, 0.0239, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.0776, 0.003, 0, 0.66, 0.0714, 715, 0, 1, 0, 0, 715, 0, 0 ], [ 1, 0, 0.0806, 0.003, 0, 0.66, ...
[ "\"\"\"Tool for finding memory leaks in JavaScript applications.\n\nTo use, run Chrome with a single tab open, and with the following command line\nflags:\n\n --remote-debugging-port=9222 --js-flags=--stack_trace_limit=-1\n\n\"\"\"", "import logging", "import optparse", "import sys", "import leak_finder", ...
#!/usr/bin/env python # Copyright 2012 Google Inc. All Rights Reserved. # 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...
[ [ 8, 0, 0.4474, 0.0263, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.5, 0.0263, 0, 0.66, 0.25, 534, 0, 1, 0, 0, 534, 0, 0 ], [ 1, 0, 0.5526, 0.0263, 0, 0.66, ...
[ "\"\"\"Tests JSLeakCheck.\"\"\"", "import googletest", "import jsleakcheck", "class LeakDefinitionTest(googletest.TestCase):\n def testConstruction(self):\n definition = jsleakcheck.LeakDefinition('desc', 'file.txt', ['container'],\n ['node'])\n\n self.assertE...
#!/usr/bin/env python # Copyright 2012 Google Inc. All Rights Reserved. # 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...
[ [ 8, 0, 0.0543, 0.0032, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.0607, 0.0032, 0, 0.66, 0.2, 88, 0, 1, 0, 0, 88, 0, 0 ], [ 1, 0, 0.0671, 0.0032, 0, 0.66, ...
[ "\"\"\"Tests LeakFinder.\"\"\"", "import unittest", "import simplejson", "import leak_finder", "class LeakFinderTest(unittest.TestCase):\n\n def _GetLists(self, generator):\n lists = []\n for i in generator:\n lists.append(list(i))\n return lists", " def _GetLists(self, generator):\n li...
deps = { "pyautolib": "svn://svn.chromium.org/chrome/trunk/src/chrome/test/pyautolib", }
[ [ 14, 0, 0.5, 0.8, 0, 0.66, 0, 565, 0, 0, 0, 0, 0, 6, 0 ] ]
[ "deps = {\n \"pyautolib\":\n \"svn://svn.chromium.org/chrome/trunk/src/chrome/test/pyautolib\",\n}" ]
# -*- coding: utf-8 -*- # # Copyright © 2009-2010 Pierre Raybaut # Licensed under the terms of the MIT License # (see spyderlib/__init__.py for details) from guidata.gettext_helpers import do_compile if __name__ == "__main__": do_compile("spyderlib") do_compile("p_pylint", "spyderplugins") do_c...
[ [ 1, 0, 0.5833, 0.0833, 0, 0.66, 0, 814, 0, 1, 0, 0, 814, 0, 0 ], [ 4, 0, 0.875, 0.3333, 0, 0.66, 1, 0, 0, 0, 0, 0, 0, 0, 3 ], [ 8, 1, 0.8333, 0.0833, 1, 0.59, ...
[ "from guidata.gettext_helpers import do_compile", "if __name__ == \"__main__\":\n do_compile(\"spyderlib\")\n do_compile(\"p_pylint\", \"spyderplugins\")\n do_compile(\"p_profiler\", \"spyderplugins\")", " do_compile(\"spyderlib\")", " do_compile(\"p_pylint\", \"spyderplugins\")", " do_com...
import rope.base.evaluate from rope.base import change, pyobjects, exceptions, pynames, worder, codeanalyze from rope.refactor import sourceutils, importutils, functionutils, suites def create_generate(kind, project, resource, offset): """A factory for creating `Generate` objects `kind` can be 'variable', 'f...
[ [ 1, 0, 0.0028, 0.0028, 0, 0.66, 0, 790, 0, 1, 0, 0, 790, 0, 0 ], [ 1, 0, 0.0056, 0.0028, 0, 0.66, 0.0714, 632, 0, 6, 0, 0, 632, 0, 0 ], [ 1, 0, 0.0085, 0.0028, 0, ...
[ "import rope.base.evaluate", "from rope.base import change, pyobjects, exceptions, pynames, worder, codeanalyze", "from rope.refactor import sourceutils, importutils, functionutils, suites", "def create_generate(kind, project, resource, offset):\n \"\"\"A factory for creating `Generate` objects\n\n `kin...
"""Fix the name of modules This module is useful when you want to rename many of the modules in your project. That can happen specially when you want to change their naming style. For instance:: fixer = FixModuleNames(project) changes = fixer.get_changes(fixer=str.lower) project.do(changes) Here it renames a...
[ [ 8, 0, 0.1304, 0.2464, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.2609, 0.0145, 0, 0.66, 0.25, 632, 0, 2, 0, 0, 632, 0, 0 ], [ 1, 0, 0.2754, 0.0145, 0, 0.66, ...
[ "\"\"\"Fix the name of modules\n\nThis module is useful when you want to rename many of the modules in\nyour project. That can happen specially when you want to change their\nnaming style.\n\nFor instance::", "from rope.base import change, taskhandle", "from rope.contrib import changestack", "from rope.refac...
import rope.base.codeanalyze import rope.base.evaluate import rope.base.pyobjects from rope.base import taskhandle, exceptions, worder from rope.contrib import fixsyntax from rope.refactor import occurrences def find_occurrences(project, resource, offset, unsure=False, resources=None, in_hierarch...
[ [ 1, 0, 0.0091, 0.0091, 0, 0.66, 0, 341, 0, 1, 0, 0, 341, 0, 0 ], [ 1, 0, 0.0182, 0.0091, 0, 0.66, 0.1, 790, 0, 1, 0, 0, 790, 0, 0 ], [ 1, 0, 0.0273, 0.0091, 0, 0.6...
[ "import rope.base.codeanalyze", "import rope.base.evaluate", "import rope.base.pyobjects", "from rope.base import taskhandle, exceptions, worder", "from rope.contrib import fixsyntax", "from rope.refactor import occurrences", "def find_occurrences(project, resource, offset, unsure=False, resources=None,...
"""For performing many refactorings as a single command `changestack` module can be used to perform many refactorings on top of each other as one bigger command. It can be used like:: stack = ChangeStack(project, 'my big command') #.. stack.push(refactoring1.get_changes()) #.. stack.push(refactoring2.get_...
[ [ 8, 0, 0.1923, 0.3654, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.4038, 0.0192, 0, 0.66, 0.5, 632, 0, 1, 0, 0, 632, 0, 0 ], [ 3, 0, 0.7308, 0.5577, 0, 0.66, ...
[ "\"\"\"For performing many refactorings as a single command\n\n`changestack` module can be used to perform many refactorings on top\nof each other as one bigger command. It can be used like::\n\n stack = ChangeStack(project, 'my big command')\n\n #..", "from rope.base import change", "class ChangeStack(objec...
import re from rope.base import (exceptions, pynames, resourceobserver, taskhandle, pyobjects, builtins, resources) from rope.refactor import importutils class AutoImport(object): """A class for finding the module that provides a name This class maintains a cache of global names in py...
[ [ 1, 0, 0.0046, 0.0046, 0, 0.66, 0, 540, 0, 1, 0, 0, 540, 0, 0 ], [ 1, 0, 0.0161, 0.0092, 0, 0.66, 0.25, 632, 0, 7, 0, 0, 632, 0, 0 ], [ 1, 0, 0.023, 0.0046, 0, 0.6...
[ "import re", "from rope.base import (exceptions, pynames, resourceobserver,\n taskhandle, pyobjects, builtins, resources)", "from rope.refactor import importutils", "class AutoImport(object):\n \"\"\"A class for finding the module that provides a name\n\n This class maintains a cac...
"""Finding bad name and attribute accesses `find_errors` function can be used to find possible bad name and attribute accesses. As an example:: errors = find_errors(project, project.get_resource('mod.py')) for error in errors: print '%s: %s' % (error.lineno, error.error) prints possible errors for ``mod.p...
[ [ 8, 0, 0.1429, 0.2747, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.2857, 0.011, 0, 0.66, 0.25, 632, 0, 3, 0, 0, 632, 0, 0 ], [ 2, 0, 0.3626, 0.0989, 0, 0.66, ...
[ "\"\"\"Finding bad name and attribute accesses\n\n`find_errors` function can be used to find possible bad name and\nattribute accesses. As an example::\n\n errors = find_errors(project, project.get_resource('mod.py'))\n for error in errors:\n print '%s: %s' % (error.lineno, error.error)", "from rope.base ...
"""rope IDE tools package This package contains modules that can be used in IDEs but do not depend on the UI. So these modules will be used by `rope.ui` modules. """
[ [ 8, 0, 0.5714, 1, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ] ]
[ "\"\"\"rope IDE tools package\n\nThis package contains modules that can be used in IDEs\nbut do not depend on the UI. So these modules will be used\nby `rope.ui` modules.\n\n\"\"\"" ]
"""Provides classes for persisting `PyObject`\s""" import os import re import rope.base.builtins from rope.base import exceptions class PyObjectToTextual(object): """For transforming `PyObject` to textual form This can be used for storing `PyObjects` in files. Use `TextualToPyObject` for converting bac...
[ [ 8, 0, 0.0035, 0.0035, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.007, 0.0035, 0, 0.66, 0.1429, 688, 0, 1, 0, 0, 688, 0, 0 ], [ 1, 0, 0.0105, 0.0035, 0, 0.66,...
[ "\"\"\"Provides classes for persisting `PyObject`\\s\"\"\"", "import os", "import re", "import rope.base.builtins", "from rope.base import exceptions", "class PyObjectToTextual(object):\n \"\"\"For transforming `PyObject` to textual form\n\n This can be used for storing `PyObjects` in files. Use\n ...
import UserDict class ObjectDB(object): def __init__(self, db, validation): self.db = db self.validation = validation self.observers = [] self.files = db.files def validate_files(self): for file in list(self.files): if not self.validation.is_file_valid(fil...
[ [ 1, 0, 0.0057, 0.0057, 0, 0.66, 0, 351, 0, 1, 0, 0, 351, 0, 0 ], [ 3, 0, 0.2886, 0.5371, 0, 0.66, 0.1429, 130, 0, 16, 0, 0, 186, 0, 39 ], [ 2, 1, 0.0457, 0.0286, 1, ...
[ "import UserDict", "class ObjectDB(object):\n\n def __init__(self, db, validation):\n self.db = db\n self.validation = validation\n self.observers = []\n self.files = db.files", " def __init__(self, db, validation):\n self.db = db\n self.validation = validation\n ...
import warnings from rope.base import exceptions, resourceobserver from rope.base.oi import objectdb, memorydb, transform class ObjectInfoManager(object): """Stores object information It uses an instance of `objectdb.ObjectDB` for storing information. """ def __init__(self, project): s...
[ [ 1, 0, 0.0043, 0.0043, 0, 0.66, 0, 358, 0, 1, 0, 0, 358, 0, 0 ], [ 1, 0, 0.0129, 0.0043, 0, 0.66, 0.2, 632, 0, 2, 0, 0, 632, 0, 0 ], [ 1, 0, 0.0172, 0.0043, 0, 0.6...
[ "import warnings", "from rope.base import exceptions, resourceobserver", "from rope.base.oi import objectdb, memorydb, transform", "class ObjectInfoManager(object):\n \"\"\"Stores object information\n\n It uses an instance of `objectdb.ObjectDB` for storing\n information.\n\n \"\"\"", " \"\"\...
"""A module for inferring objects For more information see the documentation in `rope.base.oi` package. """ import rope.base.builtins import rope.base.pynames import rope.base.pyobjects from rope.base import evaluate, utils, arguments _ignore_inferred = utils.ignore_exception( rope.base.pyobjects.IsBeingInferre...
[ [ 8, 0, 0.0188, 0.0323, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.0376, 0.0054, 0, 0.66, 0.0556, 74, 0, 1, 0, 0, 74, 0, 0 ], [ 1, 0, 0.043, 0.0054, 0, 0.66, ...
[ "\"\"\"A module for inferring objects\n\nFor more information see the documentation in `rope.base.oi`\npackage.\n\n\"\"\"", "import rope.base.builtins", "import rope.base.pynames", "import rope.base.pyobjects", "from rope.base import evaluate, utils, arguments", "_ignore_inferred = utils.ignore_exception(...
import rope.base.ast import rope.base.oi.soi import rope.base.pynames from rope.base import pyobjects, evaluate, astutils, arguments def analyze_module(pycore, pymodule, should_analyze, search_subscopes, followed_calls): """Analyze `pymodule` for static object inference Analyzes scopes for...
[ [ 1, 0, 0.0074, 0.0074, 0, 0.66, 0, 442, 0, 1, 0, 0, 442, 0, 0 ], [ 1, 0, 0.0147, 0.0074, 0, 0.66, 0.1429, 666, 0, 1, 0, 0, 666, 0, 0 ], [ 1, 0, 0.0221, 0.0074, 0, ...
[ "import rope.base.ast", "import rope.base.oi.soi", "import rope.base.pynames", "from rope.base import pyobjects, evaluate, astutils, arguments", "def analyze_module(pycore, pymodule, should_analyze,\n search_subscopes, followed_calls):\n \"\"\"Analyze `pymodule` for static object infere...
"""Rope object analysis and inference package Rope makes some simplifying assumptions about a python program. It assumes that a program only performs assignments and function calls. Tracking assignments is simple and `PyName` objects handle that. The main problem is function calls. Rope uses these two approaches fo...
[ [ 8, 0, 0.5132, 1, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ] ]
[ "\"\"\"Rope object analysis and inference package\n\nRope makes some simplifying assumptions about a python program. It\nassumes that a program only performs assignments and function calls.\nTracking assignments is simple and `PyName` objects handle that. The\nmain problem is function calls. Rope uses these two ...
from rope.base.oi import objectdb class MemoryDB(objectdb.FileDict): def __init__(self, project, persist=None): self.project = project self._persist = persist self.files = self self._load_files() self.project.data_files.add_write_hook(self.write) def _load_files(self)...
[ [ 1, 0, 0.0094, 0.0094, 0, 0.66, 0, 897, 0, 1, 0, 0, 897, 0, 0 ], [ 3, 0, 0.283, 0.5, 0, 0.66, 0.3333, 835, 0, 11, 0, 0, 28, 0, 8 ], [ 2, 1, 0.0802, 0.0566, 1, 0.86...
[ "from rope.base.oi import objectdb", "class MemoryDB(objectdb.FileDict):\n\n def __init__(self, project, persist=None):\n self.project = project\n self._persist = persist\n self.files = self\n self._load_files()\n self.project.data_files.add_write_hook(self.write)", " de...
def __rope_start_everything(): import os import sys import socket import cPickle as pickle import marshal import inspect import types import threading class _MessageSender(object): def send_data(self, data): pass class _SocketSender(_MessageSender): ...
[ [ 2, 0, 0.4952, 0.9762, 0, 0.66, 0, 940, 0, 0, 1, 0, 0, 0, 83 ], [ 1, 1, 0.0143, 0.0048, 1, 0.01, 0, 688, 0, 1, 0, 0, 688, 0, 0 ], [ 1, 1, 0.019, 0.0048, 1, 0.01, ...
[ "def __rope_start_everything():\n import os\n import sys\n import socket\n import cPickle as pickle\n import marshal\n import inspect\n import types", " import os", " import sys", " import socket", " import cPickle as pickle", " import marshal", " import inspect", ...
import warnings def saveit(func): """A decorator that caches the return value of a function""" name = '_' + func.__name__ def _wrapper(self, *args, **kwds): if not hasattr(self, name): setattr(self, name, func(self, *args, **kwds)) return getattr(self, name) return _wrappe...
[ [ 1, 0, 0.0128, 0.0128, 0, 0.66, 0, 358, 0, 1, 0, 0, 358, 0, 0 ], [ 2, 0, 0.1026, 0.1154, 0, 0.66, 0.1429, 877, 0, 1, 1, 0, 0, 0, 4 ], [ 8, 1, 0.0641, 0.0128, 1, 0....
[ "import warnings", "def saveit(func):\n \"\"\"A decorator that caches the return value of a function\"\"\"\n\n name = '_' + func.__name__\n def _wrapper(self, *args, **kwds):\n if not hasattr(self, name):\n setattr(self, name, func(self, *args, **kwds))\n return getattr(self, nam...
from rope.base import exceptions, change, taskhandle class History(object): """A class that holds project history""" def __init__(self, project, maxundos=None): self.project = project self._undo_list = [] self._redo_list = [] self._maxundos = maxundos self._load_histor...
[ [ 1, 0, 0.0043, 0.0043, 0, 0.66, 0, 632, 0, 3, 0, 0, 632, 0, 0 ], [ 3, 0, 0.4468, 0.8638, 0, 0.66, 0.5, 941, 0, 22, 0, 0, 186, 0, 72 ], [ 8, 1, 0.0213, 0.0043, 1, 0...
[ "from rope.base import exceptions, change, taskhandle", "class History(object):\n \"\"\"A class that holds project history\"\"\"\n\n def __init__(self, project, maxundos=None):\n self.project = project\n self._undo_list = []\n self._redo_list = []\n self._maxundos = maxundos", ...
"""A few useful functions for using rope as a library""" import os.path import rope.base.project import rope.base.pycore from rope.base import taskhandle def path_to_resource(project, path, type=None): """Get the resource at path You only need to specify `type` if `path` does not exist. It can be eithe...
[ [ 8, 0, 0.0154, 0.0154, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.0308, 0.0154, 0, 0.66, 0.125, 79, 0, 1, 0, 0, 79, 0, 0 ], [ 1, 0, 0.0615, 0.0154, 0, 0.66, ...
[ "\"\"\"A few useful functions for using rope as a library\"\"\"", "import os.path", "import rope.base.project", "import rope.base.pycore", "from rope.base import taskhandle", "def path_to_resource(project, path, type=None):\n \"\"\"Get the resource at path\n\n You only need to specify `type` if `pat...
import os class ResourceObserver(object): """Provides the interface for observing resources `ResourceObserver`\s can be registered using `Project. add_observer()`. But most of the time `FilteredResourceObserver` should be used. `ResourceObserver`\s report all changes passed to them and they don...
[ [ 1, 0, 0.0037, 0.0037, 0, 0.66, 0, 688, 0, 1, 0, 0, 688, 0, 0 ], [ 3, 0, 0.1107, 0.1956, 0, 0.66, 0.25, 384, 0, 6, 0, 0, 186, 0, 5 ], [ 8, 1, 0.0406, 0.048, 1, 0.9...
[ "import os", "class ResourceObserver(object):\n \"\"\"Provides the interface for observing resources\n\n `ResourceObserver`\\s can be registered using `Project.\n add_observer()`. But most of the time `FilteredResourceObserver`\n should be used. `ResourceObserver`\\s report all changes passed\n t...
import rope.base.builtins import rope.base.pynames import rope.base.pyobjects from rope.base import ast, astutils, exceptions, pyobjects, arguments, worder BadIdentifierError = exceptions.BadIdentifierError def eval_location(pymodule, offset): """Find the pyname at the offset""" return eval_location2(pymodul...
[ [ 1, 0, 0.0032, 0.0032, 0, 0.66, 0, 74, 0, 1, 0, 0, 74, 0, 0 ], [ 1, 0, 0.0063, 0.0032, 0, 0.66, 0.0769, 903, 0, 1, 0, 0, 903, 0, 0 ], [ 1, 0, 0.0095, 0.0032, 0, 0....
[ "import rope.base.builtins", "import rope.base.pynames", "import rope.base.pyobjects", "from rope.base import ast, astutils, exceptions, pyobjects, arguments, worder", "BadIdentifierError = exceptions.BadIdentifierError", "def eval_location(pymodule, offset):\n \"\"\"Find the pyname at the offset\"\"\"...
import rope.base.pyobjects from rope.base import exceptions, utils class PyName(object): """References to `PyObject`\s inside python programs""" def get_object(self): """Return the `PyObject` object referenced by this `PyName`""" def get_definition_location(self): """Return a (module, li...
[ [ 1, 0, 0.005, 0.005, 0, 0.66, 0, 626, 0, 1, 0, 0, 626, 0, 0 ], [ 1, 0, 0.0101, 0.005, 0, 0.66, 0.0769, 632, 0, 2, 0, 0, 632, 0, 0 ], [ 3, 0, 0.0427, 0.0402, 0, 0.6...
[ "import rope.base.pyobjects", "from rope.base import exceptions, utils", "class PyName(object):\n \"\"\"References to `PyObject`\\s inside python programs\"\"\"\n\n def get_object(self):\n \"\"\"Return the `PyObject` object referenced by this `PyName`\"\"\"\n\n def get_definition_location(self):...
class RopeError(Exception): """Base exception for rope""" class ResourceNotFoundError(RopeError): """Resource not found exception""" class RefactoringError(RopeError): """Errors for performing a refactoring""" class InterruptedTaskError(RopeError): """The task has been interrupted""" class Histo...
[ [ 3, 0, 0.0246, 0.0328, 0, 0.66, 0, 367, 0, 0, 0, 0, 645, 0, 0 ], [ 8, 1, 0.0328, 0.0164, 1, 0.48, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 3, 0, 0.0902, 0.0328, 0, 0.66, ...
[ "class RopeError(Exception):\n \"\"\"Base exception for rope\"\"\"", " \"\"\"Base exception for rope\"\"\"", "class ResourceNotFoundError(RopeError):\n \"\"\"Resource not found exception\"\"\"", " \"\"\"Resource not found exception\"\"\"", "class RefactoringError(RopeError):\n \"\"\"Errors fo...
import bisect import rope.base.simplify def get_name_at(resource, offset): source_code = resource.read() word_finder = Worder(source_code) return word_finder.get_word_at(offset) class Worder(object): """A class for finding boundaries of words and expressions Note that in these methods, offset ...
[ [ 1, 0, 0.002, 0.002, 0, 0.66, 0, 325, 0, 1, 0, 0, 325, 0, 0 ], [ 1, 0, 0.0059, 0.002, 0, 0.66, 0.25, 910, 0, 1, 0, 0, 910, 0, 0 ], [ 2, 0, 0.0147, 0.0079, 0, 0.66,...
[ "import bisect", "import rope.base.simplify", "def get_name_at(resource, offset):\n source_code = resource.read()\n word_finder = Worder(source_code)\n return word_finder.get_word_at(offset)", " source_code = resource.read()", " word_finder = Worder(source_code)", " return word_finder.ge...
"""A module to ease code analysis This module is here to help source code analysis. """ import re from rope.base import codeanalyze, utils @utils.cached(7) def real_code(source): """Simplify `source` for analysis It replaces: * comments with spaces * strs with a new str filled with spaces * im...
[ [ 8, 0, 0.0455, 0.0727, 0, 0.66, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 1, 0, 0.0909, 0.0182, 0, 0.66, 0.1667, 540, 0, 1, 0, 0, 540, 0, 0 ], [ 1, 0, 0.1273, 0.0182, 0, 0.66...
[ "\"\"\"A module to ease code analysis\n\nThis module is here to help source code analysis.\n\"\"\"", "import re", "from rope.base import codeanalyze, utils", "def real_code(source):\n \"\"\"Simplify `source` for analysis\n\n It replaces:\n\n * comments with spaces\n * strs with a new str filled wi...
import warnings from rope.base import exceptions class TaskHandle(object): def __init__(self, name='Task', interrupts=True): """Construct a TaskHandle If `interrupts` is `False` the task won't be interrupted by calling `TaskHandle.stop()`. """ self.name = name s...
[ [ 1, 0, 0.0075, 0.0075, 0, 0.66, 0, 358, 0, 1, 0, 0, 358, 0, 0 ], [ 1, 0, 0.0226, 0.0075, 0, 0.66, 0.2, 632, 0, 1, 0, 0, 632, 0, 0 ], [ 3, 0, 0.2293, 0.3759, 0, 0.6...
[ "import warnings", "from rope.base import exceptions", "class TaskHandle(object):\n\n def __init__(self, name='Task', interrupts=True):\n \"\"\"Construct a TaskHandle\n\n If `interrupts` is `False` the task won't be interrupted by\n calling `TaskHandle.stop()`.", " def __init__(self...