code stringlengths 1 199k |
|---|
from GUIComponent import GUIComponent
from enigma import eEPGCache, eListbox, eListboxPythonMultiContent, gFont, RT_HALIGN_LEFT, RT_HALIGN_RIGHT, RT_HALIGN_CENTER, RT_VALIGN_CENTER
from Tools.Alternatives import CompareWithAlternatives
from Tools.LoadPixmap import LoadPixmap
from time import localtime, time
from Compon... |
"""
OpenVZ container-type virtualization installation functions.
Copyright 2012 Artem Kanarev <kanarev AT tncc.ru>, Sergey Podushkin <psv AT tncc.ru>
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; ei... |
DEFAULT_INSTANCE_NAME = "booth"
GLOBAL_KEYS = (
"transport",
"port",
"name",
"authfile",
"maxtimeskew",
"site",
"arbitrator",
"site-user",
"site-group",
"arbitrator-user",
"arbitrator-group",
"debug",
"ticket",
)
TICKET_KEYS = (
"acquire-after",
"attr-prereq",... |
import sys
import sublime
import sublime_plugin
import subprocess
import json
from os import path, name
__file__ = path.normpath(path.abspath(__file__))
__path__ = path.dirname(__file__)
libs_path = path.join(__path__, 'libs')
csscomb_path = path.join(libs_path, 'call_string.php')
is_python3 = sys.version_info[0] > 2
d... |
import os, sys
if __name__ == '__main__':
execfile(os.path.join(sys.path[0], 'framework.py'))
from Products.UWOshOIE.tests.uwoshoietestcase import UWOshOIETestCase
class TestWorkflowsInstalled(UWOshOIETestCase):
"""Test all workflows"""
def afterSetUp(self):
self.workflow = self.portal.portal_workfl... |
import os, sys, getopt
import threading, signal, time
import confluent_kafka
class Producer(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
def run(self):
try:
sent = 0
if not debug:
producer = confluent_kafka.Producer(**conf)
print "con... |
"""
Unit testing for determining paramters of the intersections of two cuboids
(C) Martin Green 2014
"""
from unittest import TestCase, skip
from cuboid_set_operation_results import *
class IntersectionVolumesTests(TestCase):
def test_complete_intersection(self):
self.assertAlmostEqual(intersection_volume((... |
"""
gateway tests - Testing various methods on a Big image when renderingEngine.load() etc throws MissingPyramidException
"""
import exceptions
import unittest
import omero
import time
import gatewaytest.library as lib
class PyramidTest (lib.GTest):
def setUp (self):
super(PyramidTest, self).setUp()
... |
import threading
import time
class ThreadRunner(threading.Thread):
def __init__(self, thread_id, divisor):
self.thread_id = thread_id
self.divisor = divisor
threading.Thread.__init__(self)
def run(self):
for i in range(1, 100):
if i % self.divisor == 0:
... |
import os, sys, inspect
import sublime
BASE_PATH = os.path.abspath(os.path.dirname(__file__))
PACKAGES_PATH = sublime.packages_path() or os.path.dirname(BASE_PATH)
sys.path += [BASE_PATH]
import base
class Grep (base.Base):
pass
engine_class = Grep |
from django.contrib import admin
from finance_game.models import Stock
from finance_game.models import StockOption
from finance_game.models import Portfolio
from finance_game.models import Wallet
from finance_game.models import Currency
from finance_game.models import HistoricStockPrice
from finance_game.models import ... |
from Tkinter import *
from Creep import *
class Generateur:
def __init__(self, x=0, y=0, tempsVagues=10000, tempsCreep=1000, leController=None, actif=True, partieEnCours=False, nbrCreepsParVague=5):
self.x = x
self.y = y
self.tempsVagues = tempsVagues
self.tempsCreep = tempsCreep
... |
baseURL = 'http://lrs:8080'
endpoint = 'http://lrs:8080/xapi/'
username = 'username'
password = 'password' |
"""ShutIt module. See http://shutit.tk/
"""
from shutit_module import ShutItModule
class sqlite(ShutItModule):
def is_installed(self, shutit):
return shutit.file_exists('/root/shutit_build/module_record/' + self.module_id + '/built')
def build(self, shutit):
shutit.send('mkdir -p /tmp/build/sqlite')
shutit.send... |
import socket
import sys
port = 70
host = sys.argv[1]
filename = sys.argv[2]
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
s.connect((host, port))
except socket.gaierror as e:
print "Error connecting to server: %s" % e
sys.exit(1)
s.sendall(filename + "\r\n")
while True:
buf = s.recv(2048)
... |
__author__ = 'Olga Botvinnik'
__email__ = 'olga.botvinnik@gmail.com'
__version__ = '0.1.0'
from .visualize import wasabiplot
__all__ = ['wasabiplot'] |
import re
content = open('regex_sum_42.txt', 'r')
integers = re.findall('\d+', content.read())
sum = 0
for item in integers:
sum += int(item)
print sum |
from django.db import models
from tech.models import Tech
class Race(models.Model):
name = models.CharField(max_length=250)
techs = models.ManyToManyField(Tech) |
"""
Salamander ALM
Copyright (c) 2016 Djuro Drljaca
This Python module 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 Python module is... |
'''
By Jeremy Mill
jeremymill@gmail.com
github.com/livinginsyn
licensed until the GPL V2
'''
import subprocess
import sys
import os
class Wifi_Manager:
def __init__(self):
#init vars with some default values, just in case something goes wrong. These should be 'safe values'
#trusted_time is safe at 0... |
import inkex
import re
class C(inkex.Effect):
def __init__(self):
inkex.Effect.__init__(self)
self.OptionParser.add_option("-w", "--width", action="store", type="int", dest="generic_width", default="1920", help="Custom width")
self.OptionParser.add_option("-z", "--height", action="store", type="int",... |
import sys
import code5 as c
from random import Random
def read_training_set(file_name):
with open(file_name, 'r') as ts_file:
parse_line = lambda l: tuple(l.strip().split())
return map(parse_line, ts_file.readlines())
def train_and_predict(activation_func="th"):
rand = Random(0)
nn = c.Neur... |
from threading import Thread
from threading import Lock
import Queue
from ftplib import FTP
from utils import config
from console import thread_manager_processes
from console import threads_map_key
import os
import uuid
import time
exitFlag = 0
class LayerDownloadThread(Thread):
layer_name = None
source_name = ... |
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
class Migration(migrations.Migration):
dependencies = [
('notices', '0002_auto_20150211_2015'),
]
operations = [
migrations.AlterField(
model_name='notice',
name='event_da... |
import os.path
import logging
import shutil
from chimera.core.constants import (SYSTEM_CONFIG_DIRECTORY,
SYSTEM_CONFIG_DEFAULT_FILENAME,
SYSTEM_CONFIG_DEFAULT_SAMPLE,
SYSTEM_CONFIG_LOG_NAME)
logging.getLogger().s... |
"""
Provide the management of databases from CLI. This includes opening, renaming,
creating, and deleting of databases.
"""
import re
import os
import sys
import ast
import time
from urllib.parse import urlparse
from urllib.request import urlopen, url2pathname
import tempfile
import logging
from gprime.plug import Base... |
import os
import sys
import types
from zope.interface import implements
from feat.common import log, decorator, fiber, manhole, mro
from feat.interface import generic, agent, protocols
from feat import applications
from feat.agencies import retrying, recipient
from feat.agents.base import (replay, requester, alert,
... |
from objects import NamedEntity
class User(NamedEntity):
yaml_tag = "!User"
STATUS = [
'new',
'alive',
'dead',
]
def __init__(
self,
name = None,
id = None,
password = None,
token = None,
status = 'new',
location_id = None,
... |
import argparse
import gettext
import sys
import os
import wx
import socket
from subprocess import call
import math
import cmath
import time
import traceback
from math import pi, sin, cos, log, sqrt, atan2
import gettext
import __builtin__
__builtin__.__dict__['_'] = wx.GetTranslation
BTN_AMPLIFICADOR_INVERSOR = wx.New... |
from copy import copy
from poemtube.errors import InvalidRequest
def getpoem( db, id ):
if id not in db.poems:
raise InvalidRequest(
'"%s" is not the ID of an existing poem.' % id, 404 )
ans = copy( db.poems[id] )
ans["id"] = id
del ans["_id"]
del ans["_rev"]
return ans |
"""
Holding Pen is a web interface overlay for all BibWorkflowObject's.
This area is targeted to catalogers and administrators for inspecting
and reacting to workflows executions. More importantly, allowing users to deal
with halted workflows.
For example, accepting submissions or other tasks.
"""
import os
import json... |
"""
Created 9/2/15 by Greg Griffes
"""
import time
from zilog_ZDMII_constants import *
from zilog_ZDMII import zilog_ZDMII
import Tkinter as tk
class App:
def __init__(self, master):
frame = tk.Frame(master)
frame.pack()
zdmii = zilog_ZDMII("/dev/ttyAMA0")
sw_text = tk.StringVar()
... |
from Plugins.Plugin import PluginDescriptor
from Screens.Screen import Screen
from Components.ActionMap import ActionMap
from Components.Label import Label
from Components.Pixmap import Pixmap
from Components.Sources.List import List
from Components.Sources.StaticText import StaticText
from Components.Ipkg import IpkgC... |
class DummyCache(dict):
"""
A dummy cache class to store deserialized item of documents to privent
serializers to do not efficient jobs like database queries.
"""
pass
dummy_cache = DummyCache() |
from django import forms
from braces.forms import UserKwargModelFormMixin
from defusedxml import DefusedXmlException
from defusedxml.cElementTree import fromstring
from feeds.models import Feed, URL_MAX_LEN
from subscriptions.models import Subscription, Category
MAX_OPML_FILE_SIZE = 1024 * 1024 * 2
OPML_CONTENT_TYPES =... |
"""
main function.
"""
import sys
import socket
import time
from .common import options, excepthook, dprint, Stats, ErrorMessage, UsageError, ITIMEOUT, RETRIES
from .options import parse_args
from .util import random_init, get_socketparams, is_multicast
from .dnsparam import qc, qt
from .dnsmsg import DNSquery, DNSresp... |
from django.db import models
from influencetx.core import constants, utils
import logging
log = logging.getLogger(__name__)
class Legislator(models.Model):
# Legislator ID from Open States API.
openstates_leg_id = models.CharField(max_length=48, db_index=True)
tpj_filer_id = models.IntegerField(default=0, b... |
from lnst.Common.LnstError import LnstError
class MeasurementError(LnstError):
pass |
"""Blueprints for item."""
from __future__ import absolute_import
from .api_views import api_blueprint
from .rest import InventoryListResource
inventory_list = InventoryListResource.as_view(
'inventory_search'
)
api_blueprint.add_url_rule(
'/inventory',
view_func=inventory_list
)
blueprints = [
api_blue... |
from __future__ import print_function
from __future__ import division
import math
import gmpy2
from gmpy2 import mpfr
gmpy2.get_context().precision=1024
def P(n,r): # n=longest run. R = length of data sequence
topa = -mpfr(r+1)
bottoma = (mpfr(2)**mpfr(n+1))-n-2
first = gmpy2.exp(topa/bottoma)
topb = (m... |
from __future__ import print_function
import argparse
import sys
def GetArgs():
parser = argparse.ArgumentParser(description = "Apply an lexicon edits file (output from steps/dict/select_prons_bayesian.py)to an input lexicon"
"to produce a learned lexicon.",
... |
import urllib
import urlparse
import subprocess
from django.conf import settings
import facebook
from instagram.client import InstagramAPI
import tweepy
class FacebookError(Exception):
def __init__(self, message, errors):
super(FacebookError, self).__init__(message)
self.errors = 'Could not connect ... |
# -*- coding: utf-8 -*-
from imports import *
import mp_globals
from Screens.Screen import Screen
from Components.ActionMap import NumberActionMap
from Components.Label import Label
from Components.Sources.StaticText import StaticText
from Components.MenuList import MenuList
from Tools.Directories import SCOPE_CURRENT... |
import GemRB
from ie_stats import *
from GUIDefines import *
import GUICommon
import CommonTables
from ie_restype import RES_BMP
CharGenWindow = 0
TextAreaControl = 0
PortraitName = ""
def PositionCharGenWin(window, offset = 0):
global CharGenWindow
CGFrame = CharGenWindow.GetFrame()
WFrame = window.GetFrame()
wind... |
"""This is just a helpful demo server for testing this site."""
import BaseHTTPServer
import sys
from SimpleHTTPServer import SimpleHTTPRequestHandler
HandlerClass = SimpleHTTPRequestHandler
ServerClass = BaseHTTPServer.HTTPServer
Protocol = "HTTP/1.0"
if sys.argv[1:]:
port = int(sys.argv[1])
else:
port = ... |
"""Unittests for mysql.connector.locales
"""
from datetime import datetime
import tests
from . import PY2
from mysql.connector import errorcode, locales
def _get_client_errors():
errors = {}
for name in dir(errorcode):
if name.startswith('CR_'):
errors[name] = getattr(errorcode, name)
re... |
"""Simple script that creates the first distributiongroup in Cerebrum.
If you want some other group name, you will add getopt-stuff to this script!
Or else!!1
"""
import sys
from Cerebrum.Utils import Factory
from Cerebrum.modules.Email import EmailDomain
from Cerebrum.modules.Email import EmailAddress
from Cerebrum.mo... |
from pyspark import SparkContext
from pyspark import SparkConf
import os
import sys
conf = SparkConf()
sparkmaster=sys.argv[1]
wordcountfile=sys.argv[2]
conf.setMaster(sparkmaster)
conf.setAppName("test")
sc = SparkContext(conf = conf)
file = sc.textFile(wordcountfile)
counts = file.flatMap(lambda line: line.split(" ")... |
from ... import SCHEMA_VERSION
from .annotation import AnnotatableEncoder
from omero.model import ChannelI
class Channel201501Encoder(AnnotatableEncoder):
TYPE = 'http://www.openmicroscopy.org/Schemas/OME/2015-01#Channel'
def encode(self, obj):
v = super(Channel201501Encoder, self).encode(obj)
c... |
canvas_width = 600
canvas_height = 390
canvas_grid_size = 30
canvas_grid_color = (0.8, 0.8, 0.8)
built_ins = {
'range': range
} |
"""The lexer"""
import sys
import re
def lex(characters, token_exprs):
"""
A somewhat generic lexer.
characters -- the string to be lexed
token_exprs -- the tokens that consitute our grammar
returns -- a list of tokens of the form (contents, tag)
"""
pos = 0
tokens =... |
import unittest
import sys
import time
import os
sys.path.append("../../")
from coffee_pot import coffee_pot
class TestWriteLastBrew(unittest.TestCase):
def setUp(self):
self.test_coffee_pot = coffee_pot("test",
full=70,
empty=35,
off=20,
... |
from __future__ import unicode_literals
import datetime
from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from django.contrib.auth.decorators import permission_required
from django.template.defaulttags import register
from django.contrib import messages
from django.utils.tran... |
__author__ = "Adrian Weber, Centre for Development and Environment, University of Bern"
__date__ = "$May 16, 2013 1:24:16 PM$"
from decide_user.model.meta import Base
import hashlib
from sqlalchemy import Boolean
from sqlalchemy import CheckConstraint
from sqlalchemy import Column
from sqlalchemy import DateTime
from s... |
from pykickstart.base import BaseData, KickstartCommand
from pykickstart.options import KSOptionParser
import gettext
import warnings
from pykickstart import _
class F12_GroupData(BaseData):
removedKeywords = BaseData.removedKeywords
removedAttrs = BaseData.removedAttrs
def __init__(self, *args, **kwargs):
... |
from django.views.generic import TemplateView, CreateView, \
UpdateView, DeleteView, DetailView
from django.views.generic.detail import SingleObjectMixin
from django.utils.translation import ugettext_lazy as _
from django.urls import reverse_lazy, reverse
from common.permissions import PermissionsMixin, IsOrgAdmin
... |
import importlib
from django.conf import settings
from django.utils.functional import memoize
APP_FORMAT = getattr(settings, "GLOBAL_STATIC_MODULE_FORMAT", "%s.static")
JS_PROPERTY = getattr(settings, "GLOBAL_STATIC_JS_PROPERTY", "global_js")
CSS_PROPERTY = getattr(settings, "GLOBAL_STATIC_CSS_PROPERTY", "global_css")
... |
import paho.mqtt.client as mqtt
def on_connect(client, userdata, rc):
print("Connected with result code "+str(rc))
# Subscribing in on_connect() means that if we lose the connection and
# reconnect then subscriptions will be renewed.
client.subscribe("Desert-Home/Weather/#")
def on_message(client, userdata, msg):
... |
'''
Specto Add-on
Copyright (C) 2015 lambda
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 3 of the License, or
(at your option) any later version.
This pro... |
import os.path
from PyQt4.QtCore import *
from qgis.core import *
import exiftool
import geotagphotos_utils as utils
class ImportThread(QThread):
rangeChanged = pyqtSignal(list)
updateProgress = pyqtSignal()
processFinished = pyqtSignal(bool)
processInterrupted = pyqtSignal()
wildcards = [".jpg", ".... |
import wx, sys, os, logging
import wx.lib.newevent
log = logging.getLogger( 'squaremap' )
SquareHighlightEvent, EVT_SQUARE_HIGHLIGHTED = wx.lib.newevent.NewEvent()
SquareSelectionEvent, EVT_SQUARE_SELECTED = wx.lib.newevent.NewEvent()
SquareActivationEvent, EVT_SQUARE_ACTIVATED = wx.lib.newevent.NewEvent()
class HotMap... |
from distutils.core import setup, Extension
from setup import *
CdiLib_module = Extension('_CdiLib',
sources=['cdilib_wrap.c'],
extra_compile_args = INCFLAGS,
library_dirs = LDFLAGS,
extra_objects = ['../../src/cdilib.o'],
extra_l... |
from django.db import models
from django.db.models import Q
from django.conf import settings
from django.contrib.auth.models import AbstractUser
from tournaments.models import Tournament, Team, Fixture, Match
class Player(AbstractUser):
friends = models.ManyToManyField('self', through = 'PlayerFriend', symmetrical ... |
streaming_subreddits = [
{'name': 'Soccer Streams', 'url': 'soccerstreams'},
{'name': 'MMA Streams', 'url': 'MMAStreams'},
{'name': 'NFL Streams', 'url': 'NFLStreams'},
{'name': 'NBA Streams', 'url': 'nbastreams'},
{'name': 'NCAA BBall Streams', 'url': 'ncaaBBallStreams'},
{'name': 'CFB Streams', 'url': 'CFBStreams'},
... |
from phantom_team.strategy.formation import positions
from smsoccer.strategy import formation
from smsoccer.strategy.formation import player_position
from smsoccer.world.world_model import WorldModel, PlayModes
from smsoccer.players.abstractgoalie import AbstractGoalie
from smsoccer.util.fielddisplay import FieldDispla... |
import logging
from .HTMLElement import HTMLElement
from .attr_property import attr_property
from .bool_property import bool_property
from .text_property import text_property
log = logging.getLogger("Thug")
class HTMLScriptElement(HTMLElement):
_async = bool_property("async", readonly = True, novalue = True)
t... |
from django.core.management.base import BaseCommand, CommandError
from projects.models import *
from time import sleep
import requests
class Command(BaseCommand):
def handle(self, *args, **options):
OC_URL = "http://opencoesione.gov.it/api/nature.json?page=1"
"""
{
"count": 6,
... |
from setuptools import setup
import shutil
import os
from . import version
PACKAGE = 'periscope-gnome'
VERSION = version.VERSION
try:
os.makedirs("./debian/periscope-gnome/usr/share/nautilus-python/extensions")
except:
pass
shutil.copy('periscope-nautilus/periscope-nautilus.py', 'debian/periscope-gnome/usr/share/naut... |
fname = input("Enter file name: ")
if len(fname) < 1 : fname = "mbox-short.txt"
lst = list()
fh = open(fname)
count = 0
for line in fh:
if not line.startswith("From"): continue
if line.startswith('From:'): continue
line = line.split()
words = line[1]
lst.append(words)
count = count + 1
for eleme... |
""" This file contains unit tests for the SubtypeGraph module """
from unittest import TestCase
import os
from lib.NormaLoader import NormaLoader
from lib.SubtypeGraph import SubtypeGraph
import lib.TestDataLocator as TestData
class TestSubtypeGraph(TestCase):
""" Unit tests for the SubtypeGraph module. """
def... |
import os
import os.path
import shutil
import hashlib
import filecmp
import createrepo_c as cr
from .plugins_common import GlobalBundle, Metadata
from .common import LoggingInterface, DEFAULT_CHECKSUM_NAME
from .errors import DeltaRepoPluginError
PLUGINS = []
METADATA_MAPPING = {} # { "wanted_metadata_type": ["require... |
import logging
logger = logging.getLogger(__name__)
from gi.repository import GObject
from gi.repository import Gdk
from gi.repository import Gtk
from gettext import gettext as _
from advene.gui.views import AdhocView
from advene.gui.edit.frameselector import FrameSelector
import advene.util.helper as helper
from adven... |
"""
EasyBuild support for building and installing dummy extensions, implemented as an easyblock
@author: Kenneth Hoste (Ghent University)
"""
from easybuild.framework.extensioneasyblock import ExtensionEasyBlock
class DummyExtension(ExtensionEasyBlock):
"""Support for building/installing dummy extensions.""" |
"""
Toolbox for showing packets that is sent via the communication link when
debugging.
"""
import os
from time import time
from PyQt4 import QtGui
from PyQt4 import uic
from PyQt4.QtCore import pyqtSignal
from PyQt4.QtCore import pyqtSlot
from PyQt4.QtCore import Qt
import cfclient
__author__ = 'Bitcraze AB'
__all__ =... |
import os
import sys
import stat
import signal
import thread
sys.path.append (os.path.abspath (os.path.realpath(__file__) + '/../CTK'))
import CTK
import OWS_Login
import config_version
from configured import *
def init (scgi_port, cfg_file):
# Translation support
CTK.i18n.install ('cherokee', LOCALEDIR, unicod... |
''' Setup for core modules
'''
console_scripts = [
'align = arachnid.pyspider.align:main',
'defocus = arachnid.pyspider.defocus:main',
'classify = arachnid.pyspider.classify:main',
'create-align = arachnid.pyspider.create_align:main',
'enhancevol = arachnid.pyspider.enhance_volume:main',
'filtervol = arachnid.pys... |
"""BibEdit Templates."""
__revision__ = "$Id$"
from invenio.config import CFG_SITE_URL
from invenio.messages import gettext_set_language
class Template:
"""BibEdit Templates Class."""
def __init__(self):
"""Initialize."""
pass
def menu(self):
"""Create the menu."""
imgCompres... |
"""
Some useful tools dealing with popplerqt5 (PDF) documents.
"""
import os
class Document(object):
"""Represents a (lazily) loaded PDF document."""
def __init__(self, filename=''):
self._filename = filename
self._document = None
self._dirty = True
def filename(self):
"""Ret... |
import os
import json
class Config(object):
def __init__(self, **kwargs):
self.data = {}
self.conf_loader = JSONConfLoader()
self.data.update(self.conf_loader.read_all())
def write_all(self):
self.conf_loader.write_all(self.data)
def get(self, key, default=None):
retu... |
from IPGSdb import *
from IPGSdb import deleteUsers
def testUsers():
print "\n"
print "---------------------------------------------------------------------------------------------------------------------"
print "\n"
print "START TESTING USERS CRUD FUNCTIONS"
print "\n"
print "------------------------------------... |
DEBUG = True
BCRYPT_LEVEL = 12
MAIL_FROM = "someone@somewhere.com"
RECAPTCHA_PUBLIC_KEY = "6LcIFAITAAAAAEQZFaKrW3DoDVyeux4iSk9yJItk"
RECAPTCHA_PRIVATE_KEY = "6LcIFAITAAAAAIQwieMGyB5dGCbOmwgoIufLzsVH"
MONGODB_SETTINGS = {'DB' : 'ctfdb'}
SECRET_KEY = 'Oooooh!S3cr3T!!!!' |
"""
@author: zengchunyun
"""
import logging
logging.basicConfig(filename="acces8s.log", level=logging.INFO,
format='%(asctime)s %(message)s')
logging.warning("heled")
logging.debug('This message should go to the log file')
logging.info('So should this')
logging.warning('And this, too') |
from __future__ import absolute_import
from django.conf import settings
import os, sys
import traceback
import StringIO
import logging
import Queue
import threadpool
import uuid
import threading
import datetime
import time
import importlib
_dispatchQueue = Queue.Queue()
_scheduleQueue = []
_dispatchpool = threadpool.Th... |
from Container import Container
HTML = """
<div id="%(id)s" class="indenter">
%(content)s
</div>
"""
class Indenter (Container):
def __init__ (self, widget=None, level=1):
Container.__init__ (self)
self.level = level
if widget:
self += widget
def Render (self):
render... |
from __future__ import absolute_import
import time
import dnf.cli
import dnfpluginsextras
import subprocess
_ = dnfpluginsextras._
class Tracer(dnf.Plugin):
"""DNF plugin for `tracer` command"""
name = "tracer"
def __init__(self, base, cli):
super(Tracer, self).__init__(base, cli)
self.times... |
NAME = "Pinguino IDE tk"
VERSION = "11.0"
SUBVERSION = "beta.1"
"""-------------------------------------------------------------------------
Pinguino IDE tk
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by th... |
from django.core.exceptions import PermissionDenied, ValidationError
from django.template.defaultfilters import filesizeformat
from django.utils.translation import gettext as _
from rest_framework import viewsets
from rest_framework.response import Response
from misago.acl import add_acl
from ..models import Attachment... |
from openerp.osv import fields, osv
from openerp.tools.translate import _
import openerp.netsvc as netsvc
class account_invoice(osv.Model):
_inherit = 'account.invoice'
def search_asociated_invoice(self, cr, uid, ids, context=None):
if context is None:
context = {}
data_pool = self.p... |
"""Add a packages table.
Revision ID: 15f941de8d61
Revises: None
Create Date: 2015-05-07 10:28:02.798256
"""
revision = '15f941de8d61'
down_revision = None
from alembic import op
import sqlalchemy as sa
from sqlalchemy.sql import text
def upgrade():
# Create the new structures
op.create_table(
'packages... |
import cgi
import cgitb
cgitb.enable()
from shared.functionality.rmvgridowner import main
from shared.cgiscriptstub import run_cgi_script
run_cgi_script(main) |
n = int(input('Digite o valor de n: '))
a, b = 1, 1
k = 1
while k <= n-2:
a, b = b, a + b
k = k + 1
print (b) |
import subprocess, functools
from supermegazord.db import path
def ScriptSubprocess(path, args = []):
command = path
for arg in args:
command = command + " " + arg
subprocess.call(command, shell=True)
#print command
class ScriptArg:
def __init__(self, data):
try: self.description ... |
class MenuItem(object):
def __init__(self, id, text, route, weight, parentId = False ):
self.id = id
self.text = text
self.route = route
self.weight = weight
self.parentId = parentId
self.plugin = ''
def __repr__(self):
return "<%s/%d (%s)::'%s' (%s)>" % (... |
import bluepy.btle as ble
import threading
import struct
def perform_scan(iface):
a = ble.Scanner(iface)
res = a.scan(0.2)
devices = {}
for line in res:
addr = str(line.addr)
name = line.getValueText(9)
rssi = line.rssi
if addr in devices:
devices[addr][1].app... |
"""\
A Twitter reader and personal manager - Twitter API management.
"""
__metaclass__ = type
import simplejson
import twyt.twitter, twyt.data
import Common, Scheduler, Strip
class Error(Common.Error):
pass
twytter = twyt.twitter.Twitter()
user = None
password = None
class twytcall:
def __init__(this, message):... |
from json import JSONEncoder
from sys import int_info
from typing import List
class AuthUser:
def __init__(self,
user: str = '',
password: str = '',
device: str = "nakamori"):
self.user: str = user
self.password: str = password
self.device: str... |
import sys
from celery import shared_task
from django.conf import settings
from ops.celery.utils import (
create_or_update_celery_periodic_tasks, disable_celery_periodic_task
)
from ops.celery.decorator import after_app_ready_start
from common.utils import get_logger
from .models import User
from .utils import (
... |
a = []
n = 1111111111111111111111111111111111111111
with open('../data/p013_digits.data', 'r') as f:
for lines in f:
n = int(lines)
a.append(n)
s = sum(a)
print(str(s)[:10]) |
import fauxfactory
import pytest
from cfme.infrastructure import pxe
import utils.error as error
from utils.update import update
pytestmark = [pytest.mark.usefixtures("logged_in"), pytest.mark.tier(3)]
def test_system_image_type_crud():
"""
Tests a System Image Type using CRUD operations.
"""
sys_image_... |
"""
plot two-dimensional density view
"""
import numpy as np
import matplotlib.pyplot as plt
import scipy.interpolate
x, y, z = 10*np.random.random((3,10))
xi, yi = np.linspace(x.min(), x.max(), 100), np.linspace(y.min(), y.max(), 100)
xi, yi = np.meshgrid(xi, yi)
rbf = scipy.interpolate.Rbf(x,y,z,function='linear')
zi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.