content string |
|---|
from jinja2 import Template
from kvmagent import kvmagent
from zstacklib.utils import http
from zstacklib.utils import jsonobject
from zstacklib.utils import lock
from zstacklib.utils import log
from zstacklib.utils import shell
from zstacklib.utils import ebtables
from zstacklib.utils.bash import *
from prometheus_cl... |
from django.db import models
class Health(models.Model):
MALE = 'M'
FEMALE = 'F'
ALL = 'A'
GENDER_CHOICES = (
(MALE, 'Male'),
(FEMALE, 'Female'),
(ALL, 'All')
)
class Meta:
abstract = True
class HealthActivity(models.Model):
MALE = 'M'
FEMALE = 'F'
... |
import os
import tempfile
import base
fuse_handle = None
mountpoint = "%s/test_files" % (tempfile.gettempdir(),)
filepath = base.generic_filepath(mountpoint)
def setup(self):
global fuse_handle
fuse_handle = base.generic_setup(mountpoint)
def teardown(self):
global fuse_handle
base.generic_teardo... |
from direct.directnotify import DirectNotifyGlobal
from toontown.estate.DistributedFurnitureItemAI import DistributedFurnitureItemAI
from direct.distributed import ClockDelta
from toontown.toon import ToonDNA
from ClosetGlobals import *
class DistributedClosetAI(DistributedFurnitureItemAI):
notify = DirectNotifyGl... |
'''
Problem: find the kth to last element of a linked list
Solution: will assume k=1 means return the last element. use two pointers where p1 is k steps ahead
of p2. iterate both pointers until p1 is null. return p2
- linear time, constant space
total time: 20min
mistakes:
- originally was off by one beca... |
# -*- coding: utf-8 -*-
import io
import os
import csv
import logging
from datetime import datetime
from website.app import setup_django
setup_django()
from django.utils import timezone
from website import mails
from website import settings
from framework.auth import Auth
from framework.celery_tasks import app as c... |
"""Test resurrection of mined transactions when the blockchain is re-organized."""
from test_framework.test_framework import IonTestFramework
from test_framework.util import *
# Create one-input, one-output, no-fee transaction:
class MempoolCoinbaseTest(IonTestFramework):
def __init__(self):
super().__in... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import logging
from rasa_core.policies.keras_policy import KerasPolicy
logger = logging.getLogger(__name__)
class ConcertPolicy(KerasPolicy):
def _build_model(sel... |
import numpy as np
from scipy.ndimage import map_coordinates
from skimage.transform._warps import _stackcopy
from skimage.transform import (warp, warp_coords, rotate, resize, rescale,
AffineTransform,
ProjectiveTransform,
Simi... |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# pelisalacarta - XBMC Plugin
# Canal para pelis24
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
#------------------------------------------------------------
import urlparse,urllib2,urllib,re
import os, sys
from core impo... |
from __future__ import print_function, unicode_literals
import json
from wee_slack import SlackTS
def test_process_message(realish_eventrouter, team, user_alice):
messages = []
messages.append(json.loads(open('_pytest/data/websocket/1485975421.33-message.json', 'r').read()))
# test message and then cha... |
import numpy
import six
from chainer import cuda
from chainer import function
from chainer.utils import type_check
class Vstack(function.Function):
"""Concatenate multiple tensors vertically (row wise)."""
def check_type_forward(self, in_types):
type_check.expect(in_types.size() > 0)
ndim ... |
"""This prints the state of a logical file.
* By default, prints errors on stdout.
* Optional argument --log: logs output to system log.
"""
from django.core.management.base import BaseCommand
from hs_core.models import BaseResource
from hs_core.management.utils import check_irods_files
def debug_resource(short_id)... |
import logging
import struct
from io import BytesIO
from aiozk import exc
from .request import Request
from .response import Response, response_xref
from .part import Part
from .primitives import Int, Bool
error_struct = struct.Struct("!" + Int.fmt)
log = logging.getLogger(__name__)
class MultiHeader(Part):
... |
# -*- coding: utf-8 -*-
import os
import socket
import errno
import gettext
import ggz
import ui
import game
from defaults import *
_ = gettext.gettext
class GGZServer:
def __init__(self, name):
self.name = name
class GGZLine:
TYPE_BLANK = 'BLANK'
TYPE_COMMENT = 'COMMENT'
TYPE_SECTION =... |
# pylint: skip-file
"""Manual tests"""
import pytest
from cfme import test_requirements
pytestmark = [pytest.mark.ignore_stream('upstream')]
@pytest.mark.manual
@test_requirements.satellite
def test_no_rbac_warnings_in_logs_when_viewing_satellite_provider():
"""
RBAC-related warnings logged when viewing Sat... |
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
import hashlib
import fs_uae_launcher.fsui as fsui
from ...Config import Config
from ...I18N import _, ngettext
class CustomOptionsPage(fsui.Panel):
def __init__(se... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import json
import pytest
import sys
from nose.plugins.skip import SkipTest
if sys.version_info < (2, 7):
raise SkipTest("F5 Ansible modules require Python >= 2.7")
from ansible.compat.tests import unittest
from ans... |
{
"name": "富光财务",
"version": "1.0",
"depends": ["base","fg_sale","mail"],
'author': 'Daniel',
'website': 'http://www.ide.fm',
'category' : '富光',
"description": """
富光财务基本模块.
""",
"init_xml": [],
'update_xml': [
'security/group.xml',
'securit... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from freezegun import freeze_time
from CTFd.utils import set_config
from tests.helpers import (
create_ctfd,
destroy_ctfd,
gen_award,
gen_challenge,
gen_hint,
login_as_user,
register_user,
)
def test_api_hint_404():
"""Can the users 404 /... |
"""Output of PDB files."""
from Bio.Data.IUPACData import atom_weights # Allowed Elements
_ATOM_FORMAT_STRING="%s%5i %-4s%c%3s %c%4i%c %8.3f%8.3f%8.3f%6.2f%6.2f %4s%2s%2s\n"
class Select(object):
"""
Default selection (everything) during writing - can be used as base class
to implement selective ... |
from __future__ import division, print_function, unicode_literals
class StatusDisplay:
'''
A class to sequentially display percentage completion of an iterative
process on a single line.
'''
def __init__(self):
self._pretext = ''
self._overwrite = False
self._perce... |
import numpy as np
from scipy import interpolate
from collections import namedtuple
#from drama.geo import orbit_to_vel
from oceansar import constants as const
#import drama.utils.gohlke_transf as trans
#from drama.utils.coord_trans import (rot_z, rot_z_prime)
def orbit_to_vel(orbit_alt, ground=False,
... |
"""Data parser and processing for 3D segmentation datasets."""
from typing import Any, Dict, Sequence, Tuple
import tensorflow as tf
from official.vision.beta.dataloaders import decoder
from official.vision.beta.dataloaders import parser
class Decoder(decoder.Decoder):
"""A tf.Example decoder for segmentation task... |
#!/usr/bin/env python
import os,sys
import argparse
import logging.config
from biomaj_core.utils import Utils
def main():
parser = argparse.ArgumentParser()
parser.add_argument('-s', '--scan', dest="directory",help="Directory to scan")
parser.add_argument('--type', dest="ftype",help="Files type")
p... |
from django.utils.translation import ugettext_lazy as _
from horizon_lib import exceptions
from openstack_horizon.api import glance
def get_available_images(request, project_id=None, images_cache=None):
"""Returns a list of images that are public or owned by the given
project_id. If project_id is not specif... |
import itertools
import json
from touchdown.core.utils import force_str
class FieldNotPresent(Exception):
pass
class RequiredFieldNotPresent(Exception):
pass
class Serializer(object):
def render(self, runner, object):
raise NotImplementedError(self.render)
def dependencies(self, object)... |
"""
Creating a Uniform Grid
~~~~~~~~~~~~~~~~~~~~~~~
Create a simple uniform grid from a 3D NumPy array of values.
"""
import pyvista as pv
import numpy as np
###############################################################################
# Take a 3D NumPy array of data values that holds some spatial data where each... |
from __future__ import print_function
import os
import platform
import shutil
import subprocess
from distutils import dir_util
from conans import __version__
from conans.util.files import save
def _install_pyinstaller(pyinstaller_path):
subprocess.call("pip install pyinstaller", shell=True)
# try to install... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import errno
import datetime
import os
import tarfile
import tempfile
import yaml
from distutils.version import LooseVersion
from shutil import rmtree
from ansible import context
from ansible.errors import AnsibleError
from ansibl... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = r'''
---
module: scaleway_image_info
short_description: Gather information ... |
"""Tests for while_v2."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from absl.testing import parameterized
from tensorflow.core.protobuf import config_pb2
from tensorflow.core.protobuf import rewriter_config_pb2
from tensorflow.python.eager import ba... |
"""
Test of basic 1D plotting methods in MantidPlot
"""
import mantidplottests
from mantidplottests import *
from mantidplot import *
from PyQt4 import QtGui, QtCore
class MantidPlotMdiSubWindowTest(unittest.TestCase):
def test_table(self):
self.doTest( newTable() )
def test_graph(self):
se... |
import asyncio
from . import spec
class Exchange(object):
"""
Manage AMQP Exchanges and publish messages.
An exchange is a 'routing node' to which messages can be published.
When a message is published to an exchange, the exchange determines which :class:`Queue`
to deliver the message to by inspe... |
#!/usr/bin/env python -Es
import os
import yaml
import math
from argparse import ArgumentParser
from bcbio.install import _get_data_dir
from bcbio import utils
from bcbio.distributed import clargs, resources, ipython as ip
from bcbio.pipeline.main import _pair_samples_with_pipelines
def ipc_fn(parallel):
cores_p... |
#!/usr/bin/env python
import os
import stat
import subprocess
import shutil
from StringIO import StringIO
from zipfile import ZipFile
from urllib import urlopen
PROJECT_DIR = os.path.abspath(os.path.dirname(__file__))
REQUIREMENTS_FILE = os.path.join(PROJECT_DIR, "requirements.txt")
TARGET_DIR = os.path.join(PROJECT... |
# -*- coding: utf-8 -*-
from apps.registro.models import Anexo, Establecimiento, ExtensionAulica
from apps.titulos.models import Carrera, EstadoCarrera, CarreraJurisdiccional, \
CarreraJurisdiccionalCohorte, \
EstadoCarreraJurisdiccional, Cohorte, CohorteAnexo, CohorteEstablecimiento, \
CohorteExtensionAulica, Esta... |
"""NDG XACML ElementTree reader module containing reader base class
NERC DataGrid
"""
__author__ = "P J Kershaw"
__date__ = "19/03/10"
__copyright__ = "(C) 2010 Science and Technology Facilities Council"
__contact__ = "<EMAIL>"
__license__ = "BSD - see LICENSE file in top-level directory"
__contact__ = "<EMAIL>"
__re... |
from casuarius import ConstraintVariable
class BoxModel(object):
""" A class which provides a simple constraints box model.
Primitive Variables:
left, top, width, height
Derived Variables:
right, bottom, v_center, h_center
"""
__slots__ = (
'left', 'top', 'width', 'heigh... |
import glob
from collections import OrderedDict
import copy
import os
from datetime import datetime
from os.path import basename
import numpy
from cam_server import config
from cam_server.pipeline.transceiver import get_pipeline_function
class PipelineConfigManager(object):
def __init__(self, config_provider):... |
from dateutil import tz
from dateutil import zoneinfo
from sickbeard import db
from sickbeard import helpers
from sickbeard import logger
from sickbeard import encodingKludge as ek
from os.path import basename, join, isfile
import os
import re
import datetime
import requests
# regex to parse time (12/24 hour format)
... |
"""Interface to SAR level-1 data. Using the MIPP reader.
"""
import ConfigParser
import os
from mipp import xsar
from mipp import ReaderError, CalibrationError
from mpop import CONFIG_PATH
import logging
LOG = logging.getLogger(__name__)
try:
# Work around for on demand import of pyresample. pyresample depends
... |
import abc
import six
from taskflow.utils import reflection
class Flow(six.with_metaclass(abc.ABCMeta)):
"""The base abstract class of all flow implementations.
A flow is a structure that defines relationships between tasks. You can
add tasks and other flows (as subflows) to the flow, and the flow provi... |
"""
For more information, please see: http://software.sci.utah.edu
The MIT License
Copyright (c) 2020 Scientific Computing and Imaging Institute,
University of Utah.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the... |
from exceptions import *
class Stream(object):
"""Smartly reads from a string"""
def __init__(self, s):
"""Init stream with a string s"""
self.s = s
self.i = 0
self.cinl = 0
self.line = 0
self.l = len(s)
def position(self):
return "line {}, char {}".format(self.line,self.cinl)
def skip(self):
i... |
DEBUG = False # change to True to debug the loader
if DEBUG:
import sys
if sys.platform == 'win32':
import random
debugfile = 'c:\\debug-loader.txt' #+ str( random.randint( 100, 999 ) )
df = file( debugfile, 'w' )
df.close()
del df
def debugexception():
if not DEBUG: return
import sys
if sys.platform ... |
'''
test_nsec3_orphan - Tests nsec3_orphan validator.
.. Copyright (c) 2015 Neustar, Inc. All rights reserved.
.. See COPYRIGHT.txt for full notice. See LICENSE.txt for terms and conditions.
'''
# pylint: skip-file
import dns_sprockets_lib.validators.tests.harness as harness
def test_nsec3_orphan():
(tests, ... |
"""Objective C style error type."""
import bisect
class Error(object):
"""An error."""
__slots__ = ('kind', 'position', 'message', 'lines')
def __init__(self, kind, message, position, lines):
self.kind = kind
self.position = position
self.message = message
self.lines = lines
def lineAndOf... |
# -*- coding: utf-8 -*-
#计费方式-会员等级折扣
#如未对“会员等级”针对“计费方式”设置折扣,则默认取该会员等级预设的折扣。
from osv import fields, osv
import ktv_helper
import decimal_precision as dp
class fee_type_member_class_discount(osv.osv):
_name = "ktv.fee_type_member_class_discount"
_description = "计费方式-会员等级折扣"
_columns = {
'fee_ty... |
from calendar import timegm
import dbus
import gtk
import os
import re
import time
import datetime
from GTG import _
from GTG.core.task import Task
class hamsterPlugin:
PLUGIN_NAMESPACE = 'hamster-plugin'
DEFAULT_PREFERENCES = {
"activity": "title",
"category": "auto",
"description": ... |
# revision identifiers, used by Alembic.
revision = '559cfc0613d2'
down_revision = '2aad9deb5e37'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.create_table('flight_meetings',
sa.Column('id', sa.Integer(), nullable=False),
... |
DEBUG = False
class ZmqSocket(object):
def __init__(self, cb=None, version=1, type='DEALER'):
self.proto = None
self._cb = cb
self._queue = []
if version == 1:
from zmq1 import Zmq1Factory
self.factory = Zmq1Factory(type)
elif version == 2:
... |
import sys
from services.spawn import MobileTemplate
from services.spawn import WeaponTemplate
from resources.datatables import WeaponType
from resources.datatables import Difficulty
from resources.datatables import Options
from java.util import Vector
def addTemplate(core):
mobileTemplate = MobileTemplate()
mobi... |
"""Unit test for node harvest.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os
import shutil
import tempfile
import unittest
import mock
from treadmill import postmortem
from treadmill import subproc
... |
# for localized messages
from . import _
from enigma import *
from Screens.Screen import Screen
from Components.ActionMap import ActionMap
from Components.Sources.List import List
from Tools.Directories import resolveFilename, SCOPE_CURRENT_PLUGIN
from Tools.LoadPixmap import LoadPixmap
from Components.Button import B... |
""" Run an interactive debugging session """
from code import interact
import os
import sys
from opencore.scripting import get_default_config
from opencore.scripting import open_root
import logging
logging.basicConfig()
def main(argv=sys.argv):
config = None
script = None
if '-C' in argv:
index ... |
"""Helpers that help with state related things."""
import json
import logging
from collections import defaultdict
import homeassistant.util.dt as dt_util
from homeassistant.components.media_player import SERVICE_PLAY_MEDIA
from homeassistant.components.sun import (
STATE_ABOVE_HORIZON, STATE_BELOW_HORIZON)
from ho... |
__doc__ = r"""
### Two level atom
We import all the functions of FAST and some other useful stuff.
>>> from fast import *
>>> from math import pi,sqrt
>>> from matplotlib import pyplot
>>> from fast.config import parallel, use_netcdf
>>> from numpy import array
We establish the basic characteristics of te experimen... |
import logging
import os
import tarfile
from unittest import mock
import fixtures
from snapcraft.main import main
from snapcraft import tests
class CleanBuildCommandTestCase(tests.TestCase):
yaml_template = """name: snap-test
version: 1.0
summary: test cleanbuild
description: if snap is succesful a snap packag... |
# coding: utf-8
import unittest
import mock
from hm.lb_managers import cloudstack
from hm.model import load_balancer, host
class CloudstackLBTestCase(unittest.TestCase):
def setUp(self):
self.conf = {
'CLOUDSTACK_API_URL': 'http://localhost',
'CLOUDSTACK_API_KEY': 'key',
... |
#import factorial
#import square
x = int(raw_input("What is 'x'?\n"))
y = int(raw_input("What is y?\n"))
# question0 = str(raw_input("Define a y value? (y/n)\n"))
# if (question0 == "y","Y","yes","Yes"):
# y = int(raw_input("What will 'y' be?\n"))
# elif (y == "n","N","no","No"):
# question2 = str(raw_input("I... |
"""
Django settings for neighbors project.
Generated by 'django-admin startproject' using Django 1.8.4.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build pa... |
from scapy.all import *
DNSServerIP = "8.8.8.8"
filter = "udp port 53 and ip dst " + DNSServerIP + " and not ip src " + DNSServerIP
def DNS_Responder(localIP):
def forwardDNS(orig_pkt):
print "Forwarding: " + orig_pkt[DNSQR].qname
response = sr1(IP(dst="8.8.8.8")/UDP(sport=orig_pkt[UDP].sport)... |
from pyasn1.type import univ
from pyasn1.codec.cer import decoder
class BitStringDecoder(decoder.BitStringDecoder):
supportConstructedForm = False
class OctetStringDecoder(decoder.OctetStringDecoder):
supportConstructedForm = False
# TODO: prohibit non-canonical encoding
RealDecoder = decoder.RealDecoder
... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.python.eager import backprop
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import tensor... |
from udata.api import api, API
from udata.features.territories import check_for_territories
suggest_parser = api.parser()
suggest_parser.add_argument(
'q', type=str, help='The string to autocomplete/suggest',
location='args', required=True)
suggest_parser.add_argument(
'size', type=int, help='The maximum r... |
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
"""
Make sure explicit targets beginning with ../ get built correctly.
by the -U option.
"""
import TestSCons
test = TestSCons.TestSCons()
test.subdir('subdir')
test.write('SConstruct', """\
def cat(env, source, target):
target = str(target[0])
... |
import sys
import inspect
import logging
import wrapt
from .compat import contextlib, collections
from .errors import UnhandledHTTPRequestError
from .matchers import requests_match, uri, method
from .patch import CassettePatcherBuilder
from .persist import load_cassette, save_cassette
from .serializers import yamlser... |
import sys
sys.path.insert(1,"../../")
import h2o
from tests import pyunit_utils
def pubdev_1829():
train = h2o.import_file(path=pyunit_utils.locate("smalldata/jira/gbm_checkpoint_train.csv"))
valid = h2o.import_file(path=pyunit_utils.locate("smalldata/jira/gbm_checkpoint_valid.csv"))
predictors = [... |
"""
Given an expression string array, return the final result of this expression
Example
For the expression 2*6-(23+7)/(1+2), input is
[
"2", "*", "6", "-", "(",
"23", "+", "7", ")", "/",
(", "1", "+", "2", ")"
],
return 2
Note
The expression contains only integer, +, -, *, /, (, ).
"""
__author__ = 'Daniel'
... |
#!/usr/bin/env python
import logging
import time
from ncclient import manager
from ncclient.xml_ import *
def connect(host, port, user, password, source):
conn = manager.connect(host=host,
port=port,
username=user,
password=password... |
"""Sensor to indicate whether the current day is a workday."""
from datetime import datetime, timedelta
import logging
from typing import Any
import holidays
import voluptuous as vol
from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorEntity
from homeassistant.const import CONF_NAME, WEEKD... |
import os
import sys
from whoosh.qparser import QueryParser
from whoosh.index import open_dir
from flask import Flask, render_template, request, jsonify, send_from_directory
app = Flask(__name__, static_folder='static')
INDEX_DIR = 'gutenindex'
@app.route("/", methods=['GET'])
def index():
return render_templa... |
# -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import, unicode_literals
from django.db import models
from apps.packages.models import Package
from config.settings import XMPP_GRID
TABLE_PREFIX = 'swid_'
# TODO: After separating the frontend from the strongSwan database, remove th... |
import atexit
#import fcntl, signal, struct
import os
import select, sys
import subprocess
from socket import socket, AF_INET, AF_UNIX, SOCK_STREAM, SHUT_RDWR
import tty, termios
import libssh2
from libssh2 import SessionException, ChannelException
usage = """Do a X11 SSH connection with username@hostname
Usage: %s <... |
from will.plugin import WillPlugin
from will.decorators import respond_to, periodic, hear, randomly, route, rendered_template, require_settings
from mixins import ServersMixin, GithubMixin
class StagingPlugin(WillPlugin, ServersMixin, GithubMixin):
@require_settings("GITHUB_USERNAME","GITHUB_PASSWORD","GITHUB... |
"""
Main Sources parser
@author: Israel Herraiz
@organization: Universidad Politecnica de Madrid
@copyright: Universidad Politecnica de Madrid
@license:
@contact: <EMAIL>
"""
import gzip
import os
#import urllib
#import urlparse
import ftplib
import hashlib
import tarfile
import shutil
import temp... |
import mmap
import struct
import types
from utils import (
hash_160_to_pubkey_address,
hash_160_to_script_address,
public_key_to_pubkey_address,
hash_encode
)
class SerializationError(Exception):
"""Thrown when there's a problem deserializing or serializing."""
class BCDataStream(object):
"... |
# python
# This file is generated by a program (mib2py).
import MPLS_LDP_GENERIC_STD_MIB
OIDMAP = {
'1.3.6.1.2.1.10.166.7': MPLS_LDP_GENERIC_STD_MIB.mplsLdpGenericStdMIB,
'1.3.6.1.2.1.10.166.7.1': MPLS_LDP_GENERIC_STD_MIB.mplsLdpGenericObjects,
'1.3.6.1.2.1.10.166.7.1.1': MPLS_LDP_GENERIC_STD_MIB.mplsLdpEntityGeneri... |
import os
import sys
from random import randrange
from multiprocessing import Pool
from functools import partial
from bisect import insort
import h5py as h5
import numpy as np
from fastdtw import fastdtw
from ._database import TimeSeriesData
from ._cluster import normalize_simple, zscore
# Creates, updates, and retr... |
#!/usr/bin/env python
import os
from setuptools import setup, find_packages
version = None
dn = os.path.dirname(__file__)
with open(os.path.join(dn, 'pyrate.py')) as fp:
for line in fp:
if line.startswith('__version__'):
version = line.split('=')[-1].strip().strip("'")
break
setup(
name='pyrate-build',
ver... |
'''
**********************************************************************
* Filename : filedb.py
* Description : A simple file based database.
* Author : Cavon
* Brand : SunFounder
* E-mail : <EMAIL>
* Website : www.sunfounder.com
* Update : Cavon 2016-09-13 New release
**************... |
import warnings
from django.core.exceptions import ValidationError
from django.http import Http404
from django.db import transaction as tx
from django.utils.translation import ugettext as _
from taiga.base import response
from .settings import api_settings
from .utils import get_object_or_404
def _get_validation_e... |
__version__ = "0.7"
import re
from PIL import Image, ImageFile, ImagePalette
from PIL._binary import i8, o8
# --------------------------------------------------------------------
# Standard tags
COMMENT = "Comment"
DATE = "Date"
EQUIPMENT = "Digitalization equipment"
FRAMES = "File size (no of images)"
LUT = "Lut"
... |
#!/usr/bin/env python
import json
import os
import signal
import subprocess
import unittest
TEST_ROOT = os.path.abspath(os.path.dirname(__file__))
CASPERJS_ROOT = os.path.abspath(os.path.join(TEST_ROOT, '..', '..'))
CASPER_EXEC = os.path.join(CASPERJS_ROOT, 'bin', 'casperjs')
PHANTOMJS_EXEC = os.environ['PHANTOMJS_EX... |
import libvirt
import sys
import time
import git
import os
import shutil
import pathlib
import tempfile
import paramiko.client
import paramiko.rsakey
def main():
repo_path = 'repository'
conf = {'domain': 'archlinux',
'ssh_username': 'root',
'ssh_password': 'archlinux',
'sc... |
# -*- coding: utf-8 -*-
"""
Created on Thu May 21 14:37:15 2015
@author: Marco Tinacci
"""
import networkx as nx
import matplotlib.pyplot as plt
import numpy as np
import Contagion
def plotGraph(g,alpha,node_scale=1, seed=None, pos=None):
# layout
if pos == None:
pos = nx.circular_layout(g)
# po... |
from . import unittest
from shapely.geos import geos_version
from shapely.geometry import LineString, LinearRing
from shapely.wkt import loads
class OperationsTestCase(unittest.TestCase):
@unittest.skipIf(geos_version < (3, 2, 0), 'GEOS 3.2.0 required')
def test_parallel_offset_linestring(self):
line1 ... |
from insights.parsers.virt_who_conf import VirtWhoConf
from insights.tests import context_wrap
VWHO_CONF = """
## This is a template for virt-who global configuration files. Please see
## virt-who-config(5) manual page for detailed information.
##
## virt-who checks /etc/virt-who.conf for sections 'global' and 'defaul... |
#!/usr/bin/env python
""" load mWGS Raw Seq Set into OSDF using info from data file """
import os
import re
from cutlass.Proteome import Proteome
import settings
from cutlass_utils import \
load_data, get_parent_node_id, list_tags, format_query, \
write_csv_headers, values_to_node_dict, write_out_csv... |
# -*- coding: utf-8 -*-
import importlib
import sys
import traceback
import operator
import os
from glob import glob
from twisted.internet import threads
from IRCResponse import IRCResponse, ResponseType
class ModuleHandler(object):
def __init__(self, bot):
"""
@type bot: MoronBot
"""
... |
import random
from rlkit.exploration_strategies.base import RawExplorationStrategy
import numpy as np
class GaussianAndEpsilonStrategy(RawExplorationStrategy):
"""
With probability epsilon, take a completely random action.
with probability 1-epsilon, add Gaussian noise to the action taken by a
determi... |
from __future__ import print_function
__author__ = "Alvaro Lopez Ortega"
__email__ = "<EMAIL>"
__copyright__ = "Copyright (C) 2014 Alvaro Lopez Ortega"
import os
import sys
import argparse
import xml.etree.ElementTree as ET
import functools
# Defaults
ACCEPTABLE_COVERAGE = 80
# Global
ns = None
def ERROR(*o... |
from twitter_ads.client import Client
from twitter_ads.creative import CardsFetch
from twitter_ads.http import Request
CONSUMER_KEY = ''
CONSUMER_SECRET = ''
ACCESS_TOKEN = ''
ACCESS_TOKEN_SECRET = ''
ACCOUNT_ID = ''
# initialize the client
client = Client(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SE... |
import numpy as np
import pytest
import theanets
import theano.tensor as TT
import util as u
NI = u.NUM_INPUTS
NH = u.NUM_HID1
class TestFeedforward:
@pytest.mark.parametrize('form, name, params, count, outputs', [
('feedforward', 'feedforward', 'w b', 1 + NI, 'out pre'),
('ff', 'feedforward', '... |
#!/usr/bin/env python2
"""
Dragon Keyboard map:
LSB $FF02 MSB
| PB0 PB1 PB2 PB3 PB4 PB5 PB6 PB7 <- column
----|----------------------------------------------
PA0 | 0 1 2 3 4 5 6 7 LSB
PA1 | 8 9 :... |
from twisted.words.protocols import irc
from txircd.modbase import Command
from txircd.utils import irc_lower
class NickServAlias(Command):
def onUse(self, user, data):
user.handleCommand("PRIVMSG", None, [self.ircd.servconfig["services_nickserv_nick"], " ".join(data["params"])])
class ChanServAlias(Comma... |
import unittest
import todo_api
import sqlite3
import json
todo_api.DATABASE = './todo_test.db'
class TodoApiTest(unittest.TestCase):
def setUp(self):
self.app = todo_api.app.test_client()
self.db = sqlite3.connect(todo_api.DATABASE)
self.c = self.db.cursor()
self.db.execute('DR... |
from django.http import HttpResponse
from django.utils import translation
from django import http
import json
from django.conf import settings
from utils.models import FiscalYear, FiscalYearForm, TemplateTrimester, TemplateTrimesterForm
from django.shortcuts import render
from companies.models import Company
from trime... |
"""Implementation of legacy Invenio methods for Flask session."""
from flask import current_app, request
from flask.sessions import SessionMixin
from flask.ext.login import current_user
from werkzeug.datastructures import CallbackDict
class Session(CallbackDict, SessionMixin):
"""Implement compatible legacy Inv... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.