code stringlengths 1 1.72M | language stringclasses 1
value |
|---|---|
#-*- coding: utf-8 -*-
'''
Created on Sep 23, 2010
@author: ivan
'''
import gtk
from foobnix.util import LOG, const
from foobnix.helpers.my_widgets import tab_close_button, tab_close_label
from foobnix.online.online_model import OnlineListModel
from foobnix.util.fc import FC
from foobnix.regui.treeview.playlist import... | Python |
import gtk
from foobnix.helpers.toggled import OneActiveToggledButton
from foobnix.regui.model.signal import FControl
from foobnix.util import LOG
class SearchControls(FControl, gtk.Frame):
def __init__(self, controls):
gtk.Frame.__init__(self)
FControl.__init__(self, controls)
self.... | Python |
'''
Created on Sep 29, 2010
@author: ivan
'''
from foobnix.regui.state import LoadSave
from foobnix.regui.treeview import TreeViewControl
from foobnix.util.mouse_utils import is_double_left_click, is_rigth_click
import gtk
from foobnix.helpers.menu import Popup
from foobnix.helpers.dialog_entry import one_line_dialog
... | Python |
#-*- coding: utf-8 -*-
'''
Created on 25 сент. 2010
@author: ivan
'''
import os
from foobnix.util.fc import FC
from foobnix.util.file_utils import file_extenstion
from foobnix.util import LOG
from foobnix.regui.model import FModel
"""Music directory scanner"""
class DirectoryScanner():
def __init__(self, ... | Python |
#-*- coding: utf-8 -*-
import gtk
import gobject
from foobnix.regui.treeview.scanner import DirectoryScanner
from foobnix.regui.model import FTreeModel, FModel
from foobnix.util import LOG
import uuid
from foobnix.regui.model.signal import FControl
import copy
class TreeViewControl(gtk.TreeView, FTreeModel, FControl):... | Python |
'''
Created on Sep 28, 2010
@author: ivan
'''
from foobnix.regui.state import LoadSave
from foobnix.regui.treeview import TreeViewControl
from foobnix.regui.model.signal import FControl
import gtk
class SimpleTreeControl(TreeViewControl, LoadSave):
def __init__(self, title_name, controls):
TreeVie... | Python |
#-*- coding: utf-8 -*-
'''
Created on 25 сент. 2010
@author: ivan
'''
from foobnix.regui.treeview import TreeViewControl
import gtk
from random import randint
from foobnix.util import const
from foobnix.util.mouse_utils import is_double_left_click
from foobnix.cue.cue_reader import CueReader
from foobnix.regui.model i... | Python |
'''
Created on Sep 29, 2010
@author: ivan
'''
from foobnix.regui.state import LoadSave
from foobnix.regui.treeview import TreeViewControl
from foobnix.util.mouse_utils import is_double_left_click
import gtk
class RadioTreeControl(TreeViewControl, LoadSave):
def __init__(self, controls):
TreeViewControl.__i... | Python |
#-*- coding: utf-8 -*-
'''
Created on 25 сент. 2010
@author: ivan
'''
from foobnix.regui.treeview import TreeViewControl
import gtk
from foobnix.util.mouse_utils import is_double_left_click, is_rigth_click
from foobnix.regui.state import LoadSave
from foobnix.helpers.menu import Popup
from foobnix.util.fc import FC
fr... | Python |
#-*- coding: utf-8 -*-
'''
Created on 3 окт. 2010
@author: ivan
'''
import os.path
def get_foobnix_resourse_path_by_name(filename):
paths = ("/usr/local/share/pixmaps",\
"/usr/share/pixmaps",\
"pixmaps",\
"./../../..",\
"./../../",\
"./")
for pa... | Python |
#-*- coding: utf-8 -*-
'''
Created on 27 сент. 2010
@author: ivan
'''
from foobnix.model.entity import CommonBean
from foobnix.thirdparty import pylast
from foobnix.thirdparty.pylast import WSError, Tag
from foobnix.util import LOG
from foobnix.online.google.translate import translate
from foobnix.util.fc import FC
f... | Python |
'''
Created on Sep 29, 2010
@author: ivan
'''
import time
from foobnix.util.fc import FC
import urllib2
from foobnix.util import LOG
import urllib
import re
from foobnix.helpers.dialog_entry import show_login_password_error_dialog
from setuptools.package_index import htmldecode
from setuptools.command.sdist import une... | Python |
#-*- coding: utf-8 -*-
'''
Created on 28 сент. 2010
@author: anton.komolov
'''
import dbus.service
from dbus.mainloop.glib import DBusGMainLoop
from foobnix.util.configuration import get_version
from foobnix.regui.model.signal import FControl
DBusGMainLoop(set_as_default=True)
DBUS_NAME = "org.mpris.foobnix"
MPRIS_R... | Python |
#-*- coding: utf-8 -*-
'''
Created on 27 сент. 2010
@author: ivan
'''
import gtk
from foobnix.regui.model.signal import FControl
import time
import thread
class SearchProgressBar(FControl, gtk.ProgressBar):
def __init__(self, controls):
FControl.__init__(self, controls)
gtk.ProgressBar.__init__(s... | Python |
'''
Created on Sep 27, 2010
@author: ivan
'''
from foobnix.regui.state import LoadSave
from foobnix.helpers.toolbar import MyToolbar
from foobnix.regui.model.signal import FControl
import gtk
class PlaybackControls(FControl,MyToolbar,LoadSave):
def __init__(self, controls):
FControl.__init__(self, control... | Python |
#-*- coding: utf-8 -*-
'''
Created on 28 сент. 2010
@author: ivan
'''
from foobnix.regui.model.signal import FControl
import gtk
class StatusbarControls(gtk.Statusbar, FControl):
def __init__(self, controls):
gtk.Statusbar.__init__(self)
FControl.__init__(self, controls)
self.show()
def... | Python |
#-*- coding: utf-8 -*-
'''
Created on 28 сент. 2010
@author: ivan
'''
from foobnix.regui.model.signal import FControl
import gtk
from foobnix.util.time_utils import convert_seconds_to_text
class SeekProgressBarControls(FControl, gtk.Alignment):
def __init__(self, controls):
FControl.__init__(self, controls... | Python |
#-*- coding: utf-8 -*-
'''
Created on 28 сент. 2010
@author: ivan
'''
import gtk
from foobnix.regui.state import LoadSave
from foobnix.util.fc import FC
from foobnix.regui.model.signal import FControl
class VolumeControls(LoadSave, gtk.HBox, FControl):
MAX_VALUE = 120
def __init__(self, controls):
gtk.... | Python |
#-*- coding: utf-8 -*-
'''
Created on 25 сент. 2010
@author: ivan
'''
from foobnix.regui.model.signal import FControl
import gtk
from foobnix.regui.state import LoadSave
class FilterControl(gtk.Entry, FControl, LoadSave):
def __init__(self, controls):
gtk.Entry.__init__(self)
FControl.__init__(self... | Python |
#-*- coding: utf-8 -*-
'''
Created on 29 сент. 2010
@author: ivan
'''
from foobnix.regui.model.signal import FControl
import gtk
import os
from foobnix.util.fc import FC
from foobnix.helpers.toolbar import MyToolbar
from foobnix.util.mouse_utils import is_mouse_click
from foobnix.regui.service.path_service import get_... | Python |
#-*- coding: utf-8 -*-
'''
Created on 23 сент. 2010
@author: ivan
'''
class LoadSave(object):
def __init__(self):
pass
def on_load(self):
raise Exception("Method not defined on_load", self.__class__.__name__)
def on_save(self):
raise Exception("Method not defined on_save",... | Python |
#-*- coding: utf-8 -*-
'''
Created on 25 сент. 2010
@author: ivan
'''
"""base class to comunicate beatween all controls"""
class FControl():
def __init__(self, controls):
self.controls = controls
| Python |
import gobject
class FTreeModel():
def __init__(self):
self.text = 0, str
self.visible = 1, gobject.TYPE_BOOLEAN
self.font = 2, str
self.play_icon = 3, str
self.time = 4, str
self.path = 5, str
self.level = 6, str
self.tracknumber = 7, str
... | Python |
#-*- coding: utf-8 -*-
'''
Created on 28 сент. 2010
@author: ivan
'''
import gst
import urllib
import os
from foobnix.regui.engine import MediaPlayerEngine
from foobnix.util import LOG
import time
import gtk
import thread
from foobnix.util.fc import FC
class GStreamerEngine(MediaPlayerEngine):
NANO_SECONDS = 1000... | Python |
from foobnix.regui.model.signal import FControl
class MediaPlayerStatus():
def __init__(self):
self.setStop()
def setPlay(self):
self.isPlay = True
self.isPause = False
self.isStop = False
def setPause(self):
self.isPlay = False
self.isPause = True
... | Python |
#-*- coding: utf-8 -*-
'''
Created on 25 сент. 2010
@author: ivan
'''
import gtk
from foobnix.regui.top import TopWidgets
from foobnix.regui.left import LeftWidgets
from foobnix.regui.state import LoadSave
from foobnix.util.fc import FC
from foobnix.regui.model.signal import FControl
from foobnix.util import LOG
class... | Python |
# ~*~ coding:utf-8 ~*~ #
from mutagen.mp3 import MP3
from mutagen.easyid3 import EasyID3
import os
from foobnix.util.time_utils import normilize_time
from foobnix.util import LOG
def decode_cp866(text):
try:
decode_text = text.decode("cp866")
if decode_text.find(u"├") >= 0 :
#LOG.warn("... | Python |
#-*- coding: utf-8 -*-
from foobnix.regui.notetab import NoteTabControl
from foobnix.regui.base_layout import BaseFoobnixLayout
from foobnix.regui.base_controls import BaseFoobnixControls
from foobnix.regui.treeview.musictree import MusicTreeControl
from foobnix.regui.window import MainWindow
from foobnix.regui.contro... | Python |
#-*- coding: utf-8 -*-
'''
Created on 22 сент. 2010
@author: ivan
'''
import gtk
from foobnix.regui.menu import MenuWidget
from foobnix.helpers.toolbar import ToolbarSeparator
from foobnix.regui.model.signal import FControl
from foobnix.regui.state import LoadSave
class TopWidgets(FControl, LoadSave,gtk.HBox):
de... | Python |
'''
Created on Sep 23, 2010
@author: ivan
'''
import gtk
from foobnix.regui.state import LoadSave
from foobnix.util.fc import FC
from foobnix.regui.model.signal import FControl
from foobnix.regui.treeview.simple import SimpleTreeControl
from foobnix.helpers.image import CoverImage
class InfoPanelWidget(gtk.Frame, Loa... | Python |
#-*- coding: utf-8 -*-
'''
Created on 25 сент. 2010
@author: ivan
'''
import gtk
from foobnix.regui.model.signal import FControl
from foobnix.regui.state import LoadSave
from foobnix.util.fc import FC
from foobnix.util import const
class MainWindow(gtk.Window, FControl, LoadSave):
def __init__(self, controls):
... | Python |
#-*- coding: utf-8 -*-
'''
Created on 25 сент. 2010
@author: ivan
'''
import gtk
from foobnix.util.fc import FC
from foobnix.util import LOG
from foobnix.regui.state import LoadSave
from foobnix.regui.treeview.scanner import DirectoryScanner
from foobnix.regui.id3 import update_all_id3
import os
from foobnix.regui.mod... | Python |
#-*- coding: utf-8 -*-
'''
Created on 22 сент. 2010
@author: ivan
'''
import gtk
from foobnix.helpers.toggled import OneActiveToggledButton
from foobnix.regui.model.signal import FControl
from foobnix.regui.state import LoadSave
class LeftWidgets(FControl, LoadSave, gtk.VBox):
def __init__(self, controls):
... | Python |
'''
Created on Mar 14, 2010
@author: ivan
'''
import gtk
from foobnix.window.window_controller import WindowController
from foobnix.player.player_controller import PlayerController
from foobnix.player.player_widgets_cntr import PlayerWidgetsCntl
from foobnix.directory.directory_controller import DirectoryCntr
from fo... | Python |
'''
Created on Mar 14, 2010
@author: ivan
'''
import gtk.glade
import sys
from foobnix.util import LOG
from foobnix.util.configuration import get_version
import os
class AppView():
gladeMain = "foobnix/glade/foobnix.glade"
def __init__(self):
self.gxMain = self.glade_XML(self.gladeMain, "foobnixW... | Python |
'''
Created on Mar 14, 2010
@author: ivan
'''
from foobnix.util.configuration import FConfiguration
from foobnix.util import LOG
class AppConfigurationCntrl():
def __init__(self, gxMain, directoryCntr):
self.directoryCntr = directoryCntr
'''''
"""Random button"""
self.random... | Python |
'''
Created on Mar 13, 2010
@author: ivan
'''
import gtk
import os.path
from foobnix.base import BaseController
from foobnix.base import SIGNAL_RUN_FIRST, TYPE_NONE
from foobnix.util.mouse_utils import is_mouse_click
from foobnix.util.configuration import FConfiguration
class TrayIcon(BaseController):... | Python |
'''
Created on Mar 13, 2010
@author: ivan
'''
import gtk
from foobnix.util.configuration import VERSION, FConfiguration
from foobnix.base import BaseController
from foobnix.base import SIGNAL_RUN_FIRST, TYPE_NONE
from foobnix.util import const
class WindowController(BaseController):
__gsignals__ = {
'exi... | Python |
#!/usr/bin/env python
import sys, os, glob, shutil
from distutils.core import setup
from foobnix.util.configuration import VERSION, FOOBNIX_TMP, FOOBNIX_TMP_RADIO
root_dir = ''
for a in sys.argv[1:]:
if a.find('--root') == 0:
root_dir = a[7:]
print "RADIO", FOOBNIX_TMP, FOOBNIX_TMP_RADIO
if not os.p... | Python |
'''
Created on Sep 30, 2010
@author: ivan
'''
import time
from foobnix.regui.controls.dbus_manager import foobnixDBusInterface
init_time = time.time()
iface = foobnixDBusInterface()
if not iface:
print "start server"
import gobject
from foobnix.regui.foobnix_core import FoobnixCore
import gtk
go... | Python |
#!/usr/bin/env python
'''
Created on Mar 10, 2010
@author: ivan
'''
import gobject
import gtk
from foobnix.util.dbus_utils import DBusManager, getFoobnixDBusInterface
import sys
import time
import os
import thread
class Foobnix():
def __init__(self):
from foobnix.application.app_view import AppView
... | Python |
#!/usr/bin/env python
#
# Copyright 2006, 2007 Google Inc. All Rights Reserved.
# Author: danderson@google.com (David Anderson)
#
# Script for uploading files to a Google Code project.
#
# This is intended to be both a useful script for people who want to
# streamline project uploads and a reference implementation for
... | Python |
#!/usr/bin/env python
#
# Copyright 2006, 2007 Google Inc. All Rights Reserved.
# Author: danderson@google.com (David Anderson)
#
# Script for uploading files to a Google Code project.
#
# This is intended to be both a useful script for people who want to
# streamline project uploads and a reference implementation for
... | Python |
'''
Created on Oct 4, 2010
@author: ivan
'''
#!/usr/bin/env python
import gobject
try:
import pygtk; pygtk.require("2.0")
except:
pass
import gtk
data = [[0, "zero"], [1, "one"], [2, "two"], [3, "three"], [4, "four"], [5, "five"], [6, "six"]]
data1 = [[10, "1zero"], [11, "1one"], [12, "1two"], [13, "1three"]... | Python |
'''
Created on Sep 2, 2010
@author: ivan
'''
import gst
import gtk
class Player():
def __init__1(self):
self.player = gst.element_factory_make("playbin", "player")
#mad = gst.element_factory_make("mad", "mad")
#source = gst.element_factory_make("souphttpsrc", "source")
... | Python |
# -*- coding: utf-8 -*-
# lyricwiki.py
#
# Copyright 2009 Amr Hassan <amr.hassan@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either v... | Python |
import gtk
import gobject
import copy
POS_index = 0
POS_text = 1
POS_visible = 2
POS_font = 3
POS_level = 4
POS_parent = 5
class Bean():
def __init__(self, row=None):
self.index = None
self.text = None
self.visible = None
self.font = None
self.level = None
... | Python |
"""
Copyright (C) 2009, Eduardo Silva P <edsiper@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program... | Python |
import urllib2
class ProxyPasswordMgr:
def __init__(self):
self.user = self.passwd = None
def add_password(self, realm, uri, user, passwd):
self.user = user
self.passwd = passwd
def find_user_password(self, realm, authuri):
return self.user, self.passwd
#http://spys.ru/proxy... | Python |
import base64
import cgi
try:
from Crypto.Cipher import AES
except:
raise Exception ("You need the pycrpyto library: http://cheeseshop.python.org/pypi/pycrypto/")
MAIL_HIDE_BASE="http://mailhide.recaptcha.net"
def asurl (email,
public_key,
private_key):
"""Wraps an email... | Python |
import urllib2, urllib
API_SSL_SERVER="https://api-secure.recaptcha.net"
API_SERVER="http://api.recaptcha.net"
VERIFY_SERVER="api-verify.recaptcha.net"
class RecaptchaResponse(object):
def __init__(self, is_valid, error_code=None):
self.is_valid = is_valid
self.error_code = error_code
def display... | Python |
r"""Command-line tool to validate and pretty-print JSON
Usage::
$ echo '{"json":"obj"}' | python -m simplejson.tool
{
"json": "obj"
}
$ echo '{ 1.2:3.4}' | python -m simplejson.tool
Expecting property name: line 1 column 2 (char 2)
"""
import sys
import simplejson as json
def main():
... | Python |
"""JSON token scanner
"""
import re
def _import_c_make_scanner():
try:
from simplejson._speedups import make_scanner
return make_scanner
except ImportError:
return None
c_make_scanner = _import_c_make_scanner()
__all__ = ['make_scanner']
NUMBER_RE = re.compile(
r'(-?(?:0|[1-9]\d*))... | Python |
r"""JSON (JavaScript Object Notation) <http://json.org> is a subset of
JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data
interchange format.
:mod:`simplejson` exposes an API familiar to users of the standard library
:mod:`marshal` and :mod:`pickle` modules. It is the externally maintained
version of ... | Python |
import unittest
import doctest
class OptionalExtensionTestSuite(unittest.TestSuite):
def run(self, result):
import simplejson
run = unittest.TestSuite.run
run(self, result)
simplejson._toggle_speedups(False)
run(self, result)
simplejson._toggle_speedups(True)
... | Python |
"""Implementation of JSONDecoder
"""
import re
import sys
import struct
from simplejson.scanner import make_scanner
def _import_c_scanstring():
try:
from simplejson._speedups import scanstring
return scanstring
except ImportError:
return None
c_scanstring = _import_c_scanstring()
__all... | Python |
"""Implementation of JSONEncoder
"""
import re
from decimal import Decimal
def _import_speedups():
try:
from simplejson import _speedups
return _speedups.encode_basestring_ascii, _speedups.make_encoder
except ImportError:
return None, None
c_encode_basestring_ascii, c_make_encoder = _im... | Python |
"""Drop-in replacement for collections.OrderedDict by Raymond Hettinger
http://code.activestate.com/recipes/576693/
"""
from UserDict import DictMixin
# Modified from original to support Python 2.4, see
# http://code.google.com/p/simplejson/issues/detail?id=53
try:
all
except NameError:
def all(seq):
... | Python |
"""
Copyright (c) 2008, appengine-utilities project
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this
list of conditions and ... | Python |
'''
Copyright (c) 2008, appengine-utilities project
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the ... | Python |
"""
Copyright (c) 2008, appengine-utilities project
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this
list of conditions and ... | Python |
# -*- coding: utf-8 -*-
"""
Copyright (c) 2008, appengine-utilities project
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this
... | Python |
# -*- coding: utf-8 -*-
"""
Copyright (c) 2008, appengine-utilities project
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this
... | Python |
"""
Copyright (c) 2008, appengine-utilities project
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this
list of conditions and ... | Python |
import Cookie
import os
from common.appengine_utilities import sessions
class SessionMiddleware(object):
TEST_COOKIE_NAME = 'testcookie'
TEST_COOKIE_VALUE = 'worked'
def process_request(self, request):
"""
Check to see if a valid session token exists, if not,
then use a cookie on... | Python |
"""
Copyright (c) 2008, appengine-utilities project
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this
list of conditions and ... | Python |
# -*- coding: utf-8 -*-
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from web.article import ViewArticle, TemplatePage, CreateUpdateArticle
from web.comment import AddComment, DeleteComment
from web.rss import RssFeed
from web.stats import SubmitVersion, ShowStats, S... | Python |
from google.appengine.ext import webapp
from web.constants import get_admin_user, title, slogan, menu, ARTICLES_ON_PAGE, \
cleaner
from appengine_utilities import sessions
from web.models import ArticleModel, CommentModel, StatisticModel, \
CommonStatisticModel, VersoinModel
from google.appengine.ext.webapp imp... | Python |
from google.appengine.ext import webapp
from web.constants import get_admin_user, title, slogan, menu, ARTICLES_ON_PAGE, \
cleaner
from appengine_utilities import sessions
from web.models import ArticleModel, CommentModel
from google.appengine.ext.webapp import template
import uuid
import os
from web.translate impo... | Python |
#-*- coding: utf-8 -*-
'''
Created on 20 сент. 2010
@author: ivan
'''
from google.appengine.api import users
from web import xss
menu = [
{"id" : "news", "rus" : "Главная", "eng" : "Main"},
{"id" : "screenshots", "rus" : "Внешний вид", "eng" : "Screenshots"},
{"id" : "about", "rus" : "Описание"... | Python |
# -*- coding: utf-8 -*-
dict = {
u'а':'a',
u'б':'b',
u'в':'v',
u'г':'g',
u'д':'d',
u'е':'e',
u'ё':'e',
u'з':'z',
u'и':'i',
u'й':'j',
u'к':'k',
u'л':'l',
u'м':'m',
u'н':'n',
u'о':'o',
u'п':'p',
u'р':'r',
u'с':'s',
u'т':'t',
u'у':'u',
u'ф':'f',
u'х':'h',
u'ъ':"'",
u'ы':'y',
u'ь':"'",
u'э':'e',
u'А':'A',
u'Б':'B',
u'В':'V... | Python |
from google.appengine.ext import webapp
from web.constants import get_admin_user, title, slogan, search, menu, ARTICLES_ON_PAGE, \
donate
from appengine_utilities import sessions
from web.models import ArticleModel, CommentModel, CommonStatisticModel
from google.appengine.ext.webapp import template
import uuid
impo... | Python |
from google.appengine.ext import webapp
from web.models import ArticleModel
from web.constants import title
import datetime
import os
from google.appengine.ext.webapp import template
class RssFeed(webapp.RequestHandler):
def get(self):
models = ArticleModel.all()
models.order('-date')
mo... | Python |
#-*- coding: utf-8 -*-
'''
Created on 20 сент. 2010
@author: ivan
'''
from google.appengine.ext import db
class ArticleModel(db.Model):
author = db.UserProperty()
title = db.StringProperty(multiline=False)
title_eng = db.StringProperty(multiline=False)
title_translit = db.StringProperty(multiline=Fals... | Python |
#-*- coding: utf-8 -*-
'''
Created on 20 сент. 2010
@author: ivan
'''
## {{{ http://code.activestate.com/recipes/496942/ (r1)
from htmllib import HTMLParser
from cgi import escape
from urlparse import urlparse
from formatter import AbstractFormatter
from htmlentitydefs import entitydefs
from xml.sax.saxutils import qu... | Python |
import urllib
import simplejson
baseUrl = "http://ajax.googleapis.com/ajax/services/language/translate"
def getSplits(text, splitLength=4500):
'''
Translate Api has a limit on length of text(4500 characters) that can be translated at once,
'''
return (text[index:index + splitLength] for inde... | Python |
#! /usr/bin/env python
# encoding: utf-8
# waf 1.6.10
VERSION='0.3.3'
import sys
APPNAME='p2t'
top = '.'
out = 'build'
CPP_SOURCES = ['poly2tri/common/shapes.cc',
'poly2tri/sweep/cdt.cc',
'poly2tri/sweep/advancing_front.cc',
'poly2tri/sweep/sweep_context.cc',
... | Python |
#!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | Python |
#!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | Python |
from google.appengine.ext import db
class Food(db.Model):
"""Models a food source entry with an author, date, name, kJ, kcal, carbs, fat, protein"""
author = db.UserProperty(required=True)
date = db.DateTimeProperty(auto_now_add=True)
name = db.StringProperty(required=True)
kj = db.IntegerProperty(required=T... | Python |
import logging
import locale
import os
import re
import cgi
import datetime
import urllib
import wsgiref.handlers
from django.utils import simplejson
from google.appengine.ext import db
from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext.webapp import template
from... | Python |
import Image #Image-processing libiary. Python Imaging Library (PIL)
import sys #Standard System library
import math #Standard Math library
def main():
picture = "ufoBlue" #name of the picture without file extension
img = Image.open(picture + ".png") #open requested image with file extension. Change... | Python |
import Image #Image-processing libiary. Python Imaging Library (PIL)
import sys #Standard System library
import math #Standard Math library
def main():
picture = "enemyBlue1" #name of the picture without file extension
img = Image.open(picture + ".png") #open requested image with file extension. Cha... | Python |
import Image
import sys
import math
def main():
picture = "enemyBlue4" #name of the picture without file extension
img = Image.open(picture + ".png") #open requested image with file extension. Change ".png" for other file type
norm = Image.new("RGBA", img.size) #Creates a new image that will be loaded... | Python |
import Image
img = Image.new( 'RGB', (255,255), "black") # create a new black image
pixels = img.load() # create the pixel map
for i in range(img.size[0]): # for every pixel:
for j in range(img.size[1]):
pixels[i,j] = (i, j, 100) # set the colour accordingly
img.show()
| Python |
import Image
import sys
im = Image.open("ufoBlue.png")
pix = im.load()
visited = []
#print im.size
#print pix[0,0]
res = [[0 for x in xrange(im.size[0])] for x in xrange(im.size[1])]
for i in range(im.size[0]):
for j in range(im.size[1]):
if pix[i, j][3] == 0:
res[i][j] = 0
e... | Python |
import Image
import sys
import math
def main():
picture = "enemyBlue1" #name of the picture without file extension
img = Image.open(picture + ".png") #open requested image with file extension. Change ".png" for other file type
norm = Image.new("RGBA", img.size) #Creates a new image that will be loaded... | Python |
import urllib
import urllib2
import re
import os
from urlparse import urlparse, parse_qs
import StorageServer
from BeautifulSoup import BeautifulSoup, BeautifulStoneSoup
import xbmcplugin
import xbmcgui
import xbmcaddon
base_url = 'http://www.foodnetwork.com'
addon = xbmcaddon.Addon()
addon_version = addon.getAddon... | Python |
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
class MainPage(webapp.RequestHandler):
def get(self):
self.response.headers['Content-Type'] = 'text/plain'
self.response.out.write('Hello, webapp World!')
application = webapp.WSGIApplicat... | Python |
#Football Schedule GUI program
import re
import gdata.calendar.service
import atom
import sys
from PyQt4 import QtGui, QtCore
import icalendar
from datetime import datetime
from icalendar import UTC
# Level abbreviations and game fees
levels = {"Freshman":"Fr", "JV":"JV", "Varsity":"V", "8th Grade":"8", "Invalid":"In... | Python |
"""wrapper for libmpq"""
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the ... | Python |
#!/usr/bin/env python
from __future__ import division
import sys
import mpq
archive = mpq.Archive(sys.argv[1])
print "Name: %s" % sys.argv[1]
print "Version: %s" % archive.filename
print "Offset: %s" % archive.offset
print "Packed size: %s" % archive.packed_size... | Python |
#!/usr/bin/python
import datetime
#import subprocess
import commands
import time
import sys
def main(argv):
if len(argv) < 2:
sys.stderr.write("Usage: %s <action>" % (argv[0],))
return 1
output = commands.getoutput("ps -e")
while argv[1] in output:
output = commands.getoutput("ps -e")
print argv[... | Python |
#!/usr/bin/python
#@author Aditya Kumar
#This python script is used in copying the directory structure
#from one directory-path to the other.
import os
import shutil
import sys
if __name__ == '__main__':
os.system('rm -rf dm_dir')
origPath = "/home/hiraditya/Downloads/hiphop/hiphop-aug17/hiphop-php"
pathname = "... | Python |
#!/usr/bin/python
import datetime
#import subprocess
import commands
import time
import sys
def main(argv):
if len(argv) < 2:
sys.stderr.write("Usage: %s <action>" % (argv[0],))
return 1
output = commands.getoutput("ps -e")
while argv[1] in output:
output = commands.getoutput("ps -e")
print argv[... | Python |
#!/usr/bin/python
#@author Aditya Kumar
#This python script is used in copying the directory structure
#from one directory-path to the other.
import os
import shutil
import sys
if __name__ == '__main__':
os.system('rm -rf dm_dir')
origPath = "/home/hiraditya/Downloads/hiphop/hiphop-aug17/hiphop-php"
pathname = "... | Python |
#!/usr/bin/python
import pygst
pygst.require("0.10")
import gst
class StreamManager:
"Classe do gerenciador de media.\nFornece funcoes de abrir, tocar e pausa."
def __init__(self, metadata_callback=None, eos_callback=None):
'''Construtor do StreamManager. Pode receber uma funcao de atualizacao a
ser chamada quan... | Python |
#!/usr/bin/python
import pygst
pygst.require("0.10")
import gst
class StreamManager:
"Classe do gerenciador de media.\nFornece funcoes de abrir, tocar e pausa."
def __init__(self, metadata_callback=None, eos_callback=None):
'''Construtor do StreamManager. Pode receber uma funcao de atualizacao a
ser chamada quan... | Python |
#!/usr/bin/python
from StreamManager import StreamManager
import pygtk
pygtk.require("2.0")
import gtk
import gtk.glade
import gobject
class PyPlaya:
def __init__(self):
self.timeout_id = -1
self.was_playing = False
self.streamManager = StreamManager(self.metadata_callback,
self.eos_callback)
self.widge... | Python |
#!/usr/bin/python
from StreamManager import StreamManager
import pygtk
pygtk.require("2.0")
import gtk
import gtk.glade
import gobject
class PyPlaya:
def __init__(self):
self.timeout_id = -1
self.was_playing = False
self.streamManager = StreamManager(self.metadata_callback,
self.eos_callback)
self.widge... | 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.