code stringlengths 1 1.49M | file_id stringlengths 42 46 | node_count int64 0 7.38k | total_lines int64 1 20.9k | vector_dim int64 15 15 | vector_labels stringclasses 1
value | nodes stringlengths 2 3.75M | connections stringlengths 2 964k |
|---|---|---|---|---|---|---|---|
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... | ajibawa-2023/Python-Code-Large/train/row_89889 | 113 | 190 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89889:ImportFrom_L1_C0", "label": "from math import float_ceil", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0053, 0.0053, 0, 0.66, 0.0, 526, 0, 1, 0, 0, 526, 0, 0], "semantic": {"name": "math", "arg_names": [], "import_names": ["floa... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89889:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89889:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89889:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89889:FunctionDef_L23_C4"}, {"f": "ajibawa-2023/Python-Cod... |
import gtk
#===============================================================================
# Composite Constants
#===============================================================================
POSITIONS_COUNT = 5
NORTH, EAST, SOUTH, WEST, CENTER = range(POSITIONS_COUNT)
#===========================================... | ajibawa-2023/Python-Code-Large/train/row_89890 | 71 | 133 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89890:Import_L1_C0", "label": "gtk import gtk", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0075, 0.0075, 0, 0.66, 0.0, 166, 0, 1, 0, 0, 166, 0, 0], "semantic": {"name": "gtk", "arg_names": [], "import_names": ["gtk"], "rhs_call_name"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89890:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89890:FunctionDef_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89890:FunctionDef_L15_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_89890:Expr_L16_C8"}, {"f": "ajibawa-2023/Python-Co... |
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... | ajibawa-2023/Python-Code-Large/train/row_89891 | 42 | 78 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89891:ImportFrom_L1_C0", "label": "from Throbber import Throbber", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0128, 0.0128, 0, 0.66, 0.0, 695, 0, 1, 0, 0, 695, 0, 0], "semantic": {"name": "Throbber", "arg_names": [], "import_names": ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89891:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89891:FunctionDef_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89891:FunctionDef_L17_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_89891:Assign_L19_C8"}, {"f": "ajibawa-2023/Python-... |
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)... | ajibawa-2023/Python-Code-Large/train/row_89892 | 53 | 71 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89892:Import_L1_C0", "label": "gtk import gtk, gobject", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0141, 0.0141, 0, 0.66, 0.0, 166, 0, 2, 0, 0, 166, 0, 0], "semantic": {"name": "gtk", "arg_names": [], "import_names": ["gtk", "gobjec... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89892:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89892:If_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89892:If_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_89892:Expr_L9_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_... |
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 ... | ajibawa-2023/Python-Code-Large/train/row_89893 | 283 | 469 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89893:Import_L1_C0", "label": "sys import sys, os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0021, 0.0021, 0, 0.66, 0.0, 509, 0, 2, 0, 0, 509, 0, 0], "semantic": {"name": "sys", "arg_names": [], "import_names": ["sys", "os"], "rhs_... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89893:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89893:If_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89893:If_L13_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_89893:Expr_L14_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/... |
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... | ajibawa-2023/Python-Code-Large/train/row_89894 | 32 | 43 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89894:Import_L1_C0", "label": "gtk import gtk", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0233, 0.0233, 0, 0.66, 0.0, 166, 0, 1, 0, 0, 166, 0, 0], "semantic": {"name": "gtk", "arg_names": [], "import_names": ["gtk"], "rhs_call_name"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89894:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89894:FunctionDef_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89894:FunctionDef_L16_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_89894:Assign_L17_C8"}, {"f": "ajibawa-2023/Python-... |
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
... | ajibawa-2023/Python-Code-Large/train/row_89895 | 19 | 24 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89895:Import_L1_C0", "label": "gtk import gtk", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0417, 0.0417, 0, 0.66, 0.0, 166, 0, 1, 0, 0, 166, 0, 0], "semantic": {"name": "gtk", "arg_names": [], "import_names": ["gtk"], "rhs_call_name"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89895:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89895:FunctionDef_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89895:FunctionDef_L7_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_89895:Expr_L8_C8"}, {"f": "ajibawa-2023/Python-Code-L... |
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 ... | ajibawa-2023/Python-Code-Large/train/row_89896 | 169 | 253 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89896:Import_L1_C0", "label": "math import math, random", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.004, 0.004, 0, 0.66, 0.0, 526, 0, 2, 0, 0, 526, 0, 0], "semantic": {"name": "math", "arg_names": [], "import_names": ["math", "rando... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89896:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89896:FunctionDef_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89896:FunctionDef_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_89896:Expr_L27_C8"}, {"f": "ajibawa-2023/Python-Co... |
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... | ajibawa-2023/Python-Code-Large/train/row_89898 | 102 | 131 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89898:Import_L1_C0", "label": "pygtk import pygtk", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0076, 0.0076, 0, 0.66, 0.0, 106, 0, 1, 0, 0, 106, 0, 0], "semantic": {"name": "pygtk", "arg_names": [], "import_names": ["pygtk"], "rhs_ca... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89898:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89898:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89898:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89898:FunctionDef_L14_C4"}, {"f": "ajibawa-2023/Python-Cod... |
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... | ajibawa-2023/Python-Code-Large/train/row_89899 | 31 | 41 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89899:Import_L1_C0", "label": "gamewidget import gamewidget", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0244, 0.0244, 0, 0.66, 0.0, 632, 0, 1, 0, 0, 632, 0, 0], "semantic": {"name": "gamewidget", "arg_names": [], "import_names": ["g... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89899:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89899:If_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89899:If_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_89899:Expr_L7_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_... |
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(... | ajibawa-2023/Python-Code-Large/train/row_89900 | 61 | 88 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89900:Import_L1_C0", "label": "gtk import gtk", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0114, 0.0114, 0, 0.66, 0.0, 166, 0, 1, 0, 0, 166, 0, 0], "semantic": {"name": "gtk", "arg_names": [], "import_names": ["gtk"], "rhs_call_name"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89900:ClassDef_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89900:FunctionDef_L3_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89900:FunctionDef_L3_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_89900:Expr_L5_C8"}, {"f": "ajibawa-2023/Python-Code-L... |
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... | ajibawa-2023/Python-Code-Large/train/row_89901 | 35 | 67 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89901:Import_L1_C0", "label": "datetime import datetime", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0149, 0.0149, 0, 0.66, 0.0, 426, 0, 1, 0, 0, 426, 0, 0], "semantic": {"name": "datetime", "arg_names": [], "import_names": ["datetim... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89901:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89901:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89901:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89901:FunctionDef_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
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, ... | ajibawa-2023/Python-Code-Large/train/row_89903 | 25 | 39 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89903:ImportFrom_L1_C0", "label": "from pychess.Utils.Cord import Cord", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0256, 0.0256, 0, 0.66, 0.0, 507, 0, 1, 0, 0, 507, 0, 0], "semantic": {"name": "pychess.Utils.Cord", "arg_names": [], ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89903:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89903:Expr_L13_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89903:FunctionDef_L12_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89903:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
__all__ = ["fen", "epd", "pgn",'chessalpha2']
| ajibawa-2023/Python-Code-Large/train/row_89904 | 1 | 1 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89904:Assign_L1_C0", "label": "__all__ =", "type": "assigned_variable", "loc": [1, 1], "level": 0, "parent": null, "vector": [14, 0, 1.0, 1.0, 0, 0.66, 0.0, 272, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "__all__", "arg_names": [], "import_names": [], "rhs_call_name": ... | [] |
# -*- 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 ... | ajibawa-2023/Python-Code-Large/train/row_89905 | 100 | 147 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89905:Import_L3_C0", "label": "re import re", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0204, 0.0068, 0, 0.66, 0.0, 540, 0, 1, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["re"], "rhs_call_name": ""... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89905:FunctionDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89905:For_L41_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89905:For_L41_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_89905:Assign_L42_C8"}, {"f": "ajibawa-2023/Python-Code-Large/tr... |
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... | ajibawa-2023/Python-Code-Large/train/row_89907 | 194 | 310 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89907:ImportFrom_L1_C0", "label": "from __future__ import with_statement", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0032, 0.0032, 0, 0.66, 0.0, 777, 0, 1, 0, 0, 777, 0, 0], "semantic": {"name": "__future__", "arg_names": [], "impor... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89907:ClassDef_L36_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89907:FunctionDef_L38_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89907:FunctionDef_L38_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_89907:If_L40_C8"}, {"f": "ajibawa-2023/Python-Code... |
""" 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... | ajibawa-2023/Python-Code-Large/train/row_89908 | 97 | 137 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89908:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0146, 0.0219, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89908:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89908:Assign_L18_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89908:FunctionDef_L17_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89908:For_L19_C4"}, {"f": "ajibawa-2023/Python-Code-... |
# -*- coding: UTF-8 -*-
################################################################################
# PyChess information #
################################################################################
NAME = "PyChess"
ENGINES_XML_API_VERSION = "0.10.1"... | ajibawa-2023/Python-Code-Large/train/row_89909 | 66 | 220 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89909:Assign_L7_C0", "label": "NAME =", "type": "assigned_variable", "loc": [7, 7], "level": 0, "parent": null, "vector": [14, 0, 0.0318, 0.0045, 0, 0.66, 0.0, 181, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "NAME", "arg_names": [], "import_names": [], "rhs_call_name": ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89909:For_L186_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89909:Assign_L187_C4"}] |
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)
... | ajibawa-2023/Python-Code-Large/train/row_89910 | 15 | 25 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89910:ImportFrom_L1_C0", "label": "from pychess.Utils.const import ACTIONS", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.04, 0.04, 0, 0.66, 0.0, 297, 0, 1, 0, 0, 297, 0, 0], "semantic": {"name": "pychess.Utils.const", "arg_names": [],... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89910:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89910:FunctionDef_L4_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89910:FunctionDef_L4_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_89910:Assign_L8_C8"}, {"f": "ajibawa-2023/Python-Code... |
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
... | ajibawa-2023/Python-Code-Large/train/row_89911 | 175 | 239 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89911:ImportFrom_L1_C0", "label": "from copy import copy", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0042, 0.0042, 0, 0.66, 0.0, 739, 0, 1, 0, 0, 739, 0, 0], "semantic": {"name": "copy", "arg_names": [], "import_names": ["copy"], "r... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89911:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89911:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89911:ClassDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89911:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
################################################################################
# The purpose of this module, is to give a certain position a score. The #
# greater the score, the better the position #
############################################################################... | ajibawa-2023/Python-Code-Large/train/row_89912 | 271 | 600 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89912:ImportFrom_L7_C0", "label": "from pychess.Utils.const import *", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.0117, 0.0017, 0, 0.66, 0.0, 297, 0, 1, 0, 0, 297, 0, 0], "semantic": {"name": "pychess.Utils.const", "arg_names": [], "... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89912:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89912:Expr_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89912:FunctionDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89912:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code... |
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):
... | ajibawa-2023/Python-Code-Large/train/row_89913 | 62 | 84 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89913:ImportFrom_L1_C0", "label": "from UserDict import UserDict", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0119, 0.0119, 0, 0.66, 0.0, 351, 0, 1, 0, 0, 351, 0, 0], "semantic": {"name": "UserDict", "arg_names": [], "import_names": ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89913:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89913:FunctionDef_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89913:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_89913:Assign_L11_C8"}, {"f": "ajibawa-2023/Python-Cod... |
from lmove import *
from pychess.Utils.const import *
from bitboard import *
from attack import *
################################################################################
# Validate move #
###########################################################... | ajibawa-2023/Python-Code-Large/train/row_89914 | 95 | 200 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89914:ImportFrom_L1_C0", "label": "from lmove import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.005, 0.005, 0, 0.66, 0.0, 960, 0, 1, 0, 0, 960, 0, 0], "semantic": {"name": "lmove", "arg_names": [], "import_names": ["*"], "rhs_cal... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89914:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89914:Assign_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89914:FunctionDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89914:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Co... |
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... | ajibawa-2023/Python-Code-Large/train/row_89915 | 164 | 285 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89915:ImportFrom_L1_C0", "label": "from time import time", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0035, 0.0035, 0, 0.66, 0.0, 654, 0, 1, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["time"], "r... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89915:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89915:Expr_L28_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89915:FunctionDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89915:Assign_L42_C4"}, {"f": "ajibawa-2023/Python-Code... |
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
################################################################################
###############... | ajibawa-2023/Python-Code-Large/train/row_89917 | 208 | 601 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89917:ImportFrom_L1_C0", "label": "from array import array", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0017, 0.0017, 0, 0.66, 0.0, 80, 0, 1, 0, 0, 80, 0, 0], "semantic": {"name": "array", "arg_names": [], "import_names": ["array"], ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89917:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89917:Return_L6_C17"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89917:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89917:Return_L7_C17"}, {"f": "ajibawa-2023/Python-Code... |
from bitboard import *
from attack import *
from pychess.Utils.const import *
from lmove import newMove
################################################################################
# Generate all moves #
####################################################... | ajibawa-2023/Python-Code-Large/train/row_89919 | 292 | 477 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89919:ImportFrom_L2_C0", "label": "from bitboard import *", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0042, 0.0021, 0, 0.66, 0.0, 866, 0, 1, 0, 0, 866, 0, 0], "semantic": {"name": "bitboard", "arg_names": [], "import_names": ["*"], ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89919:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89919:FunctionDef_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89919:FunctionDef_L12_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_89919:If_L13_C8"}, {"f": "ajibawa-2023/Python-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... | ajibawa-2023/Python-Code-Large/train/row_89920 | 41 | 76 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89920:ImportFrom_L2_C0", "label": "from attack import getAttacks, staticExchangeEvaluate", "type": "import", "loc": [2, 2], "level": 0, "parent": null, "vector": [1, 0, 0.0263, 0.0132, 0, 0.66, 0.0, 424, 0, 2, 0, 0, 424, 0, 0], "semantic": {"name": "attack", "arg_names"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89920:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89920:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89920:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89920:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-... |
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... | ajibawa-2023/Python-Code-Large/train/row_89922 | 43 | 89 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89922:ImportFrom_L1_C0", "label": "from bitboard import bitLength", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0112, 0.0112, 0, 0.66, 0.0, 866, 0, 1, 0, 0, 866, 0, 0], "semantic": {"name": "bitboard", "arg_names": [], "import_names":... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89922:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89922:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89922:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89922:For_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Larg... |
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
#==============... | ajibawa-2023/Python-Code-Large/train/row_89923 | 90 | 174 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89923:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0057, 0.0057, 0, 0.66, 0.0, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": ""... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89923:Try_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89923:ImportFrom_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89923:Try_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89923:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/r... |
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... | ajibawa-2023/Python-Code-Large/train/row_89924 | 171 | 316 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89924:ImportFrom_L1_C0", "label": "from bitboard import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0032, 0.0032, 0, 0.66, 0.0, 866, 0, 1, 0, 0, 866, 0, 0], "semantic": {"name": "bitboard", "arg_names": [], "import_names": ["*"], ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89924:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89924:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89924:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89924:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code... |
"""
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... | ajibawa-2023/Python-Code-Large/train/row_89925 | 390 | 678 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89925:Expr_L2_C0", "label": "expression", "type": "expression", "loc": [2, 7], "level": 0, "parent": null, "vector": [8, 0, 0.0066, 0.0088, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89925:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89925:If_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89925:If_L19_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_89925:Return_L20_C8"}, {"f": "ajibawa-2023/Python-Code-Large/trai... |
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... | ajibawa-2023/Python-Code-Large/train/row_89926 | 10 | 11 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89926:ClassDef_L1_C0", "label": "Rating", "type": "class", "loc": [1, 11], "level": 0, "parent": null, "vector": [3, 0, 0.5455, 1.0, 0, 0.66, 0.0, 458, 0, 1, 0, 0, 0, 0, 0], "semantic": {"name": "Rating", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89926:ClassDef_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89926:FunctionDef_L2_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89926:FunctionDef_L2_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_89926:Assign_L4_C8"}, {"f": "ajibawa-2023/Python-Code... |
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... | ajibawa-2023/Python-Code-Large/train/row_89927 | 3 | 46 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89927:ImportFrom_L1_C0", "label": "from const import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0217, 0.0217, 0, 0.66, 0.0, 798, 0, 1, 0, 0, 798, 0, 0], "semantic": {"name": "const", "arg_names": [], "import_names": ["*"], "rhs_c... | [] |
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... | ajibawa-2023/Python-Code-Large/train/row_89928 | 112 | 154 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89928:Import_L1_C0", "label": "os.path import os.path", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0065, 0.0065, 0, 0.66, 0.0, 79, 0, 1, 0, 0, 79, 0, 0], "semantic": {"name": "os.path", "arg_names": [], "import_names": ["os.path"], "... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89928:FunctionDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89928:Return_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89928:FunctionDef_L20_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89928:Assign_L21_C4"}, {"f": "ajibawa-2023/Python-Co... |
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... | ajibawa-2023/Python-Code-Large/train/row_89932 | 120 | 208 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89932:Import_L1_C0", "label": "heapq import heapq", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0048, 0.0048, 0, 0.66, 0.0, 251, 0, 1, 0, 0, 251, 0, 0], "semantic": {"name": "heapq", "arg_names": [], "import_names": ["heapq"], "rhs_ca... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89932:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89932:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89932:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89932:FunctionDef_L20_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
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... | ajibawa-2023/Python-Code-Large/train/row_89933 | 21 | 32 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89933:ImportFrom_L1_C0", "label": "from const import KING, QUEEN, ROOK\u2026", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0312, 0.0312, 0, 0.66, 0.0, 798, 0, 6, 0, 0, 798, 0, 0], "semantic": {"name": "const", "arg_names": [], "import... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89933:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89933:FunctionDef_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89933:FunctionDef_L5_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_89933:Assign_L6_C8"}, {"f": "ajibawa-2023/Python-Code... |
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:... | ajibawa-2023/Python-Code-Large/train/row_89934 | 11 | 13 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89934:ImportFrom_L1_C0", "label": "from gtk import icon_theme_get_default, ICON_LOOKUP_USE_BUILTIN", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0769, 0.0769, 0, 0.66, 0.0, 166, 0, 2, 0, 0, 166, 0, 0], "semantic": {"name": "gtk", "arg... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89934:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89934:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89934:FunctionDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89934:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
### 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... | ajibawa-2023/Python-Code-Large/train/row_89935 | 188 | 599 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89935:Assign_L5_C0", "label": "pieceValues =", "type": "assigned_variable", "loc": [5, 5], "level": 0, "parent": null, "vector": [14, 0, 0.0083, 0.0017, 0, 0.66, 0.0, 106, 0, 0, 0, 0, 0, 5, 0], "semantic": {"name": "pieceValues", "arg_names": [], "import_names": [], "rh... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89935:For_L267_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89935:For_L268_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89935:For_L268_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_89935:For_L269_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/row... |
"""
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 ... | ajibawa-2023/Python-Code-Large/train/row_89936 | 34 | 41 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89936:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0244, 0.0244, 0, 0.66, 0.0, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": ""... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89936:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89936:Return_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89936:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89936:Return_L10_C4"}, {"f": "ajibawa-2023/Python-Code-... |
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():
... | ajibawa-2023/Python-Code-Large/train/row_89937 | 58 | 77 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89937:Import_L1_C0", "label": "traceback import traceback", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.013, 0.013, 0, 0.66, 0.0, 423, 0, 1, 0, 0, 423, 0, 0], "semantic": {"name": "traceback", "arg_names": [], "import_names": ["traceb... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89937:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89937:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89937:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89937:If_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
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... | ajibawa-2023/Python-Code-Large/train/row_89938 | 9 | 13 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89938:ImportFrom_L1_C0", "label": "from array import array", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0769, 0.0769, 0, 0.66, 0.0, 80, 0, 1, 0, 0, 80, 0, 0], "semantic": {"name": "array", "arg_names": [], "import_names": ["array"], ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89938:ClassDef_L3_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89938:FunctionDef_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89938:FunctionDef_L5_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_89938:Assign_L6_C8"}, {"f": "ajibawa-2023/Python-Code... |
# -*- 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... | ajibawa-2023/Python-Code-Large/train/row_89939 | 22 | 33 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89939:Import_L3_C0", "label": "time import time", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0909, 0.0303, 0, 0.66, 0.0, 654, 0, 1, 0, 0, 654, 0, 0], "semantic": {"name": "time", "arg_names": [], "import_names": ["time"], "rhs_call_n... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89939:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89939:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89939:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89939:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Cod... |
""" 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):... | ajibawa-2023/Python-Code-Large/train/row_89942 | 18 | 28 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89942:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0714, 0.1071, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89942:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89942:FunctionDef_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89942:FunctionDef_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_89942:Expr_L10_C8"}, {"f": "ajibawa-2023/Python-Code-... |
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 = ... | ajibawa-2023/Python-Code-Large/train/row_89944 | 40 | 47 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89944:Import_L1_C0", "label": "gconf import gconf", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0213, 0.0213, 0, 0.66, 0.0, 367, 0, 1, 0, 0, 367, 0, 0], "semantic": {"name": "gconf", "arg_names": [], "import_names": ["gconf"], "rhs_ca... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89944:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89944:Assign_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89944:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89944:Return_L10_C4"}, {"f": "ajibawa-2023/Python-Code-... |
# -*- 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... | ajibawa-2023/Python-Code-Large/train/row_89945 | 64 | 96 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89945:ImportFrom_L3_C0", "label": "from threading import Thread", "type": "import", "loc": [3, 3], "level": 0, "parent": null, "vector": [1, 0, 0.0312, 0.0104, 0, 0.66, 0.0, 83, 0, 1, 0, 0, 83, 0, 0], "semantic": {"name": "threading", "arg_names": [], "import_names": ["... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89945:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89945:Expr_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89945:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89945:Assign_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
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... | ajibawa-2023/Python-Code-Large/train/row_89948 | 169 | 308 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89948:ImportFrom_L1_C0", "label": "from threading import Thread", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0032, 0.0032, 0, 0.66, 0.0, 83, 0, 1, 0, 0, 83, 0, 0], "semantic": {"name": "threading", "arg_names": [], "import_names": ["... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89948:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89948:Expr_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89948:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89948:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code-Large... |
# 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)... | ajibawa-2023/Python-Code-Large/train/row_89949 | 30 | 63 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89949:Import_L5_C0", "label": "threading import threading", "type": "import", "loc": [5, 5], "level": 0, "parent": null, "vector": [1, 0, 0.0794, 0.0159, 0, 0.66, 0.0, 83, 0, 1, 0, 0, 83, 0, 0], "semantic": {"name": "threading", "arg_names": [], "import_names": ["thread... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89949:FunctionDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89949:If_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89949:If_L9_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_89949:Return_L10_C8"}, {"f": "ajibawa-2023/Python-Code-Large/train/r... |
""" 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... | ajibawa-2023/Python-Code-Large/train/row_89950 | 30 | 52 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89950:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 3], "level": 0, "parent": null, "vector": [8, 0, 0.0385, 0.0577, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89950:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89950:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89950:FunctionDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89950:Return_L16_C4"}, {"f": "ajibawa-2023/Python-Code... |
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... | ajibawa-2023/Python-Code-Large/train/row_89953 | 26 | 42 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89953:ImportFrom_L1_C0", "label": "from ctypes import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0238, 0.0238, 0, 0.66, 0.0, 182, 0, 1, 0, 0, 182, 0, 0], "semantic": {"name": "ctypes", "arg_names": [], "import_names": ["*"], "rhs... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89953:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89953:ClassDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89953:ClassDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_89953:Assign_L9_C8"}, {"f": "ajibawa-2023/Python-Code-Large... |
# 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
... | ajibawa-2023/Python-Code-Large/train/row_89955 | 16 | 27 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89955:ImportFrom_L4_C0", "label": "from pychess.Utils.const import *", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.1481, 0.037, 0, 0.66, 0.0, 297, 0, 1, 0, 0, 297, 0, 0], "semantic": {"name": "pychess.Utils.const", "arg_names": [], "i... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89955:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89955:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89955:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89955:FunctionDef_L13_C4"}, {"f": "ajibawa-2023/Python-Cod... |
# 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... | ajibawa-2023/Python-Code-Large/train/row_89956 | 30 | 50 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89956:Import_L10_C0", "label": "random import random", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.2, 0.02, 0, 0.66, 0.0, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "random", "arg_names": [], "import_names": ["random"], "rhs_... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89956:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89956:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89956:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89956:FunctionDef_L19_C4"}, {"f": "ajibawa-2023/Python-Cod... |
# 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... | ajibawa-2023/Python-Code-Large/train/row_89957 | 26 | 44 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89957:Import_L8_C0", "label": "random import random", "type": "import", "loc": [8, 8], "level": 0, "parent": null, "vector": [1, 0, 0.1818, 0.0227, 0, 0.66, 0.0, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "random", "arg_names": [], "import_names": ["random"], "rh... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89957:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89957:Assign_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89957:ClassDef_L14_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89957:FunctionDef_L17_C4"}, {"f": "ajibawa-2023/Python-Cod... |
# 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... | ajibawa-2023/Python-Code-Large/train/row_89958 | 15 | 27 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89958:ImportFrom_L4_C0", "label": "from pychess.Utils.const import *", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.1481, 0.037, 0, 0.66, 0.0, 297, 0, 1, 0, 0, 297, 0, 0], "semantic": {"name": "pychess.Utils.const", "arg_names": [], "i... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89958:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89958:Assign_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89958:ClassDef_L13_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89958:Assign_L14_C4"}, {"f": "ajibawa-2023/Python-Code-Larg... |
# 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... | ajibawa-2023/Python-Code-Large/train/row_89959 | 27 | 46 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89959:Import_L9_C0", "label": "random import random", "type": "import", "loc": [9, 9], "level": 0, "parent": null, "vector": [1, 0, 0.1957, 0.0217, 0, 0.66, 0.0, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "random", "arg_names": [], "import_names": ["random"], "rh... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89959:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89959:Assign_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89959:ClassDef_L15_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89959:FunctionDef_L18_C4"}, {"f": "ajibawa-2023/Python-Cod... |
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... | ajibawa-2023/Python-Code-Large/train/row_89960 | 16 | 23 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89960:ImportFrom_L1_C0", "label": "from pychess.Utils.const import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0435, 0.0435, 0, 0.66, 0.0, 297, 0, 1, 0, 0, 297, 0, 0], "semantic": {"name": "pychess.Utils.const", "arg_names": [], "... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89960:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89960:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89960:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89960:FunctionDef_L9_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
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... | ajibawa-2023/Python-Code-Large/train/row_89961 | 16 | 23 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89961:ImportFrom_L1_C0", "label": "from pychess.Utils.const import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0435, 0.0435, 0, 0.66, 0.0, 297, 0, 1, 0, 0, 297, 0, 0], "semantic": {"name": "pychess.Utils.const", "arg_names": [], "... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89961:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89961:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89961:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89961:FunctionDef_L9_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
# 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... | ajibawa-2023/Python-Code-Large/train/row_89962 | 64 | 103 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89962:Import_L10_C0", "label": "random import random", "type": "import", "loc": [10, 10], "level": 0, "parent": null, "vector": [1, 0, 0.0971, 0.0097, 0, 0.66, 0.0, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "random", "arg_names": [], "import_names": ["random"], ... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89962:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89962:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89962:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89962:FunctionDef_L19_C4"}, {"f": "ajibawa-2023/Python-Cod... |
# 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... | ajibawa-2023/Python-Code-Large/train/row_89963 | 16 | 26 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89963:ImportFrom_L4_C0", "label": "from pychess.Utils.const import *", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.1538, 0.0385, 0, 0.66, 0.0, 297, 0, 1, 0, 0, 297, 0, 0], "semantic": {"name": "pychess.Utils.const", "arg_names": [], "... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89963:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89963:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89963:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89963:FunctionDef_L13_C4"}, {"f": "ajibawa-2023/Python-Cod... |
from pychess.Utils.Board import Board
class NormalChess:
name = _("Normal")
cecp_name = "normal"
board = Board
need_initial_board = False
standard_rules = True
| ajibawa-2023/Python-Code-Large/train/row_89964 | 7 | 10 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89964:ImportFrom_L1_C0", "label": "from pychess.Utils.Board import Board", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.1, 0.1, 0, 0.66, 0.0, 208, 0, 1, 0, 0, 208, 0, 0], "semantic": {"name": "pychess.Utils.Board", "arg_names": [], "im... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89964:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89964:Assign_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89964:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89964:Assign_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
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... | ajibawa-2023/Python-Code-Large/train/row_89965 | 16 | 31 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89965:ImportFrom_L1_C0", "label": "from pychess.Utils.const import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0323, 0.0323, 0, 0.66, 0.0, 297, 0, 1, 0, 0, 297, 0, 0], "semantic": {"name": "pychess.Utils.const", "arg_names": [], "... | [] |
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... | ajibawa-2023/Python-Code-Large/train/row_89966 | 16 | 23 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89966:ImportFrom_L1_C0", "label": "from pychess.Utils.const import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0435, 0.0435, 0, 0.66, 0.0, 297, 0, 1, 0, 0, 297, 0, 0], "semantic": {"name": "pychess.Utils.const", "arg_names": [], "... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89966:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89966:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89966:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89966:FunctionDef_L9_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
# 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... | ajibawa-2023/Python-Code-Large/train/row_89967 | 16 | 26 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89967:ImportFrom_L4_C0", "label": "from pychess.Utils.const import *", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.1538, 0.0385, 0, 0.66, 0.0, 297, 0, 1, 0, 0, 297, 0, 0], "semantic": {"name": "pychess.Utils.const", "arg_names": [], "... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89967:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89967:Assign_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89967:ClassDef_L10_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89967:FunctionDef_L13_C4"}, {"f": "ajibawa-2023/Python-Cod... |
# 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... | ajibawa-2023/Python-Code-Large/train/row_89968 | 220 | 412 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89968:Import_L4_C0", "label": "random import random", "type": "import", "loc": [4, 4], "level": 0, "parent": null, "vector": [1, 0, 0.0097, 0.0024, 0, 0.66, 0.0, 715, 0, 1, 0, 0, 715, 0, 0], "semantic": {"name": "random", "arg_names": [], "import_names": ["random"], "rh... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89968:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89968:Assign_L17_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89968:ClassDef_L16_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89968:FunctionDef_L19_C4"}, {"f": "ajibawa-2023/Python-Cod... |
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... | ajibawa-2023/Python-Code-Large/train/row_89969 | 16 | 23 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89969:ImportFrom_L1_C0", "label": "from pychess.Utils.const import *", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0435, 0.0435, 0, 0.66, 0.0, 297, 0, 1, 0, 0, 297, 0, 0], "semantic": {"name": "pychess.Utils.const", "arg_names": [], "... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89969:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89969:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89969:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89969:FunctionDef_L9_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
VERSION = "0.10"
VERSION_NAME = "Staunton"
| ajibawa-2023/Python-Code-Large/train/row_89970 | 2 | 2 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89970:Assign_L1_C0", "label": "VERSION =", "type": "assigned_variable", "loc": [1, 1], "level": 0, "parent": null, "vector": [14, 0, 0.5, 0.5, 0, 0.66, 0.0, 557, 1, 0, 0, 0, 0, 3, 0], "semantic": {"name": "VERSION", "arg_names": [], "import_names": [], "rhs_call_name": ... | [] |
#!/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... | ajibawa-2023/Python-Code-Large/train/row_89971 | 63 | 159 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89971:Expr_L17_C0", "label": "expression", "type": "expression", "loc": [17, 35], "level": 0, "parent": null, "vector": [8, 0, 0.1635, 0.1195, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "anno... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89971:ClassDef_L40_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89971:Expr_L41_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89971:ClassDef_L44_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89971:Expr_L45_C2"}, {"f": "ajibawa-2023/Python-Code-Large/t... |
#!/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... | ajibawa-2023/Python-Code-Large/train/row_89972 | 25 | 58 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89972:Expr_L17_C0", "label": "expression", "type": "expression", "loc": [17, 17], "level": 0, "parent": null, "vector": [8, 0, 0.2931, 0.0172, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "anno... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89972:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89972:Expr_L23_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89972:ClassDef_L22_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89972:Assign_L27_C2"}, {"f": "ajibawa-2023/Python-Code-Large... |
#!/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... | ajibawa-2023/Python-Code-Large/train/row_89974 | 82 | 144 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89974:Expr_L17_C0", "label": "expression", "type": "expression", "loc": [17, 17], "level": 0, "parent": null, "vector": [8, 0, 0.1181, 0.0069, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "anno... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89974:ClassDef_L26_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89974:FunctionDef_L27_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89974:FunctionDef_L27_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_89974:Return_L28_C4"}, {"f": "ajibawa-2023/Python-... |
#!/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... | ajibawa-2023/Python-Code-Large/train/row_89975 | 237 | 654 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89975:Expr_L17_C0", "label": "expression", "type": "expression", "loc": [17, 47], "level": 0, "parent": null, "vector": [8, 0, 0.0489, 0.0474, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "anno... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89975:ClassDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89975:Expr_L60_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89975:ClassDef_L59_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89975:FunctionDef_L73_C2"}, {"f": "ajibawa-2023/Python-Code-... |
#!/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... | ajibawa-2023/Python-Code-Large/train/row_89976 | 51 | 124 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89976:Expr_L17_C0", "label": "expression", "type": "expression", "loc": [17, 17], "level": 0, "parent": null, "vector": [8, 0, 0.1371, 0.0081, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "anno... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89976:ClassDef_L27_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89976:FunctionDef_L28_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89976:FunctionDef_L28_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_89976:Assign_L29_C4"}, {"f": "ajibawa-2023/Python-... |
#!/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... | ajibawa-2023/Python-Code-Large/train/row_89977 | 129 | 335 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89977:Expr_L17_C0", "label": "expression", "type": "expression", "loc": [17, 24], "level": 0, "parent": null, "vector": [8, 0, 0.0612, 0.0239, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "anno... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89977:ClassDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89977:Expr_L38_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89977:ClassDef_L37_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89977:FunctionDef_L53_C2"}, {"f": "ajibawa-2023/Python-Code-... |
#!/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... | ajibawa-2023/Python-Code-Large/train/row_89978 | 14 | 38 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89978:Expr_L17_C0", "label": "expression", "type": "expression", "loc": [17, 17], "level": 0, "parent": null, "vector": [8, 0, 0.4474, 0.0263, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "anno... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89978:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89978:FunctionDef_L25_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89978:FunctionDef_L25_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_89978:Assign_L26_C4"}, {"f": "ajibawa-2023/Python-... |
#!/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... | ajibawa-2023/Python-Code-Large/train/row_89979 | 207 | 313 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89979:Expr_L17_C0", "label": "expression", "type": "expression", "loc": [17, 17], "level": 0, "parent": null, "vector": [8, 0, 0.0543, 0.0032, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "anno... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89979:ClassDef_L25_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89979:FunctionDef_L27_C2"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89979:FunctionDef_L27_C2", "t": "ajibawa-2023/Python-Code-Large/train/row_89979:Assign_L28_C4"}, {"f": "ajibawa-2023/Python-... |
deps = {
"pyautolib":
"svn://svn.chromium.org/chrome/trunk/src/chrome/test/pyautolib",
}
| ajibawa-2023/Python-Code-Large/train/row_89980 | 1 | 5 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89980:Assign_L1_C0", "label": "deps =", "type": "assigned_variable", "loc": [1, 4], "level": 0, "parent": null, "vector": [14, 0, 0.5, 0.8, 0, 0.66, 0.0, 565, 0, 0, 0, 0, 0, 6, 0], "semantic": {"name": "deps", "arg_names": [], "import_names": [], "rhs_call_name": "", "a... | [] |
# -*- 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... | ajibawa-2023/Python-Code-Large/train/row_89981 | 5 | 12 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89981:ImportFrom_L7_C0", "label": "from guidata.gettext_helpers import do_compile", "type": "import", "loc": [7, 7], "level": 0, "parent": null, "vector": [1, 0, 0.5833, 0.0833, 0, 0.66, 0.0, 814, 0, 1, 0, 0, 814, 0, 0], "semantic": {"name": "guidata.gettext_helpers", "... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89981:If_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89981:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89981:If_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89981:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89981... |
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... | ajibawa-2023/Python-Code-Large/train/row_89982 | 259 | 355 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89982:Import_L1_C0", "label": "rope.base.evaluate import rope.base.evaluate", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0028, 0.0028, 0, 0.66, 0.0, 790, 0, 1, 0, 0, 790, 0, 0], "semantic": {"name": "rope.base.evaluate", "arg_names":... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89982:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89982:Expr_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89982:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89982:Assign_L13_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
"""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... | ajibawa-2023/Python-Code-Large/train/row_89983 | 35 | 69 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89983:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 17], "level": 0, "parent": null, "vector": [8, 0, 0.1304, 0.2464, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89983:ClassDef_L23_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89983:FunctionDef_L25_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89983:FunctionDef_L25_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_89983:Assign_L26_C8"}, {"f": "ajibawa-2023/Python-... |
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... | ajibawa-2023/Python-Code-Large/train/row_89984 | 70 | 110 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89984:Import_L1_C0", "label": "rope.base.codeanalyze import rope.base.codeanalyze", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0091, 0.0091, 0, 0.66, 0.0, 341, 0, 1, 0, 0, 341, 0, 0], "semantic": {"name": "rope.base.codeanalyze", "ar... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89984:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89984:Expr_L11_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89984:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89984:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
"""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_... | ajibawa-2023/Python-Code-Large/train/row_89985 | 25 | 52 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89985:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 19], "level": 0, "parent": null, "vector": [8, 0, 0.1923, 0.3654, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89985:ClassDef_L24_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89985:FunctionDef_L26_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89985:FunctionDef_L26_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_89985:Assign_L27_C8"}, {"f": "ajibawa-2023/Python-... |
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... | ajibawa-2023/Python-Code-Large/train/row_89986 | 144 | 217 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89986:Import_L1_C0", "label": "re import re", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0046, 0.0046, 0, 0.66, 0.0, 540, 0, 1, 0, 0, 540, 0, 0], "semantic": {"name": "re", "arg_names": [], "import_names": ["re"], "rhs_call_name": ""... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89986:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89986:Expr_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89986:ClassDef_L8_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89986:FunctionDef_L16_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
"""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... | ajibawa-2023/Python-Code-Large/train/row_89987 | 48 | 91 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89987:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 25], "level": 0, "parent": null, "vector": [8, 0, 0.1429, 0.2747, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annota... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89987:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89987:Expr_L30_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89987:FunctionDef_L29_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89987:Assign_L34_C4"}, {"f": "ajibawa-2023/Python-Code... |
"""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.
"""
| ajibawa-2023/Python-Code-Large/train/row_89989 | 1 | 7 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89989:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 7], "level": 0, "parent": null, "vector": [8, 0, 0.5714, 1.0, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotation... | [] |
"""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... | ajibawa-2023/Python-Code-Large/train/row_89992 | 203 | 285 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89992:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0035, 0.0035, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89992:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89992:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89992:ClassDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89992:FunctionDef_L17_C4"}, {"f": "ajibawa-2023/Python-Code-La... |
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... | ajibawa-2023/Python-Code-Large/train/row_89993 | 108 | 175 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89993:Import_L1_C0", "label": "UserDict import UserDict", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0057, 0.0057, 0, 0.66, 0.0, 351, 0, 1, 0, 0, 351, 0, 0], "semantic": {"name": "UserDict", "arg_names": [], "import_names": ["UserDic... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89993:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89993:FunctionDef_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89993:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_89993:Assign_L7_C8"}, {"f": "ajibawa-2023/Python-Code... |
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... | ajibawa-2023/Python-Code-Large/train/row_89994 | 174 | 232 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89994:Import_L1_C0", "label": "warnings import warnings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0043, 0.0043, 0, 0.66, 0.0, 358, 0, 1, 0, 0, 358, 0, 0], "semantic": {"name": "warnings", "arg_names": [], "import_names": ["warning... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89994:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89994:Expr_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89994:ClassDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89994:FunctionDef_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
"""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... | ajibawa-2023/Python-Code-Large/train/row_89995 | 134 | 186 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89995:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 6], "level": 0, "parent": null, "vector": [8, 0, 0.0188, 0.0323, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89995:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89995:Expr_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89995:FunctionDef_L18_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89995:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code... |
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... | ajibawa-2023/Python-Code-Large/train/row_89996 | 97 | 136 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89996:Import_L1_C0", "label": "rope.base.ast import rope.base.ast", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0074, 0.0074, 0, 0.66, 0.0, 442, 0, 1, 0, 0, 442, 0, 0], "semantic": {"name": "rope.base.ast", "arg_names": [], "import_na... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89996:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89996:Expr_L9_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89996:FunctionDef_L7_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89996:Expr_L15_C4"}, {"f": "ajibawa-2023/Python-Code-Larg... |
"""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... | ajibawa-2023/Python-Code-Large/train/row_89997 | 1 | 38 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89997:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 38], "level": 0, "parent": null, "vector": [8, 0, 0.5132, 1.0, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotatio... | [] |
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)... | ajibawa-2023/Python-Code-Large/train/row_89998 | 67 | 106 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89998:ImportFrom_L1_C0", "label": "from rope.base.oi import objectdb", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0094, 0.0094, 0, 0.66, 0.0, 897, 0, 1, 0, 0, 897, 0, 0], "semantic": {"name": "rope.base.oi", "arg_names": [], "import_... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89998:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89998:FunctionDef_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89998:FunctionDef_L6_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_89998:Assign_L7_C8"}, {"f": "ajibawa-2023/Python-Code... |
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):
... | ajibawa-2023/Python-Code-Large/train/row_89999 | 151 | 210 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_89999:FunctionDef_L2_C0", "label": "__rope_start_everything", "type": "function", "loc": [2, 206], "level": 0, "parent": null, "vector": [2, 0, 0.4952, 0.9762, 0, 0.66, 0.0, 940, 0, 0, 1, 0, 0, 0, 83], "semantic": {"name": "__rope_start_everything", "arg_names": [], "im... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_89999:FunctionDef_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89999:Import_L3_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_89999:FunctionDef_L2_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_89999:Import_L4_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
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... | ajibawa-2023/Python-Code-Large/train/row_90000 | 60 | 78 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_90000:Import_L1_C0", "label": "warnings import warnings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0128, 0.0128, 0, 0.66, 0.0, 358, 0, 1, 0, 0, 358, 0, 0], "semantic": {"name": "warnings", "arg_names": [], "import_names": ["warning... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_90000:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_90000:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_90000:FunctionDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_90000:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
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... | ajibawa-2023/Python-Code-Large/train/row_90002 | 155 | 235 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_90002:ImportFrom_L1_C0", "label": "from rope.base import exceptions, change, taskhandle", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0043, 0.0043, 0, 0.66, 0.0, 632, 0, 3, 0, 0, 632, 0, 0], "semantic": {"name": "rope.base", "arg_name... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_90002:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_90002:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_90002:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_90002:FunctionDef_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Larg... |
"""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... | ajibawa-2023/Python-Code-Large/train/row_90003 | 42 | 65 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_90003:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 1], "level": 0, "parent": null, "vector": [8, 0, 0.0154, 0.0154, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_90003:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_90003:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_90003:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_90003:Assign_L20_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
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... | ajibawa-2023/Python-Code-Large/train/row_90004 | 180 | 271 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_90004:Import_L1_C0", "label": "os import os", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0037, 0.0037, 0, 0.66, 0.0, 688, 0, 1, 0, 0, 688, 0, 0], "semantic": {"name": "os", "arg_names": [], "import_names": ["os"], "rhs_call_name": ""... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_90004:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_90004:Expr_L5_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_90004:ClassDef_L4_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_90004:FunctionDef_L19_C4"}, {"f": "ajibawa-2023/Python-Code-Lar... |
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... | ajibawa-2023/Python-Code-Large/train/row_90005 | 220 | 317 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_90005:Import_L1_C0", "label": "rope.base.builtins import rope.base.builtins", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0032, 0.0032, 0, 0.66, 0.0, 74, 0, 1, 0, 0, 74, 0, 0], "semantic": {"name": "rope.base.builtins", "arg_names": [... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_90005:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_90005:Expr_L10_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_90005:FunctionDef_L9_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_90005:Return_L11_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
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... | ajibawa-2023/Python-Code-Large/train/row_90006 | 126 | 199 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_90006:Import_L1_C0", "label": "rope.base.pyobjects import rope.base.pyobjects", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.005, 0.005, 0, 0.66, 0.0, 626, 0, 1, 0, 0, 626, 0, 0], "semantic": {"name": "rope.base.pyobjects", "arg_names"... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_90006:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_90006:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_90006:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_90006:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Larg... |
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... | ajibawa-2023/Python-Code-Large/train/row_90007 | 31 | 61 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_90007:ClassDef_L1_C0", "label": "RopeError", "type": "class", "loc": [1, 2], "level": 0, "parent": null, "vector": [3, 0, 0.0246, 0.0328, 0, 0.66, 0.0, 367, 0, 0, 0, 0, 645, 0, 0], "semantic": {"name": "RopeError", "arg_names": [], "import_names": [], "rhs_call_name": "... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_90007:ClassDef_L1_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_90007:Expr_L2_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_90007:ClassDef_L5_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_90007:Expr_L6_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train... |
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 ... | ajibawa-2023/Python-Code-Large/train/row_90008 | 382 | 509 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_90008:Import_L1_C0", "label": "bisect import bisect", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.002, 0.002, 0, 0.66, 0.0, 325, 0, 1, 0, 0, 325, 0, 0], "semantic": {"name": "bisect", "arg_names": [], "import_names": ["bisect"], "rhs_... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_90008:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_90008:Assign_L7_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_90008:FunctionDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_90008:Assign_L8_C4"}, {"f": "ajibawa-2023/Python-Code-L... |
"""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... | ajibawa-2023/Python-Code-Large/train/row_90009 | 28 | 55 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_90009:Expr_L1_C0", "label": "expression", "type": "expression", "loc": [1, 4], "level": 0, "parent": null, "vector": [8, 0, 0.0455, 0.0727, 0, 0.66, 0.0, 0, 1, 0, 0, 0, 0, 0, 0], "semantic": {"name": "", "arg_names": [], "import_names": [], "rhs_call_name": "", "annotat... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_90009:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_90009:Expr_L12_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_90009:FunctionDef_L11_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_90009:Assign_L24_C4"}, {"f": "ajibawa-2023/Python-Code... |
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... | ajibawa-2023/Python-Code-Large/train/row_90010 | 76 | 133 | 15 | ["cat_id", "level", "center", "span", "parent_depth", "parent_weight", "sibling_index", "name_hash", "rhs_type", "arg_count", "return_type", "is_async", "module_hash", "value_type", "calls_count"] | [{"id": "ajibawa-2023/Python-Code-Large/train/row_90010:Import_L1_C0", "label": "warnings import warnings", "type": "import", "loc": [1, 1], "level": 0, "parent": null, "vector": [1, 0, 0.0075, 0.0075, 0, 0.66, 0.0, 358, 0, 1, 0, 0, 358, 0, 0], "semantic": {"name": "warnings", "arg_names": [], "import_names": ["warning... | [{"f": "ajibawa-2023/Python-Code-Large/train/row_90010:ClassDef_L6_C0", "t": "ajibawa-2023/Python-Code-Large/train/row_90010:FunctionDef_L8_C4"}, {"f": "ajibawa-2023/Python-Code-Large/train/row_90010:FunctionDef_L8_C4", "t": "ajibawa-2023/Python-Code-Large/train/row_90010:Expr_L9_C8"}, {"f": "ajibawa-2023/Python-Code-L... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.