code stringlengths 1 199k |
|---|
from google.appengine.ext import ndb
from shared.utils import to_unix_timestamp
class Record(ndb.Model): # pragma: no cover
timestamp = ndb.DateTimeProperty(auto_now=True)
tags = ndb.StringProperty(repeated=True)
fields = ndb.JsonProperty(default={})
def to_dict(self):
return {
'key': self.key.id() if... |
import re
from recipe_engine import recipe_api
from recipe_engine import util as recipe_util
class TestLauncherFilterFileInputPlaceholder(recipe_util.InputPlaceholder):
def __init__(self, api, tests):
self.raw = api.m.raw_io.input('\n'.join(tests))
super(TestLauncherFilterFileInputPlaceholder, self).__init__(... |
from .fake_webapp import EXAMPLE_APP
class IsTextPresentTest:
def test_is_text_present(self):
"should verify if text is present"
self.assertTrue(self.browser.is_text_present("Example Header"))
def test_is_text_present_and_should_return_false(self):
"should verify if text is present and r... |
from bokeh.io import save
from bokeh.models import Arrow, NormalHead, OpenHead, TeeHead, VeeHead
from bokeh.plotting import figure
plot = figure(width=600, height=600, x_range=(0,10), y_range=(0,10), toolbar_location=None)
arrow1 = Arrow(x_start=1, y_start=4, x_end=6, y_end=9,
line_color='green', line_al... |
import numpy as np
import pandas as pd
import pyflux as pf
noise = np.random.normal(0,1,400)
y = np.zeros(400)
x1 = np.random.normal(0,1,400)
x2 = np.random.normal(0,1,400)
for i in range(1,len(y)):
y[i] = 0.1*y[i-1] + noise[i] + 0.1*x1[i] - 0.3*x2[i]
data = pd.DataFrame([y,x1,x2]).T
data.columns = ['y', 'x1', 'x2']
y... |
"""Bunch-related classes."""
from copy import deepcopy
class Bunch(dict):
"""Dictionary-like object that exposes its keys as attributes."""
def __init__(self, **kwargs): # noqa: D102
dict.__init__(self, kwargs)
self.__dict__ = self
class BunchConst(Bunch):
"""Class to prevent us from re-def... |
from json import loads, dumps
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.test.client import Client
from django.utils.translation import ugettext_lazy as _
from tcp.provider.models import Provider, LinkMatch
from .models import Request
from .views import validate
class Help... |
import numpy as np
from bokeh.plotting import *
from bokeh.objects import Range1d
N = 80
x = np.linspace(0, 4*np.pi, N)
y = np.sin(x)
output_cloud("line_animate")
hold()
line(x, y, color="#3333ee", tools="pan,wheel_zoom,box_zoom,reset,previewsave")
line([0,4*np.pi], [-1, 1], color="#ee3333", tools="pan,wheel_zoom,box_z... |
import os
import copy
from random import random, seed
import stackless
STARTING_LABEL = "starting"
FINISHING_LABEL = "finishing"
ENDING_LABEL = "ending"
MAIN_LABEL = "main"
def abstractmethod(f):
def ff(*args, **kwargs):
raise RuntimeError("Method " + f.__name__ + " not implemented!")
return ff
def Chec... |
"""Enables directory-specific presubmit checks to run at upload and/or commit.
"""
from __future__ import print_function
__version__ = '1.8.0'
import argparse
import ast # Exposed through the API.
import contextlib
import cpplint
import fnmatch # Exposed through the API.
import glob
import inspect
import itertools
im... |
"""
em.tests.basic
~~~~~~~~~~~~~~
Tests basic stuff: public interface, not internal stuff.
:copyright: (c) 2014, Igor Kalnitsky
:license: BSD, see LICENSE for details
"""
from __future__ import unicode_literals
from em.tests import EmTestCase
class BasicFunctionalityTestCase(EmTestCase):
#: a sa... |
from django.apps import AppConfig
class SharkConfig(AppConfig):
name = 'shark' |
from collections import OrderedDict
from bokeh.charts import Area
xyvalues = OrderedDict(
python=[2, 3, 7, 5, 26, 221, 44, 233, 254, 265, 266, 267, 120, 111],
pypy=[12, 33, 47, 15, 126, 121, 144, 233, 254, 225, 226, 267, 110, 130],
jython=[22, 43, 10, 25, 26, 101, 114, 203, 194, 215, 201, 227, 139, 160],
)
... |
"""
moveit_pick_and_place_demo.py - Version 0.1 2014-01-14
Command the gripper to grasp a target object and move it to a new location, all
while avoiding simulated obstacles.
Created for the Pi Robot Project: http://www.pirobot.org
Copyleft (c) 2014 Patrick Goebel. All lefts reserved.
This prog... |
import sys
from gmpy_cffi.interface import ffi, gmp
if sys.version > '3':
long = int
xrange = range
cache_size = 100
cache_obsize = 128
def get_cache():
"""
get_cache() -> (cache_size, object_size)
Return the current cache size (number of objects) and maximum size
per object (number of limbs) fo... |
class RegistryException(Exception):
pass
class RegistryAccessDenied(RegistryException):
"""This exception is raised when a domain attempts to access a registry it does not have access to."""
pass
class RegistryNotFound(RegistryException):
"""No registry exists"""
pass
class RegistryAccessException(R... |
from codecs import open
import os
import re
from setuptools import setup, Extension
import glob
shellinford_cc = glob.glob('cpp_src/*.cc')
shellinford_headers = glob.glob('cpp_src/*.h')
with open(os.path.join('shellinford', '__init__.py'), 'r', encoding='utf8') as f:
version = re.compile(
r".*__version__ = ... |
from __future__ import division, print_function, absolute_import
import warnings
from . import _minpack
import numpy as np
from numpy import (atleast_1d, dot, take, triu, shape, eye,
transpose, zeros, product, greater, array,
all, where, isscalar, asarray, inf, abs,
... |
import windows
import windows.utils as utils
from .native_exec import simple_x86 as x86
from .native_exec import simple_x64 as x64
def get_loadlib_getproc(target):
if windows.current_process.bitness == target.bitness:
LoadLibraryA = utils.get_func_addr('kernel32', 'LoadLibraryA')
GetProcAddress = ut... |
from datetime import datetime, timedelta
from django.core.urlresolvers import reverse
from django.test import TestCase
from tagging.models import TaggedItem, Tag
from nose import tools
from test_ella.test_core import create_basic_categories, create_and_place_a_publishable
from test_ella import template_loader
from ella... |
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 'PushWhooshNotification'
db.create_table('pushwhoosh_pushwhooshnotification', (
('id', self.gf('django.db.mo... |
"""
Various complex queries that have been problematic in the past.
"""
import datetime
import pickle
import sys
import threading
from django.conf import settings
from django.db import models, DEFAULT_DB_ALIAS
from django.db.models import Count
from django.db.models.query import Q, ITER_CHUNK_SIZE, EmptyQuerySet
try:
... |
import hashlib
import logging.handlers
class EmailMsgFormatter(logging.Formatter):
def format(self, record):
"""
Extends the parent's format with a traceback at the end.
"""
import pprint
import traceback
pp = pprint.PrettyPrinter(indent=4)
# remove 9 lines fr... |
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('django_workflow', '0007_auto_20180109_1038'),
]
operations = [
migrations.AlterField(
model_name='callback',
name='transition',
... |
import datetime
import logging
from django.conf import settings
from django.template.loader import render_to_string
from django.urls import reverse
from django.utils.translation import ugettext
from celery.schedules import crontab
from celery.task import periodic_task, task
from dimagi.utils.web import get_site_domain,... |
from fractions import Fraction
from math import pi
import numpy as np
from bokeh.colors.named import colors
from bokeh.io import show
from bokeh.models import ColumnDataSource, Plot, PolarTransform
from bokeh.plotting import figure, gridplot
dark_colors = iter(color for color in colors if color.brightness < 0.6)
color_... |
"""
This module allows to convert standard data representations
(e.g., a spike train stored as Neo SpikeTrain object)
into other representations useful to perform calculations on the data.
An example is the representation of a spike train as a sequence of 0-1 values
(binned spike train).
:copyright: Copyright 2014-2015... |
from django.contrib.auth import authenticate
from django.contrib.auth import login
from django.contrib.auth import get_user_model
from registration import signals
from registration.views import RegistrationView as BaseRegistrationView
User = get_user_model()
class RegistrationView(BaseRegistrationView):
"""
A r... |
from measurements import oilpan_gc_times
from telemetry.core import util
from telemetry.internal.results import page_test_results
from telemetry.page import page as page_module
from telemetry.timeline import model
from telemetry.timeline import slice as slice_data
from telemetry.unittest_util import options_for_unittes... |
from flask import render_template, flash, redirect, url_for
from app import app, db
from models import Aggregate, Day, Hours, Statistics, Predictions
from bitcoin import consolidate
import json
@app.route('/')
@app.route('/index')
def index():
consolidate()
# List of Dictionaries of points for the graph
pri... |
import urlparse
def connect(url):
r = urlparse.urlparse(url)
if r.scheme == 'sqlite':
import sqlite3
return sqlite3.connect(r.netloc)
if r.scheme == 'mysql':
import MySQLdb
return MySQLdb.connect(host = r.hostname,
user = r.username,
passwd = r... |
try: from urlparse import urlparse
except ImportError: from urllib.parse import urlparse
from collections import defaultdict
def _new_collection():
""" Collection data type is
{path: {method: (ResponseClass,) }}
So e.g. a POST request to http://venmo.com/feed is stored as
{'/feed': {'POS... |
__author__ = "bt3"
class Queue(object):
def __init__(self):
self.enq = []
self.deq = []
def enqueue(self, item):
return self.enq.append(item)
def deque(self):
if not self.deq:
while self.enq:
self.deq.append(self.enq.pop())
return self.deq.... |
"""
Microsoft CSS extensions.
"""
import textwrap
CSS_MICROSOFT_DATA = {
'-ms-accelerator': {
'description': "Extension",
},
'-ms-background-position-x': {
'description': "CSS3 - Working Draft",
},
'-ms-background-position-y': {
'description': "CSS3 - Working Draft",
},
... |
import sys
import argparse
ap= argparse.ArgumentParser(description="Print various types of relations between pairs of alignments.")
ap.add_argument("input", help="hardtop output file, sorted by read name (field 4)")
ap.add_argument("--relation", help="Type of overlap allowed: cover|exclude|close ", default="exclude", c... |
from __future__ import (absolute_import, division, print_function, unicode_literals)
from builtins import *
from datetime import datetime
from colorama import Fore
from getpass import getpass, getuser
from netrc import netrc
from github3 import login
from .db import StarredDB, EmptyIndexWarning
from .view import Search... |
import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
import cabby
import requests
import urllib3
import dateutil
import pytz
import dateutil.parser
from bs4 import BeautifulSoup
from netaddr import IPAddress, iprange_to_cidrs, IPNetwork
from six import string_types
from ty... |
import keras
import keras.backend as K
class MaxValue(keras.constraints.Constraint):
"""MaxValue weight constraint.
Constrains the weights incident to each hidden unit
to have a value less than or equal to a desired value.
Useful for implementing Wasserstein GANs.
Args:
m: the maximum norm f... |
from base64 import b64decode
import unittest
from lastpass.blob import Blob
class BlobTestCase(unittest.TestCase):
def setUp(self):
self.bytes = b64decode('TFBBVgAAAAMxMjJQUkVNAAAACjE0MTQ5')
self.key_iteration_count = 500
self.username = 'postlass@gmail.com'
self.password = 'pl123456... |
import zmq
import argparse
import msgpack
class Base(object):
"""Class to provide common CLI argument requrirements and provide basic implimentation of encode and decode using msgpack
Args:
pure: A boolean. If true use the values of identity and port_list instead of using an argument parser
identity: A string: Us... |
"""
test serial loopback; assumes Rx and Tx are connected
Copyright (c) 2010-2014 Ben Bass <benbass@codedstructure.net>
All rights reserved.
"""
import os
import sys
import time
from pylibftdi import Device
def test_string(length):
return os.urandom(length)
class LoopbackTester(object):
def __init__(self):
... |
import numpy as np
import redis
def sigmoid(x):
return 1.0 / (1 + np.exp(-x))
def test_sigmoid():
x = 0
print("Input x: {}, the sigmoid value is: {}".format(x, sigmoid(x)))
def main():
client = redis.StrictRedis(host='localhost', port=6379, db=0)
# Prepare dataset
train_features = np.array([[1, 0, 26], [0, ... |
import sys
from bintrees import FastRBTree
import logging
from decimal import Decimal
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
class OrderTree(object):
def __init__(self):
self.price_tree = FastRBTree()
self.min_price = None
self.max_price =... |
import datetime
import json, yaml
import io
import csv
from bson import json_util, ObjectId
from dateutil.parser import parse
from django.conf import settings
from django.core.urlresolvers import reverse
from django.template.loader import render_to_string
from mongoengine import Document, EmbeddedDocument, DynamicEmbed... |
from cudatypes import Pointer, Void, Bool, Int, Float, Double, dim3, elemType
from cudaarray import CudaArray
from compiler import compile, kernel
from template import Template, template |
import sys
import os.path
import json
import time,datetime
import urllib
import base64,hmac,hashlib
import ssl
from threading import Thread,Lock
import paho.mqtt.client as mqtt
import paho.mqtt.publish as publish
p_hostname = "<iotHubName>.azure-devices.net"
p_deviceId = "<pep2_deviceId>"
p_sharedAccessKey = "<pep2_dev... |
# .---. .-----------
# / \ __ / ------
# / / \( )/ ----- (`-') _ _(`-') <-. (`-')_
# ////// '\/ ` --- ( OO).-/( (OO ).-> .-> \( OO) ) .->
# //// / // : : --- (,------. \ .'_ (`-')----. ,--./ ,--/ ,--.' ,-.
# //... |
from kivy.lang import Builder
from kivy.uix.label import Label
from kivy.base import runTouchApp
from kivy.uix.boxlayout import BoxLayout
import os
Builder.load_string('''
<Clip>:
orientation: 'vertical'
BoxLayout:
size_hint_y: None
height: self.minimum_height
Button:
text: '... |
from CommonServerPython import *
import json
FAIL_STATUS_MSG = "Command send-mail in module EWS Mail Sender requires argument to that is missing (7)"
def send_reply(incident_id, email_subject, email_to, reply_body, service_mail, email_cc, reply_html_body,
entry_id_list, email_latest_message, email_code):... |
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/ship/crafted/reactor/shared_fusion_reactor_mk2.iff"
result.attribute_template_id = 8
result.stfName("space_crafting_n","fusion_reactor_mk2")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return res... |
"""
Read DNA or AA FASTA from stdin and print AA ORF-only FASTA to stdout. I.e.,
the output FASTA will contain one sequence for each ORF found in each
sequence on stdin.
If a minimal ORF length is given, only print ORFs of at least that length
unless we are asked to allow ORFs that are open at at least one end.
Note th... |
import sys
import os
import struct
import fcntl
import select
import socket
import logging
import argparse
BUF_SIZE = 2048
def open_tun(name='tunnel'):
tun_fd = os.open('/dev/net/tun', os.O_RDWR)
print tun_fd
data = struct.pack('@16sh22s', name, 2, '')
with open('test2', 'wb') as f2:
f2.write(da... |
import unittest
from datetime import date
import holidays
class TestSerbia(unittest.TestCase):
def setUp(self):
self.holidays = holidays.Serbia(observed=True)
def test_new_year(self):
# If January 1st is in Weekend, test oberved
self.assertIn(date(2017, 1, 1), self.holidays)
self... |
from sqlalchemy.test.testing import assert_raises, assert_raises_message
import sys
from sqlalchemy import *
from sqlalchemy.test import *
from sqlalchemy import util, exc
from sqlalchemy.sql import table, column
class CaseTest(TestBase, AssertsCompiledSQL):
@classmethod
def setup_class(cls):
metadata =... |
"""gevent build & installation script"""
import sys
import os
import re
import shutil
import traceback
from os.path import join, abspath, basename, dirname
from glob import glob
try:
from setuptools import Extension, setup
except ImportError:
from distutils.core import Extension, setup
from distutils.command.bu... |
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('臺灣言語平臺', '0005_remove_平臺項目表_是資料源頭'),
]
operations = [
migrations.RemoveField(
model_name='使用者表',
name='分數',
),
migrations... |
"""
Generates setups for testing w computation
"""
import sympy
from sympy import init_printing
init_printing()
x, y, z = sympy.symbols('x y z')
lx, ly = sympy.symbols('lx ly')
def is_constant(u):
"""
True if u does not depend on x,y,z
"""
out = 0
for i in (x, y, z):
out += sympy.diff(u, i)
... |
import sys
import setuptools
setuptools.setup(
license="MIT",
name="sc2reader",
version="1.7.0",
keywords=["starcraft 2", "sc2", "replay", "parser"],
description="Utility for parsing Starcraft II replay files",
long_description=open("README.rst").read() + "\n\n" + open("CHANGELOG.rst").read(),
... |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
import mock
import pytest
from requests import RequestException
from requests.utils import cookiejar_from_dict
from requests.cookies import RequestsCookieJar
from flexget.ta... |
"""
Runs RAxML on a sequence file.
For use with RAxML version 8.2.4
"""
import fnmatch
import glob
import optparse
import os
import subprocess
import sys
def stop_err(msg):
sys.stderr.write("%s\n" % msg)
sys.exit()
def getint(name):
basename = name.partition('RUN.')
if basename[2] != '':
num = b... |
import fabric.api
import fabric.tasks
import fabric.colors
import os
class Server(fabric.tasks.Task):
name = 'server'
command = 'runserver'
def run(self, port=8000, ip='127.0.0.1'):
fabric.api.local("python manage.py {} --settings='{}' {}:{}".format(self.command, fabric.api.env.settings, ip, port))
class Serv... |
"""View
This module contains mixins and helper functions/decorators
for content rendering
"""
import json
import tornado
import os
import tornado.web
from jinja2 import Environment as Jinja2Environment, FileSystemLoader, TemplateNotFound
from scheduler.model import Document
from webassets import Environment as AssetsEn... |
from msrest.paging import Paged
class PublicIPAddressPaged(Paged):
"""
A paging container for iterating over a list of :class:`PublicIPAddress <azure.mgmt.network.v2017_11_01.models.PublicIPAddress>` object
"""
_attribute_map = {
'next_link': {'key': 'nextLink', 'type': 'str'},
'current_... |
from django import forms
from prod_announcer.produto.models import Produto
class ProdutoForm(forms.ModelForm):
"Form do modelo de Produto"
class Meta:
model = Produto |
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/deed/event_perk/shared_fruit_stand.iff"
result.attribute_template_id = 2
result.stfName("event_perk","fruit_stand_deed_name")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return result |
__author__ = 'jmorgan' |
extensions = ['sphinx.ext.coverage',
'sphinx.ext.viewcode']
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
project = 'Django Menu Generator'
copyright = '2017, Milton Lenis'
author = 'Milton Lenis'
version = '1.0.3'
release = '1.0.3'
language = None
exclude_patterns = ['_build', 'Thumbs... |
import struct
import os
import sys
import Image
import random
import logging
from yad2.utils import Sprite
from yad2.encoders import Format40, Format80
class Wsa:
def __init__(self, filename):
self.logger = logging.getLogger('root')
self.filename = filename
self.filesize = os.path.getsize(se... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from typing import Optional
def kl_divergence(mean, logvar):
return -0.5 * torch.mean(1 + logvar - torch.square(mean) - torch.exp(logvar))
def loss(config, x, x_hat, z, mu, logvar):
recons_loss = F.mse_loss(x_hat, x, reduction='mean')
kld_loss = k... |
import sys
from PyQt4 import QtGui, QtCore
class Example(QtGui.QWidget):
def __init__(self):
super(Example, self).__init__()
self.initUI()
def initUI(self):
self.setGeometry(300, 300, 355, 280)
self.setWindowTitle('Brushes')
self.show()
def paintEvent(self, e):
... |
import datetime
import itertools
import time
import sys
class outputBuffer():
b = [""] * 10
def printToBuff(self, i, s):
self.b[i] = self.b[i] + str(s) + "\n"
def writeToFile(self, i, filename):
with open(filename, 'w') as f:
f.write(self.b[i])
f.close()
def getBinary... |
'''
Author: Bu Kun
E-mail: bukun@osgeo.cn
CopyRight: http://www.yunsuan.org
'''
import uuid
import os
import tornado.web
import tornado.ioloop
from torlite.model.pic_model import MPic
class PicHandler(tornado.web.RequestHandler):
def initialize(self):
self.mpic = MPic()
def get(self, input=''):
... |
from runtest import TestBase
import subprocess as sp
TDIR='xxx'
class TestCase(TestBase):
def __init__(self):
TestBase.__init__(self, 'fork', """
Total time Self time Calls Function
========== ========== ========== ====================================
849.948 us 20.543 us 2 ma... |
from gi.repository import GObject, Gtk, Pango, Gdk
from xng.plugins.base import PopulationFilter, ItemStatus, ProviderItem
from .loadpage import ScLoadingPage
import threading
class ScItemButton(Gtk.FlowBoxChild):
""" Display an item in a pretty view """
__gtype_name__ = "ScItemButton"
item = None
actio... |
"""
:mod:`lab_args` -- Arguing with the functions
=========================================
LAB_ARGS Learning Objective: Learn to modify, receive, and work with arguments to function.
::
a. Create a function that accepts any number of positional arguments and
keyword arguments and prints the argument values out to... |
from match import *
from kbase import external, internal, browse_pattern
from time import time
stop_chaining = 'stop_chaining'
def forward(kbase, facts, *pmode):
time1 = time()
global rulebase # avoid extra args
rulebase = kbase
known = []
for x in facts:
known.ap... |
"""Invenio utilities to run SQL queries.
The main API functions are:
- run_sql()
- run_sql_many()
- run_sql_with_limit()
but see the others as well.
"""
import gc
import os
import re
import string
import time
from flask import current_app
from invenio_base.globals import cfg
from invenio.utils.datastructure... |
"""B2Share cli commands for upgrades."""
from __future__ import absolute_import, print_function
import click
from flask.cli import with_appcontext
from flask import current_app
from .api import upgrade_to_last_version
@click.group()
def upgrade():
"""B2SHARE upgrade commands."""
@upgrade.command()
@with_appcontext
... |
"""Minify HTML
A quick hack at the moment.
"""
import sys
import argparse
from parser import parseHTML, ParseException
def doMin(fileName):
body = parseHTML(fileName)
sys.stdout.write(body.toStr({'discardComments':True, 'deploy':True}))
if __name__ == "__main__":
cmdParser = argparse.ArgumentParser(descript... |
"Scan C header files to extract parts of #define and #include lines"
import sys, re
pattDefine = re.compile( # compile to pattobj
'^#[\t ]*define[\t ]+(\w+)[\t ]*(.*)') # "# define xxx yyy..."
# \w like [a-zA-Z0-9_]
pattInclu... |
from test.picardtestcase import PicardTestCase
from unittest.mock import MagicMock
from picard import config
from picard.webservice import WebService
from picard.webservice.api_helpers import (
APIHelper,
MBAPIHelper,
)
class APITest(PicardTestCase):
def setUp(self):
super().setUp()
self.hos... |
""" Search dialogs for services """
import gtk
from kiwi.currency import currency
from storm.expr import Ne
from stoqlib.domain.service import Service, ServiceView
from stoqlib.enums import SearchFilterPosition
from stoqlib.lib.defaults import sort_sellable_code
from stoqlib.lib.translation import stoqlib_gettext
from ... |
import base64
from .dependencies import import_or_install
try:
from usersettings import Settings
except ImportError: # pragma nocover
Settings = import_or_install("usersettings.Settings", "usersettings") # pip install usersettings
try:
from Crypto import Random
from Crypto.Cipher import AES
from C... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('users', '0001_initial'),
('contenttypes', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Comment',
field... |
import json
from libs.core.network import get
from libs.core.common import logging,runtime
from libs.core.common import print_color
log = logging.getLogger(__name__)
def output(target):
print_color('get location for IP %s' % target.ip, 2)
try:
code,content = get('ip.taobao.com', '/service/getIpInfo.php?... |
from __future__ import unicode_literals
from django.db import models, migrations
import payment_systems.perfect_money.models
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
mi... |
"""
***************************************************************************
FilterData.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
*****************************************************... |
"""
Test the `kernel_keyring.py` module.
"""
from nose.tools import raises, assert_raises # pylint: disable=E0611
from ipapython import kernel_keyring
TEST_KEY = 'ipa_test'
TEST_VALUE = 'abc123'
UPDATE_VALUE = '123abc'
SIZE_256 = 'abcdefgh' * 32
SIZE_512 = 'abcdefgh' * 64
SIZE_1024 = 'abcdefgh' * 128
class test_keyrin... |
import os
import tensorflow as tf
SEQUENCE_LENGTH = 58
NUM_EXAMPLES_PER_EPOCH_FOR_TRAIN = 10000
def read_data(filename_queue):
'''
数据的读取
:param filename_queue:
:return:
'''
class DataRecord(object):
pass
result = DataRecord()
reader = tf.TextLineReader()
key, value = reader.r... |
"""
This file is part of OpenSesame.
OpenSesame 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.
OpenSesame is distributed in the hope that it... |
import re
import urllib2
from core import logger
from core import scrapertools
def get_video_url(page_url, premium=False, user="", password="", video_password=""):
video_urls = []
if 'jkanime' in page_url:
request_headers = {
"Accept-Language": "en-US,en;q=0.5",
"User-Agent": "Mo... |
from __future__ import print_function
import datetime
import unittest
import test_lib as test
import sys, os.path
sys.path.insert(1, os.path.abspath('..'))
sys.path.insert(1, os.path.abspath('../lib'))
from sickbeard.name_parser import parser
import sickbeard
sickbeard.SYS_ENCODING = 'UTF-8'
DEBUG = VERBOSE = False
sim... |
"""
Tests of the code in uncertainties.umath.
These tests can be run through the Nose testing framework.
(c) 2010-2016 by Eric O. LEBIGOT (EOL).
"""
from __future__ import division
import sys
import math
from uncertainties import ufloat
import uncertainties.core as uncert_core
import uncertainties.umath_core as umath_c... |
_c_funcs = {}
_py_funcs = {}
__all__ = list(filter(None,'''
fp_str
unicode2T1
instanceStringWidthT1
instanceStringWidthTTF
asciiBase85Encode
asciiBase85Decode
escapePDF
sameFrag
calcChecksum
add32
hex32
'''.split()))
import ... |
"""Test class for UserGroup UI
@Requirement: Usergroup
@CaseAutomation: Automated
@CaseLevel: Acceptance
@CaseComponent: UI
@TestType: Functional
@CaseImportance: High
@Upstream: No
"""
from fauxfactory import gen_string
from nailgun import entities
from robottelo.datafactory import generate_strings_list, invalid_names... |
__VERSION__="ete2-2.2rev1026"
"""
this module defines the EvolNode dataytype to manage evolutionary
variables and integrate them within phylogenetic trees. It inheritates
the coretype PhyloNode and add some speciall features to the the node
instances.
"""
__author__ = "Francois-Jose Serra"
__email__ = "francoi... |
'''
Driver method to run the SasCalc module
'''
import sys
import sassie.calculate.sascalc.sascalc as sascalc
import sassie.interface.input_filter as input_filter
import multiprocessing
svariables = {}
runname = 'run_0' #_monica'
pdbfile = 'min3.pdb'
dcdfile = 'c7_3.dcd'
xon = 'neutron'
xon = 'neutron_and_xray'
number_... |
import gnome15.g15screen as g15screen
import gnome15.util.g15scheduler as g15scheduler
import gnome15.util.g15uigconf as g15uigconf
import gnome15.util.g15gconf as g15gconf
import gnome15.util.g15os as g15os
import gnome15.g15driver as g15driver
import gnome15.g15theme as g15theme
import gobject
import gtk
import os
im... |
from gi.repository import GObject
from gi.repository import Gtk
import atexit
import collections
import dbus
import dbus.service
from dbus.mainloop.glib import DBusGMainLoop
DBusGMainLoop(set_as_default=True)
import gettext
import logging
import os
import re
import subprocess
import sys
import xapian
import glob
import... |
from django.test.simple import DjangoTestSuiteRunner
from django.test import TestCase
class NoSQLTestRunner(DjangoTestSuiteRunner):
def setup_databases(self):
pass
def teardown_databases(self, *args):
pass
class NoSQLTestCase(TestCase):
def _fixture_setup(self):
pass
def _fixture... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.