code stringlengths 1 199k |
|---|
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "show_example.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv) |
from __future__ import print_function
import logging
from pajbot.managers.handler import HandlerManager
from pajbot.modules import BaseModule, ModuleSetting
log = logging.getLogger(__name__)
class RepspamModule(BaseModule):
ID = __name__.split(".")[-1]
NAME = "Repetitive Spam"
DESCRIPTION = "Times out messa... |
import numpy as np
import matplotlib.pyplot as plt
from scipy import optimize as opt
'''
La funcion choque entrega la posicion yn+1 y vn+1 en base a y y v.
Ademas, grafica la interseccion de las funciones. Esto permite comprobar que
para cualquier vn e yn entrega los valores siguientes siempre que vn sea mayor
que la v... |
from . import base
import alvi.client.api.tree
class Children:
def __init__(self, node):
self._children = []
self._node = node
def create(self, value):
node = Node(self._node._container, self._node, value)
self._children.append(node)
return node
def append(self, child... |
class AliexpressPipeline(object):
def process_item(self, item, spider):
return item |
''' eth utilities module '''
import json
import yaml
def json_to_yamler(json_dump):
''' converts from json to yaml output '''
json_dumped = json.dumps(json_dump)
yamled_dict = yaml.safe_load(json_dumped)
return yamled_dict |
import os, sys
bindir = os.path.abspath(os.path.dirname(sys.argv[0]))
libdir = bindir + "/../../lib"
sys.path.append(libdir)
import lacuna as lac
glc = lac.clients.Member(
config_file = bindir + "/../../etc/lacuna.cfg",
config_section = 'sitter',
)
my_planet = glc.get_body_byname( 'bmots01' )
arch = my_planet.g... |
from setuptools import setup
import re
import platform
import os
import sys
if 'test' in sys.argv:
# Setup test unloads modules after the tests have completed. This causes an
# error in atexit's exit calls because the registered modules no longer
# exist. This hack resolves this issue by disabling the regi... |
import os, sys, threading, time, json
from gui.taskbar import *
from lib.audio_win import *
from lib.spotify_win import *
from lib.spotify_remote import *
class trayicon(TrayIcon):
def __init__(self):
TrayIcon.__init__(self)
iconpath = os.path.abspath( "icon.ico" );
self.setIcon(iconpath)
self.show()
self.fn... |
"""
Python setup file for the hijack app.
In order to register your app at pypi.python.org, create an account at
pypi.python.org and login, then register your new app like so:
python setup.py register
If your name is still free, you can now make your first release but first you
should check if you are uploading the... |
class PepperCrawlerPipeline(object):
def process_item(self, item, spider):
return item |
"""
Integration tests for hyperparam optimization.
"""
from __future__ import division
from __future__ import unicode_literals
__author__ = "Bharath Ramsundar"
__copyright__ = "Copyright 2016, Stanford University"
__license__ = "MIT"
import os
import unittest
import tempfile
import shutil
import numpy as np
import tens... |
from ngta import TestBench as BaseTestBench
import logging
logger = logging.getLogger(__name__)
class TestBench(BaseTestBench):
def __init__(self):
super().__init__("bench_name", "bench_type")
def on_testrunner_started(self, event):
logger.info("%s handle %s start", self, event)
def on_testr... |
import os
import unittest
from unittest.mock import patch, MagicMock
import ldap3
from ldap3.core.exceptions import LDAPPasswordIsMandatoryError, LDAPBindError
from sipa.model.hss.ldap import (get_ldap_connection, HssLdapConnector as Connector,
might_be_ldap_dn, change_password)
from si... |
from python2_backend import MyDB
import threading
from comm_utils import PingPong #Peer
DB = MyDB()
class DebuggerPeer(PingPong):
def D_set_breakpoints(self, bps ):
for ldict in bps.values():
for k in ldict.keys():
ldict[int(k)] = ldict[k]
ldict.pop(k)
DB.breakpoints = bps
def D_set_break ... |
"""
This example shows how you can refer to other handlers when delcaring a handler in order
to guarentee an ordering between them.
It sets up 5 handlers: A, B, C, D, and "hello".
It specifies that:
B should be after A
B should be before "sync", ie. before any future messages are processed.
sync=True is mainly usef... |
"""Test binding."""
import numpy as np
from numpy.testing import TestCase
import pytest
import pyamg.amg_core.tests.bind_examples as g
class TestDocstrings(TestCase):
def test_1(self):
assert g.test1.__doc__.strip() == 'Testing docstring'
assert g.test1(1) == 1
def test_2(self):
assert g... |
import numpy as np
from data_prep import features, targets, features_test, targets_test
def sigmoid(x):
"""
Calculate sigmoid
"""
return 1 / (1 + np.exp(-x))
np.random.seed(42)
n_records, n_features = features.shape
last_loss = None
weights = np.random.normal(scale=1 / n_features**.5, size=n_features)
e... |
"""engine.SCons.Tool.msvc
Tool-specific initialization for Microsoft Visual C/C++.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os.path
imp... |
import febio
mesh = febio.MeshDef('simpleblock.inp','abq')
model = febio.Model(modelfile='body_force.feb',steps=[{'BodyForce': 'solid'}])
mat1 = febio.MatDef(matid=1,mname='Material 1',mtype='neo-Hookean',elsets=['exmymzm','exmypzm','exmymzp','exmypzp','expymzm','expypzm','expymzp','expypzp'],attributes={'density': '1.... |
from typing import Tuple
import picwriter.components as pc
import gdsfactory as gf
from gdsfactory.component import Component
from gdsfactory.components.waveguide_template import strip
from gdsfactory.types import ComponentFactory
@gf.cell
def coupler_adiabatic(
length1: float = 20.0,
length2: float = 50.0,
... |
"""
Created on Fri Mar 24 04:22:31 2017
@author: franklin
"""
"""
Complete the 'extract_airports()' function so that it returns a list of airport
codes, excluding any combinations like "All".
Refer to the 'options.html' file in the tab above for a stripped down version
of what is actually on the website. The test() ass... |
from django.conf import settings
from django.contrib.syndication.views import Feed
from django.utils.text import Truncator
from blogs.models import Blog
class LatestBlogsFeed(Feed):
site_name = settings.SITE_NAME
title = 'Simple Glucose Management App | %s' % site_name
link = '/'
description = 'Updates ... |
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("socialprofile", "0006_auto_20211030_2242"),
]
operations = [
migrations.AlterModelOptions(
name="proxysession",
options={
"verbose_name": "Monitor: session",
... |
import pytest
import broadbean as bb
from broadbean.sequence import (SequenceCompatibilityError,
SequenceConsistencyError, Sequence)
from broadbean.tools import makeVaryingSequence, repeatAndVarySequence
ramp = bb.PulseAtoms.ramp
sine = bb.PulseAtoms.sine
@pytest.fixture
def protosequenc... |
"""
A generic resource for publishing objects via JSON-RPC.
API Stability: semi-stable
Maintainer: U{Duncan McGreggor <mailto:oubiwann@adytum.us>}
"""
from twisted.protocols import basic
from twisted.internet import defer, protocol, reactor
from twisted.python import log, reflect
from txjsonrpc import jsonrpclib
from t... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('addrbookapp', '0002_auto_20170826_0943'),
]
operations = [
migrations.AlterField(
model_name='address',
name='phone_number',
... |
import numpy as np
def isVector(x):
return x.size == x.shape[0]
def isMatrix(x):
return not isVector(x)
def normalizeVector(x):
norm = np.linalg.norm(x)
y = x
if norm > 0:
y = np.ravel((1.0 / norm) * x)
return y
def normalizeVectors(x):
norm = normVectors(x)
nonZeroIDs = norm > 0... |
from typing import Optional, Tuple, List, Union, Mapping, Any, TypeVar, Generic, Dict
from dataclasses import dataclass
from typing_extensions import TypedDict
class MenuHtmlDialog(TypedDict):
type: str
menuTitle: str
caption: Optional[str]
html: str
class MenuLink(TypedDict):
type: str
menuTitl... |
KNIGHT_FORK_POSITION = [
' ', ' ', ' ', ' ', ' ', 'n', ' ', ' ',
' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
' ', 'r', ' ', ' ', ' ', ' ', ' ', ' ',
' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
'k', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
' ', ' ', ' ', 'N', ' ', 'K... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'SiteUser'
db.create_table(u'profiles_siteuser', (
(u'id', self.gf('django.db.models.fields.AutoField')(prim... |
from flask_wtf import Form
from wtforms import TextField, PasswordField, BooleanField
from wtforms.validators import DataRequired
class ModifyUser(Form):
username = TextField('username', validators=[DataRequired()])
password = PasswordField('password', validators=[DataRequired()])
admin = BooleanField('admi... |
from PyQt5.QtWidgets import *
import sys
class Window(QWidget):
def __init__(self):
QWidget.__init__(self)
layout = QBoxLayout(QBoxLayout.LeftToRight)
self.setLayout(layout)
label = QLabel("Label 1")
layout.addWidget(label, 0)
label = QLabel("Label 2")
layout.... |
"""
Enchants
- SpellItemEnchantment.dbc
"""
from .. import Model
class Enchant(Model):
pass
class EnchantProxy(object):
"""
WDBC proxy for enchants
"""
def __init__(self, cls):
from pywow import wdbc
self.__file = wdbc.get("SpellItemEnchantment.dbc", build=-1)
def get(self, id):
return self.__file[id]
def... |
"""Check format of an IP4 address and mask.
Provide functions:
parse(address, mask)
address_in_subnet(address, subnet, mask)"""
def _mask_list(mask):
"""Converts a mask integer representation of bits, to a list.
Given the number of mask bits, such as a number like 16
Returns a list of the subnet mask, such ... |
from collections import namedtuple
import re
__all__ = [
'builtin_types', 'parse', 'AST', 'Module', 'Type', 'Constructor',
'Field', 'Sum', 'Product', 'VisitorBase', 'Check', 'check']
builtin_types = {'identifier', 'string', 'bytes', 'int', 'object', 'singleton'}
class AST:
def __repr__(self):
raise ... |
from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
from specifyweb.specify.models import Taxon, Taxontreedefitem
class Command(BaseCommand):
help = 'Prints a specify tree.'
def handle(self, **options):
tdis = Taxontreedefitem.objects.all().order_by('-ranki... |
"""Tests the cola.utils module."""
from __future__ import absolute_import, division, print_function, unicode_literals
import os
from cola import core
from cola import utils
def test_basename():
"""Test the utils.basename function."""
assert utils.basename('bar') == 'bar'
assert utils.basename('/bar') == 'ba... |
from kaizen.error import KaizenError
class UpdateError(KaizenError):
pass |
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages
setup(name='zipdiff',
version='0.9-alpha',
description='Script to diff ZIP Files',
author='Sebastian Bachmann',
author_email='hello@reox.at',
package_dir={'': 'src'},
packages=[''],
... |
import mrp_workcenter |
import os
import subprocess
from gi.repository import Gtk, Gio
import json
class RandrPresetsWindow(Gtk.Window):
def __init__(self, presets, post_command):
Gtk.Window.__init__(self, title="RandRpresets")
self.post_command = post_command
self.presets = presets
self.set_border_width(10)
self.set_def... |
input = raw_input('Enter some integer nubers: ')
print input
for c in input:
print c |
from gi.repository import Gtk
import webbrowser
from xl.nls import gettext as _
from xl import settings, providers
from xlgui.accelerators import Accelerator
from xlgui.widgets import menu, menuitems, dialogs
def get_main():
from xlgui import main
return main.mainwindow()
def get_selected_playlist():
from x... |
from __future__ import division
import RG_v2 as RG
import RG as RG1
import numpy as np
import matplotlib.pyplot as plt
eta_conv = RG.sigma**3*np.pi/6
nmax = 0.75/eta_conv
ns = nmax*np.exp(np.arange(-15, 0, 1e-3))
def plotphi(T, n, mu, i, label):
plt.plot(n*eta_conv, RG.phi(T, n, mu, i), label=label)
def plotphi_old(T... |
'''
Copyright (C) 2015 Ryan M Cote.
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 dis... |
import glob, os, shlex
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.Qsci import QsciScintilla
from mercurial import commands, util
from tortoisehg.hgqt.i18n import _
from tortoisehg.hgqt import cmdui
from tortoisehg.util import hglib
class _LogWidgetForConsole(cmdui.LogWidget):
"""Wrapped LogWidg... |
from nose.tools import *
import networkx as nx
class TestAtlas(object):
def setUp(self):
self.GAG=nx.graph_atlas_g()
def test_sizes(self):
G=self.GAG[0]
assert_equal(G.number_of_nodes(),0)
assert_equal(G.number_of_edges(),0)
G=self.GAG[7]
assert_equal(G.number_of_... |
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from tortoisehg.util import hglib
from tortoisehg.hgqt.i18n import _
from tortoisehg.hgqt import qtlib, cmdui
class SignDialog(QDialog):
showMessage = pyqtSignal(QString)
output = pyqtSignal(QString, QString)
makeLogVisible = pyqtSignal(bool)
def __in... |
import PyKDE4.kdecore as __PyKDE4_kdecore
import PyQt4.QtCore as __PyQt4_QtCore
import PyQt4.QtGui as __PyQt4_QtGui
import PyQt4.QtSvg as __PyQt4_QtSvg
from KIdentityProxyModel import KIdentityProxyModel
class KCheckableProxyModel(KIdentityProxyModel):
# no doc
def data(self, *args, **kwargs): # real signature ... |
import service
import serviceattr
import keyword
import keywordservicemapper
import serviceattrval
import servicerequest
import agency
import user
import subscriptions
import citmodel
import note
CITModel = citmodel.CITModel
Service = service.Service
ServiceAttribute = serviceattr.ServiceAttribute
ServiceAttributeValue... |
__author__ = 'dserejo'
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
def run(kwargs):
profile = webdriver.FirefoxProfile('C:\Users\dserejo\AppData\Roaming\Mozilla\Fir... |
import os
import re
import tempfile
from mercurial import util, error, scmutil, phases
from tortoisehg.util import hglib, shlib, wconfig
from tortoisehg.hgqt.i18n import _
from tortoisehg.hgqt.messageentry import MessageEntry
from tortoisehg.hgqt import thgrepo
from tortoisehg.hgqt import qtlib, qscilib, status, cmdui,... |
import os
import sys
import gzip
from socket import gethostname
import yum
import yum.Errors
from yum.config import BaseConfig, Option, IntOption, ListOption, BoolOption
from yum.parser import ConfigPreProcessor
from ConfigParser import ConfigParser, ParsingError
from yum.constants import *
from email.mime.text import ... |
from django.contrib import admin
from post.models import Tag, Post, Category, PostTag
admin.site.register(Tag)
admin.site.register(Post)
admin.site.register(Category)
admin.site.register(PostTag) |
import GemRB
from GUIDefines import *
import GUICommon
import MessageWindow
import CommonWindow
FRAME_PC_SELECTED = 0
FRAME_PC_TARGET = 1
ContinueWindow = None
ReformPartyWindow = None
OldActionsWindow = None
OldMessageWindow = None
def DialogStarted ():
global ContinueWindow, OldActionsWindow
# try to force-close ... |
"""
code for jobs executing for workers
"""
__version__ = "$Rev: 7162 $" |
"""
This module contains a backport for collections.namedtuple obtained from
http://code.activestate.com/recipes/500261-named-tuples/
"""
from operator import itemgetter as _itemgetter
from keyword import iskeyword as _iskeyword
import sys as _sys
def namedtuple(typename, field_names, verbose=False, rename=False):
... |
import math
from datetime import date
import fauxfactory
import pytest
import re
import cfme.intelligence.chargeback.assignments as cb
import cfme.intelligence.chargeback.rates as rates
from cfme import test_requirements
from cfme.base.credential import Credential
from cfme.cloud.provider.azure import AzureProvider
fro... |
"""
WSGI config for roshanRush project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "roshanRush.settings")
from django.core... |
import MDAnalysis
import numpy as np
import plmd.plotData as myPlot
from pylab import plt,hist2d
from matplotlib.backends.backend_pdf import PdfPages
def runAnalysis( caseDir , backbone , timeFactor ):
# Retrieve info on the peptide
resNames = backbone.resnames()
# Go through each residue connection
for... |
from os import path
rosalind_id = path.basename(__file__).split('.').pop(0)
dataset = "../datasets/rosalind_{}.txt".format(rosalind_id)
data = open(dataset, 'r').read().split('>')
data.pop(0)
def dna(x):
x = x.splitlines()
dna = {
'id': x.pop(0),
}
dna_string = str().join(x)
#dna['dna_s... |
from Tkinter import *
import os
class Dialog(Toplevel):
def __init__(self, parent, title = None):
Toplevel.__init__(self, parent)
self.transient(parent)
if title:
self.title(title)
self.parent = parent
self.result = None
body = Frame(self)
self.ini... |
from mox3 import mox as mox
import unittest
from apt_forktracer.testlib import test_helper
from apt_forktracer.config_parser import ConfigParser
from apt_forktracer.config import Config
class Test_ConfigParser(test_helper.MoxTestCase):
def setUp(self):
super(Test_ConfigParser, self).setUp()
self.cp = ConfigParser(... |
from timeit import timeit
import math
import csv
iterations = 100000
reader = csv.DictReader(open('data/titledata.csv'), delimiter='|')
titles = [i['custom_title'] for i in reader]
title_blob = '\n'.join(titles)
cirque_strings = [
"cirque du soleil - zarkana - las vegas",
"cirque du soleil ",
"cirque du sol... |
import os
import errno
import fnmatch
import sys
import shlex
from Cython.Distutils import build_ext, Extension
from distutils.sysconfig import get_config_var, get_config_vars
import pkg_resources
from subprocess import check_output, CalledProcessError, check_call
from setuptools import setup
from setuptools.dist impor... |
import time, StringIO, commands, sys, re, threading, sets
def timer():
now = time.localtime(time.time())
return time.asctime(now)
def title():
print "\n\t d3hydr8[at]gmail[dot]com snmpBruteForcer v1.2"
print "\t--------------------------------------------------\n"
def scan(option):
nmap = StringIO.StringIO(comma... |
from os import getcwd, makedirs
from os.path import basename, join, splitext
from time import sleep
from urllib import urlopen, urlretrieve
from urlparse import urlparse
import json
'''
You can use the following code to download the manga list, but it's too slow:
url = 'https://www.mangaeden.com/api/list/0/'
response =... |
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.contrib.auth.decorators import login_required
from main.views import *
urlpatterns = patterns('',
url(r'^accounts/login/$', 'django.contrib.auth.views.login', {'template_name': 'login.html'}),
url(r'^logout/$',ExitV... |
import operator
import csv
from datetime import datetime
from tabulate import tabulate
class Table():
def __init__(self, lst=[]):
self._headers = []
self._table = []
for dct in lst:
self.append(dct)
@property
def headers(self):
return self._headers
def add_col... |
@profile
def primes(n):
if n==2:
return [2]
elif n<2:
return []
s=range(3,n+1,2)
mroot = n ** 0.5
half=(n+1)/2-1
i=0
m=3
while m <= mroot:
if s[i]:
j=(m*m-3)/2
s[j]=0
while j<half:
s[j]=0
j+=m
... |
from zope.interface import Interface
from zope import schema
from uwosh.hrjobposting import hrjobpostingMessageFactory as _
class IUnclassifiedJob(Interface):
"""Content type for unclassified positions"""
# -*- schema definition goes here -*-
positiondescription = schema.Bytes(
title=_(u"Position De... |
import numpy as np
import os
from six.moves import zip
from nose.plugins.attrib import attr
from numpy.testing import (assert_equal, assert_array_equal,
assert_almost_equal, dec)
from unittest import TestCase
import MDAnalysis as mda
from MDAnalysisTests.datafiles import (PDB, PSF, CRD, DCD,
... |
"""
This module contains some iterators.
"""
def drop(n, it):
it = iter(it)
for i in xrange(n):
it.next()
return it
def first(it, otherwise=None):
it = iter(it)
try:
return it.next()
except StopIteration:
return otherwise |
import CTK
from consts import *
from ows_consts import *
from configured import *
from XMLServerDigest import XmlRpcServer
class Menu (CTK.Box):
def __init__ (self, entries=[]):
CTK.Box.__init__ (self, {'class': 'market-menu'})
self.entries = entries[:]
def __iadd__ (self, entry):
self.e... |
from django.conf import settings
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('funds', '0032... |
from experiment_HaloIndep import *
from scipy import interpolate
from scipy.optimize import brentq, minimize, brute
from globalfnc import *
from basinhopping import *
from custom_minimizer import *
import matplotlib.pyplot as plt
import os # for speaking
import parallel_map as par
from scipy.stats import poisson
impo... |
import os
Mode = 'DEBUG'
THINKPAGE_CN_API_TOKEN = os.getenv('THINKPAGE_CN_API_TOKEN')
if THINKPAGE_CN_API_TOKEN is None:
THINKPAGE_CN_API_TOKEN = '' |
import re
import _util
import XMLBuilderDomain
from XMLBuilderDomain import _xml_property
from virtinst import _gettext as _
class DomainNumatune(XMLBuilderDomain.XMLBuilderDomain):
"""
Class for generating <numatune> XML
"""
@staticmethod
def validate_cpuset(conn, val):
if val is None or va... |
"""
***************************************************************************
GetScriptsAndModels.py
---------------------
Date : June 2014
Copyright : (C) 2014 by Victor Olaya
Email : volayaf at gmail dot com
**********************************************... |
import urlparse,re
import urllib, urllib2, os
from core import logger
from core import scrapertools
from core.item import Item
from core import jsontools
from core import config
DEBUG = False
CHANNELNAME = "a3media"
import hmac
ANDROID_HEADERS = [ ["User-Agent","Dalvik/1.6.0 (Linux; U; Android 4.3; GT-I9300 Build/JSS15... |
CODA_SERVER_URL = 'https://api.codaview.com' # Note no trailing slashe
API_RELATIVE_URL = "external/v2/json/" # Note trailing slash
import os
import oauth
import urllib, urllib2
import sys
try:
import json # Python 2.6 onwards
except ImportError:
try:
import simplejson as json
except ImportError:
... |
class Task:
def __init__(self):
self.success_requirements = []
self.failure_requirements = []
self.success_actions = []
self.failure_actions = []
self.state = 0
self.type = None
self.stack = []
def add_success_requirement(self, requirement):
self.s... |
"""Django ORM wrapper for the NAV manage database"""
default_app_config = 'nav.models.apps.NavModelsConfig'
import os
import sys
import django
from django.apps import apps as _apps
if 'DJANGO_SETTINGS_MODULE' not in os.environ:
os.environ['DJANGO_SETTINGS_MODULE'] = 'nav.django.settings'
if not _apps.ready:
dja... |
from resources.lib import encryption
import sys
import re
import os
saltFile = str(sys.argv[1])
password = str(sys.argv[2])
stringToEncrypt = str(sys.argv[3])
encrypt = encryption.encryption(saltFile,password)
print encrypt.encryptString(stringToEncrypt) |
"""@package modality_test
Module the performs the test for multi-modality in data output from prelim_analysis.py
"""
import numpy as np
import matplotlib.pyplot as plt
import time
import math
def etaCalc(k,kmax,dt):
dtest = dt*float(kmax)/float(k+1)
eta = dtest-dt
if eta < 120:
print("Estimated time... |
import os
import sys
from testlib import cmk_path, cmc_path, cme_path
import testlib.pylint_cmk as pylint_cmk
def test_pylint_misc():
search_paths = [
cmk_path() + "/omd/packages/omd",
cmk_path() + "/cmk_base",
cmk_path() + "/cmk_base/modes",
cmk_path() + "/cmk_base/automations",
... |
import sys
if sys.version_info[0] >= 3: # Python 3
import tkinter as tk
from tkinter import ttk
from tkinter import messagebox as msgbox
else:
import Tkinter as tk
import tkMessageBox as msgbox
import ttk
import random
import pjsua2 as pj
import endpoint
import application
class Buddy(pj.Buddy):... |
import fauxfactory
import pytest
from riggerlib import recursive_update
from textwrap import dedent
from cfme import test_requirements
from cfme.automate.explorer.domain import DomainCollection
from cfme.cloud.instance import Instance
from cfme.cloud.provider import CloudProvider
from cfme.cloud.provider.azure import A... |
"""
Routines for plotting rpbi's p-maps
Requires:
- Pmap
- MNI T-1 template
"""
import os
import numpy as np
import nibabel as nib
from nilearn.plotting import plot_img, cm
import matplotlib.cm as cmap
import matplotlib.pyplot as plt
def plot_pmaps():
for gr in groups:
filename = '_'.join([... |
check_mk_execution_time = {
'opt' : {
'height': '100',
'title': "%s: Check_MK check execution time" % hostname,
'vertical-label': "time (s)"
},
'def' : [
'DEF:extime=%s:1:MAX' % rrd_file['execution_time'],
'AREA:extime#d080af:execution time ',
'LINE1:extime#d0... |
"""
Common tasks for 'Invoke' that are needed again and again.
The ``rituals`` package provides PyInvoke tasks that work for any
project, based on its project metadata, to automate common
developer chores like 'clean', 'build', 'dist', 'test', 'check',
and 'release-prep' (for the moment).
The gu... |
"""autogenerated by genpy from robot/Rotate.msg. Do not edit."""
import sys
python3 = True if sys.hexversion > 0x03000000 else False
import genpy
import struct
class Rotate(genpy.Message):
_md5sum = "90337cd7fb14d26b7be15ee3df49f209"
_type = "robot/Rotate"
_has_header = False #flag to mark the presence of a Heade... |
from gi.repository import Gtk, Gdk
from kano.gtk3.apply_styles import apply_common_to_screen
class ApplicationWindow(Gtk.Window):
def __init__(self, title="Application", width=None, height=None):
Gtk.Window.__init__(self, title=title)
self.set_decorated(False)
self.set_resizable(False)
... |
from osv import osv
from osv import fields
from tools.translate import _
class res_partner(osv.osv):
"""
res_partner
"""
_inherit = 'res.partner'
_columns = {
'is_instructor':fields.boolean('Is Instructor', required=False),
'session_ids': fields.many2many('openacademy.session',
... |
from random import shuffle,randint,random
from math import exp
import sys
sys.setrecursionlimit(100000000)
def solveIt(inputData):
# Modify this code to run your optimization algorithm
# parse the input
lines = inputData.split('\n')
parts = lines[0].split()
warehouseCount = int(parts[0])
custome... |
from yast import import_module
import_module('UI')
from yast import *
class Password2Client:
def main(self):
# Build dialog with two password fields, an "OK" and a "Cancel" button.
UI.OpenDialog(
VBox(
Password(Id("pw1"), "Enter password:"),
Password(Id("pw2"), "Confirm passw... |
import pickle
from Model import *
from Model.Givens import turkish, english, pukapuka, four_gen_tree_context
from optparse import OptionParser
from LOTlib.TopN import TopN
parser = OptionParser()
parser.add_option("--read", dest="filename", type="string", help="Pickled results",
default="../LearnLexic... |
from routersploit.modules.creds.cameras.avtech.telnet_default_creds import Exploit
def test_check_success(generic_target):
""" Test scenario - testing against Telnet server """
exploit = Exploit()
assert exploit.target == ""
assert exploit.port == 23
assert exploit.threads == 1
assert exploit.de... |
from Sire.Qt import *
import time
def test_timer(verbose=True):
t = QElapsedTimer()
t.start()
ns = t.nsecsElapsed()
if verbose:
print("Minimum time is %s ms" % (0.000001*ns))
assert( ns < 1000000 )
t.start()
time.sleep(1)
ns = t.nsecsElapsed()
if verbose:
print("Slept... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.