code stringlengths 1 1.72M | language stringclasses 1
value |
|---|---|
import gtk
import gobject
from pychess.System.prefix import addDataPrefix
from __init__ import CENTER
from __init__ import DockComposite, DockLeaf, TopDock
from PyDockComposite import PyDockComposite
from StarArrowButton import StarArrowButton
from HighlightArea import HighlightArea
class PyDockLeaf (DockLeaf):
... | Python |
import gtk
#===============================================================================
# Composite Constants
#===============================================================================
POSITIONS_COUNT = 5
NORTH, EAST, SOUTH, WEST, CENTER = range(POSITIONS_COUNT)
#===========================================... | Python |
import gtk, cairo
import gobject
from OverlayWindow import OverlayWindow
from __init__ import NORTH, EAST, SOUTH, WEST
class ArrowButton (OverlayWindow):
""" Leafs will connect to the drag-drop signal """
__gsignals__ = {
'dropped' : (gobject.SIGNAL_RUN_FIRST, None, (object,)),
'hovered'... | Python |
import os
from xml.dom import minidom
import gtk
import gobject
from pychess.System.prefix import addDataPrefix
from PyDockLeaf import PyDockLeaf
from PyDockComposite import PyDockComposite
from ArrowButton import ArrowButton
from HighlightArea import HighlightArea
from __init__ import TopDock, DockLeaf, DockCompone... | Python |
import sys
import gtk
from __init__ import DockComposite
from __init__ import NORTH, EAST, SOUTH, WEST, CENTER
class PyDockComposite (gtk.Alignment, DockComposite):
def __init__ (self, position):
gtk.Alignment.__init__(self, xscale=1, yscale=1)
if position == NORTH or position == SOUTH:
... | Python |
""" This module intends to work as glue between the gamemodel and the gamewidget
taking care of stuff that is neither very offscreen nor very onscreen
like bringing up dialogs and """
import math
import gtk
from pychess.Utils.Offer import Offer
from pychess.Utils.const import *
from pychess.Utils.repr import... | Python |
import re
from pychess.Utils.const import *
import time
import math
from pychess.System import conf
elemExpr = re.compile(r"([a-zA-Z])\s*([0-9\.,\s]*)\s+")
spaceExpr = re.compile(r"[\s,]+")
l = []
def parse(n, psize):
yield "def f(c):"
s = psize/size
for cmd, points in n:
pstr = ",".join(str(p*s)... | Python |
from pychess.Utils.Cord import Cord
from pychess.Utils.const import *
from lutils import lmove
from lutils.lmove import ParsingError, FLAG_PIECE
class Move:
def __init__ (self, cord0, cord1=None, board=None, promotion=None):
""" Inits a new highlevel Move object.
The object can be initiali... | Python |
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:... | Python |
from const import *
import __builtin__
if '_' not in __builtin__.__dict__:
__builtin__.__dict__['_'] = lambda s: s
reprColor = [_("White"), _("Black")]
reprPiece = ["Empty", _("Pawn"), _("Knight"), _("Bishop"), _("Rook"), _("Queen"), _("King"), "BPawn"]
localReprSign = ["", _("P"), _("N"), _("B"), _("R"), _("Q... | Python |
from lutils.lmove import FILE, RANK
class CordFormatException(Exception): pass
class Cord:
def __init__ (self, var1, var2 = None):
""" Inits a new highlevel cord object.
The cord B3 can be inited in the folowing ways:
Cord(17), Cord("b3"), Cord(1,2), Cord("b",3) """
... | Python |
from collections import defaultdict
from threading import RLock
import traceback
import cStringIO
import datetime
import Queue
from gobject import SIGNAL_RUN_FIRST, TYPE_NONE, GObject
from pychess.Savers.ChessFile import LoadingError
from pychess.Players.Player import PlayerIsDead, TurnInterrupt
from pychess.System.T... | Python |
################################################################################
# This module is deprecated and uses no longer existing APIs.
# After work has been made towards supporting general book formats, its
# usefulness may also be disputed.
#####################################################################... | Python |
""" 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... | Python |
from pychess.Utils.const import *
import gobject
class Rating (gobject.GObject):
def __init__(self, ratingtype, elo, deviation=DEVIATION_NONE, wins=0,
losses=0, draws=0, bestElo=0, bestTime=0):
gobject.GObject.__init__(self)
self.type = ratingtype
for v in (elo, deviation, ... | Python |
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)
... | Python |
from array import array
from pychess.Utils.const import *
from pychess.Utils.repr import reprColor
from ldata import *
from attack import isAttacked
from bitboard import *
from threading import RLock
from copy import deepcopy
################################################################################
# Zobrit ha... | Python |
from bitboard import *
from attack import *
from pychess.Utils.const import *
from lmove import newMove
################################################################################
# Generate all moves #
####################################################... | Python |
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... | Python |
import urllib
import re
from pychess.Utils.lutils.lmove import newMove, FILE, RANK
from pychess.Utils.const import *
from pychess.Utils.repr import reprColor
from pychess.Utils.lutils.bitboard import bitLength
from pychess.System.Log import log
URL = "http://www.k4it.de/egtb/fetch.php?action=egtb&fen="
expression = r... | Python |
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):
... | Python |
from pychess.Utils.const import *
from pychess.Utils.lutils.attack import isAttacked
from pychess.Utils.lutils.bitboard import bitPosArray, clearBit
from pychess.Utils.lutils.ldata import moveArray, fromToRay
################################################################################
# Validate move ... | Python |
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
################################################################################
###############... | Python |
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... | Python |
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... | Python |
################################################################################
# The purpose of this module, is to give a certain position a score. The #
# greater the score, the better the position #
############################################################################... | Python |
"""
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.
"""
from gettext import ngettext
from ldata import *
from pychess.... | Python |
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] is None:
break # Game started from a position; early ... | Python |
# -*- coding: UTF-8 -*-
import string
from ldata import *
from validator import validateMove
from pychess.Utils.const import *
from pychess.Utils.repr import reprPiece, localReprSign
def RANK (cord): return cord >> 3
def FILE (cord): return cord & 7
def TCORD (move): return move & 63
def FCORD (move): return move >... | Python |
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
#=====================================... | Python |
### DEPRECATED
### SHOULD ONLY BE USED AS A REFERENCE TO MAKE leval
pieceValues = [0, 900, 500, 350, 300, 100]
from array import array
from pychess.Utils.const import *
# these tables will be used for positional bonuses: #
whiteknight = array('b', [
-20, -35,-10, -10, -10,-10, -35, -20,
-1... | Python |
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
... | Python |
# -*- coding: UTF-8 -*-
################################################################################
# PyChess information #
################################################################################
NAME = "PyChess"
ENGINES_XML_API_VERSION = "0.10.1"... | Python |
from pychess.Utils.const import KING, QUEEN, ROOK, BISHOP, KNIGHT, PAWN
from pychess.Utils.repr 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 = Non... | Python |
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
from pychess.System.Log import log
class TimeModel (GObject):
__gsignals__ = {
"player_changed": (SIGNAL_RUN_FIRST, TYPE_NONE, ()),... | Python |
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... | Python |
from ChessFile import ChessFile, LoadingError
from pychess.Utils.GameModel import GameModel
from pychess.Utils.const import *
from pychess.Utils.logic import getStatus, repetitionCount
from pychess.Utils.lutils.leval import evaluateComplete
__label__ = _("Chess Position")
__endings__ = "epd",
__append__ = True
def sa... | Python |
# -*- coding: UTF-8 -*-
import re
from datetime import date
from pychess.System.Log import log
from pychess.Utils.Board import Board
from pychess.Utils.GameModel import GameModel
from pychess.Utils.Move import parseAny, toSAN, Move
from pychess.Utils.const import *
from pychess.Utils.logic import getStatus
from pyche... | Python |
__all__ = ["fen", "epd", "pgn",'chessalpha2']
| Python |
# -*- coding: utf-8 -*-
from ChessFile import ChessFile, LoadingError
from htmlentitydefs import entitydefs
from pychess.Utils import Cord
from pychess.Utils.GameModel import GameModel
from pychess.Utils.Move import toFAN
from pychess.Utils.Piece import Piece
from pychess.Utils.const import *
from pychess.Utils.logic ... | Python |
from pychess.Utils.GameModel import GameModel
from pychess.Utils.const import WAITING_TO_START
from pychess.Utils.logic import getStatus
__label__ = _("Simple Chess Position")
__endings__ = "fen",
__append__ = True
def save (file, model):
"""Saves game to file in fen format"""
print >> file, model.boards... | Python |
VERSION = "0.10"
VERSION_NAME = "Staunton"
| Python |
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, Log
from pychess.System.uistuff import POSITION_NONE, POSITION_CENTER, POSITION_GO... | Python |
#!/usr/bin/python
from pychess.System import glock
from pychess.System.GtkWorker import GtkWorker
from pychess.System.Log import log
from pychess.System.ThreadPool import pool
from pychess.System.prefix import addDataPrefix, isInstalled
from pychess.System.repeat import repeat_sleep
from pychess.Utils.book import getO... | Python |
from gobject import GObject, SIGNAL_RUN_FIRST, TYPE_NONE
class PlayerIsDead (Exception):
""" Used instead of returning a move,
when an engine crashes, or a nonlocal player disconnects """
pass
class TurnInterrupt (Exception):
""" Used instead of returning a move, when a players turn is interrupted... | Python |
from urllib import urlopen, urlencode
from gobject import SIGNAL_RUN_FIRST, TYPE_NONE
from pychess.System.ThreadPool import pool
from pychess.System.Log import log
from pychess.Utils.Offer import Offer
from pychess.Utils.const import ARTIFICIAL, CHAT_ACTION
from Player import Player
class Engine (Player):
... | Python |
from __future__ import with_statement
import os
import sys
from hashlib import md5
from threading import Thread
from os.path import join, dirname, abspath
from copy import deepcopy
import xml.etree.ElementTree as ET
from xml.etree.ElementTree import fromstring
try:
from xml.etree.ElementTree import ParseError
ex... | Python |
from threading import RLock
import Queue
import itertools
import re
import time
from pychess.Savers.pgn import movre as movere
from pychess.System.Log import log
from pychess.System.ThreadPool import pool
from pychess.Utils.Move import Move
from pychess.Utils.Board import Board
from pychess.Utils.Cord import Cord
from... | Python |
from gobject import SIGNAL_RUN_FIRST
from threading import Condition
from pychess.System.Log import log
from pychess.Players.Engine import Engine
from pychess.Utils.const import *
from pychess.Utils.repr import reprColor
class ProtocolEngine (Engine):
__gsignals__ = {
"readyForOptions": (SIGNAL_RUN_F... | Python |
from __future__ import with_statement
import collections
from copy import copy
import Queue
from threading import RLock
from pychess.Utils.Move import *
from pychess.Utils.Board import Board
from pychess.Utils.Cord import Cord
from pychess.Utils.Offer import Offer
from pychess.Utils.logic import validate, getMoveKilli... | Python |
from collections import defaultdict
from Queue import Queue
from Player import Player, PlayerIsDead, TurnInterrupt
from pychess.Utils.Move import parseSAN, toAN, ParsingError
from pychess.Utils.Offer import Offer
from pychess.Utils.const import *
from pychess.System.Log import log
class ICPlayer (Player):
__type_... | Python |
from Queue import Queue
import gtk, gobject
from pychess.Utils.const import *
from pychess.Utils.Offer import Offer
from pychess.System.Log import log
from pychess.System import glock, conf
from Player import Player, PlayerIsDead, TurnInterrupt
OFFER_MESSAGES = {
DRAW_OFFER:
(_("Your opponent has offere... | Python |
#
# main.py
# flickrmirror
#
# Created by Nathan Van Gheem on 5/18/09.
# Copyright __MyCompanyName__ 2009. All rights reserved.
#
#import modules required by application
import objc
import Foundation
import AppKit
from PyObjCTools import AppHelper
# import modules containing classes required to start application... | Python |
#
# flickrmirrorAppDelegate.py
# flickrmirror
#
# Created by Nathan Van Gheem on 5/18/09.
# Copyright __MyCompanyName__ 2009. All rights reserved.
#
from Foundation import *
from AppKit import *
class flickrmirrorAppDelegate(NSObject):
def applicationDidFinishLaunching_(self, sender):
NSLog("Applicati... | Python |
#
# controller.py
# flickrmirror
#
# Created by Nathan Van Gheem on 5/19/09.
# Copyright (c) 2009 __MyCompanyName__. All rights reserved.
#
#import local libs to be able to use
import sys, time, os, threading, datetime
#now add the path so we have the right libraries to use...
path = '/'.join(os.path.abspath( __f... | Python |
'''Persistent token cache management for the Flickr API'''
import os.path
import logging
logging.basicConfig()
LOG = logging.getLogger(__name__)
LOG.setLevel(logging.INFO)
__all__ = ('TokenCache', 'SimpleTokenCache')
class SimpleTokenCache(object):
'''In-memory token cache.'''
def __init__(self):
... | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''A FlickrAPI interface.
See `the FlickrAPI homepage`_ for more info.
.. _`the FlickrAPI homepage`: http://flickrapi.sf.net/
'''
__version__ = '1.2'
__all__ = ('FlickrAPI', 'IllegalArgumentException', 'FlickrError',
'CancelUpload', 'XMLNode', 'set_log_level', '... | Python |
'''Exceptions used by the FlickrAPI module.'''
class IllegalArgumentException(ValueError):
'''Raised when a method is passed an illegal argument.
More specific details will be included in the exception message
when thrown.
'''
class FlickrError(Exception):
'''Raised when a Flickr method fails... | Python |
# -*- encoding: utf-8 -*-
'''Module for encoding data as form-data/multipart'''
import os
import base64
class Part(object):
'''A single part of the multipart data.
>>> Part({'name': 'headline'}, 'Nice Photo')
... # doctest: +ELLIPSIS
<flickrapi.multipart.Part object at 0x...>
>>> image = fi... | Python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''A FlickrAPI interface.
See `the FlickrAPI homepage`_ for more info.
.. _`the FlickrAPI homepage`: http://flickrapi.sf.net/
'''
__version__ = '1.2'
__all__ = ('FlickrAPI', 'IllegalArgumentException', 'FlickrError',
'CancelUpload', 'XMLNode', 'set_log_level', '... | Python |
# -*- encoding: utf-8 -*-
'''HTTPHandler that supports a callback method for progress reports.
'''
import urllib2
import httplib
import logging
__all__ = ['urlopen']
logging.basicConfig()
LOG = logging.getLogger(__name__)
progress_callback = None
class ReportingSocket(object):
'''Wrapper around a socket. Give... | Python |
'''FlickrAPI uses its own in-memory XML representation, to be able to easily
use the info returned from Flickr.
There is no need to use this module directly, you'll get XMLNode instances
from the FlickrAPI method calls.
'''
import xml.dom.minidom
__all__ = ('XMLNode', )
class XMLNode:
"""XMLNode -- generic cla... | Python |
# -*- encoding: utf-8 -*-
'''Call result cache.
Designed to have the same interface as the `Django low-level cache API`_.
Heavily inspired (read: mostly copied-and-pasted) from the Django framework -
thanks to those guys for designing a simple and effective cache!
.. _`Django low-level cache API`: http://www.djangop... | Python |
import os, os.path, time, pickle, commands, copy
from model import *
from settings import pickled_foldername, pickled_filename, \
flickr, log_file_name, mirror_model_pickle_name
from utils import *
import logging
import logging.handlers
# Set up a specific logger with our desired output level
logg... | Python |
from controller import MirrorController
from view.gui import GUIView
import wx
def startapp():
app = wx.App()
view = GUIView()
app.MainLoop() | Python |
import wx
class HasEvents(object):
def __getattr__(self, name):
"""
register_click_event_for_authenticate_button
['register', 'button', 'event', 'for', 'authenticate', 'button']
"""
items = name.split("_")
if items[0] == "register":
... | Python |
from flickrmirror.view.base import IView
from flickrmirror.controller import MirrorController
from flickrmirror.tools import *
from frames import *
import wx
import threading
class GUIView:
def __init__(self):
self.controller = MirrorController(self)
self.main_frame = MainFrame(self)
... | Python |
from view import GUIView | Python |
from flickrmirror.exceptions import NotImplementedException
from flickrmirror.tools import logger
class IView:
"""
base view for all the views here...
interface type deal...
"""
name = property(NotImplementedException)
def __init__():
raise NotImplementedException("""Construct... | Python |
from base import IView
from flickrmirror.controller import MirrorController
from flickrmirror.tools import *
class CLIView(IView):
name = 'cli'
def __init__(self):
self.controller = MirrorController(self)
self.menu()
def menu(self):
res = '0'
whil... | Python |
import os
from exceptions import NotImplementedException
from utils import *
class DictSerializableModel(object):
def dump(self):
raise NotImplementedException()
def load(self):
raise NotImplementedException()
class MirrorModel(DictSerializableModel):
def __init__(self, ... | Python |
# this will control a user's fake photo collection
# and prevent it from actually calling flickr for
# the results.
#
# As long as all the results are structured correctly,
# everything should work the same....
#
# The fake user's photo collection will look like this,
# Sets:
# -Hawaii
# -20 photos
# -id ... | Python |
import flickrapi
import os.path
key = "57ed171ead518050f3802d2ef8620621"
secret = "15863af84276ca85"
pickled_filename = '.flickrmirror'
pickled_foldername = '__flickrmirrorsettings__'
mirror_model_pickle_name = '__mirror_model.dict'
flickr = flickrapi.FlickrAPI(key, secret)
log_file_name = os.path.join("/tmp", "fli... | Python |
def normalize(name):
bad_letters_skip = """'"/\\,<>?[]{}+=()*&^%$#@!~`"""
bad_letters_replace = """ :;"""
for b in bad_letters_skip:
name = name.replace(b, '')
for b in bad_letters_replace:
name = name.replace(b, '-')
return name.strip().replace('--', '-') | Python |
class NotImplementedException(Exception):
"""
Method not implemented
""" | Python |
# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
try:
__import__('pkg_resources').declare_namespace(__name__)
except ImportError:
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
| Python |
from flickrmirror.view.cli import CLIView
view = CLIView() | Python |
import commands, urllib, os.path, os, pickle, time, model, datetime, shutil
from tools import *
from settings import flickr
from utils import *
class MirrorController:
"""
"""
def __init__(self, view):
self.view = view
self.authenticator = Authenticator()
self.retrieve = Retrie... | Python |
import flickrapi
from settings import key, secret
| Python |
import sys, os.path
from setuptools import setup, find_packages
version = "0.1b2"
setup(
name="flickrmirror",
version=version,
description="A library that allows you to easily mirror your flickr set colletion to your hard drive.",
long_description=open("README.txt").read() + "\n" + open(os.path.join(... | Python |
import os, os.path, time, pickle, commands, copy
from model import *
from settings import pickled_foldername, pickled_filename, \
flickr, log_file_name, mirror_model_pickle_name
from utils import *
import logging
import logging.handlers
# Set up a specific logger with our desired output level
logg... | Python |
from flickrmirror.exceptions import NotImplementedException
from flickrmirror.tools import logger
class IView:
"""
base view for all the views here...
interface type deal...
"""
name = property(NotImplementedException)
def __init__():
raise NotImplementedException("""Construct... | Python |
from base import IView
from flickrmirror.controller import MirrorController
from flickrmirror.tools import *
class CLIView(IView):
name = 'cli'
def __init__(self):
self.controller = MirrorController(self)
self.menu()
def menu(self):
res = '0'
whil... | Python |
import os
from exceptions import NotImplementedException
from utils import *
class DictSerializableModel(object):
def dump(self):
raise NotImplementedException()
def load(self):
raise NotImplementedException()
class MirrorModel(DictSerializableModel):
def __init__(self, ... | Python |
# do all flickrapi overrides here...
import flickrapi, math
import xml.etree.ElementTree as ElementTree
sets_information = [
{ 'id' : 1, 'photos' : 1, 'videos' : 0 },
{ 'id' : 2, 'photos' : 0, 'videos' : 0 },
{ 'id' : 3, 'photos' : 10000, 'videos' : 300 },
{ 'id' : 4, 'photos' : 499, 'videos' : 0 },
... | Python |
import test_tools | Python |
import flickrapi
import os.path
key = "57ed171ead518050f3802d2ef8620621"
secret = "15863af84276ca85"
pickled_filename = '.flickrmirror'
pickled_foldername = '__flickrmirrorsettings__'
mirror_model_pickle_name = '__mirror_model.dict'
flickr = flickrapi.FlickrAPI(key, secret)
log_file_name = os.path.join("/tmp", "fli... | Python |
def normalize(name):
bad_letters_skip = """'"/\\,<>?[]{}+=()*&^%$#@!~`"""
bad_letters_replace = """ :;"""
for b in bad_letters_skip:
name = name.replace(b, '')
for b in bad_letters_replace:
name = name.replace(b, '-')
return name.strip().replace('--', '-') | Python |
class NotImplementedException(Exception):
"""
Method not implemented
""" | Python |
# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
try:
__import__('pkg_resources').declare_namespace(__name__)
except ImportError:
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
| Python |
from flickrmirror.view.cli import CLIView
view = CLIView() | Python |
import commands, urllib, os.path, os, pickle, time, model, datetime, shutil
from tools import *
from settings import flickr
from utils import *
class MirrorController:
"""
"""
def __init__(self, view):
self.view = view
self.authenticator = Authenticator()
self.retrieve = Retrie... | Python |
from pyamf.remoting.gateway.google import WebAppGateway
from src.model.Contact import Contact
from src.services import ContactService
import jinja2
import os
import pyamf
import webapp2
jinja_env = jinja2.Environment(loader=jinja2.FileSystemLoader(os.path.abspath("html")), autoescape=True)
class MainHandler(webapp2.R... | Python |
from src.model.Contact import Contact
def echo(message):
return "echo " + message
def addContact(contact):
try:
contact.put()
return True
except:
return False
def getContacts():
contacts = Contact.all()
return list(contacts)
| Python |
from google.appengine.ext import db
class Contact(db.Model):
name = db.StringProperty(required=True)
surname = db.StringProperty(required=True) | Python |
# Copyright (c) The PyAMF Project.
# See LICENSE.txt for details.
"""
Local Shared Object implementation.
Local Shared Object (LSO), sometimes known as Adobe Flash cookies, is a
cookie-like data entity used by the Adobe Flash Player and Gnash. The players
allow web content to read and write LSO data to the computer's... | Python |
# Copyright (c) The PyAMF Project.
# See LICENSE.txt for details.
"""
AMF0 implementation.
C{AMF0} supports the basic data types used for the NetConnection, NetStream,
LocalConnection, SharedObjects and other classes in the Adobe Flash Player.
@since: 0.1
@see: U{Official AMF0 Specification in English (external)
... | Python |
# Copyright (c) The PyAMF Project.
# See LICENSE.txt for details.
"""
AMF0 Remoting support.
@since: 0.1.0
"""
import traceback
import sys
from pyamf import remoting
from pyamf.remoting import gateway
class RequestProcessor(object):
def __init__(self, gateway):
self.gateway = gateway
def authenti... | Python |
# Copyright (c) The PyAMF Project.
# See LICENSE.txt for details.
"""
Remoting client implementation.
@since: 0.1.0
"""
import urllib2
import urlparse
import pyamf
from pyamf import remoting
try:
from gzip import GzipFile
except ImportError:
GzipFile = False
try:
from cStringIO import StringIO
except ... | Python |
# Copyright (c) The PyAMF Project.
# See LICENSE.txt for details.
"""
AMF3 RemoteObject support.
@see: U{RemoteObject on LiveDocs
<http://livedocs.adobe.com/flex/3/langref/mx/rpc/remoting/RemoteObject.html>}
@since: 0.1.0
"""
import calendar
import time
import uuid
import sys
import pyamf.python
from pyamf import ... | Python |
Subsets and Splits
SQL Console for ajibawa-2023/Python-Code-Large
Provides a useful breakdown of language distribution in the training data, showing which languages have the most samples and helping identify potential imbalances across different language groups.