content stringlengths 4 20k |
|---|
import re, os, sys, shutil, logging, optparse
LOGFILE = "migration.log"
MIGRATION_ORDER = [
"0.5.2",
"0.6",
"0.6.1",
"0.6.2",
"0.6.3",
"0.6.4",
"0.6.5",
"0.6.6",
"0.6.7",
"0.7-beta1",
"0.7-beta2",
"0.7-beta3",
"0.7",
"0.7.1",
"0.7.2"
]
LOGGING_READY =... |
# -*- coding: utf-8 -*-
import contextlib
import warnings
import numpy as np
import pandas as pd
import pytest
from xarray import (
Dataset, SerializationWarning, Variable, coding, conventions, open_dataset)
from xarray.backends.common import WritableCFDataStore
from xarray.backends.memory import InMemoryDataStor... |
from collections import OrderedDict
from django import forms
from rdrf.models.definition.models import Registry
from rdrf.models.definition.models import ConsentSection
from rdrf.models.definition.models import ConsentQuestion
from django.utils.translation import ugettext as _
import logging
logger = logging.getLogge... |
"""
Client side of the consoleauth RPC API.
"""
from oslo.config import cfg
from oslo import messaging
from nova import rpc
CONF = cfg.CONF
rpcapi_cap_opt = cfg.StrOpt('consoleauth',
help='Set a version cap for messages sent to consoleauth services')
CONF.register_opt(rpcapi_cap_opt, 'upgrade_levels')
cla... |
import time
import os
import RPi.GPIO as GPIO
# read SPI data from MCP3008 chip, 8 possible adc's (0 thru 7)
def readadc(adcnum, clockpin, mosipin, misopin, cspin):
if ((adcnum > 7) or (adcnum < 0)):
return -1
GPIO.output(cspin, True)
GPIO.output(clockpin, False) # start clock... |
from PySide import QtGui, QtCore
from PySide.QtCore import Qt
from mutil.mutil import *
from defaultsettings import color_schemes
import numpy as np
from math import sqrt
class JYDGVWidget(QtGui.QGraphicsView):
def __init__(self, parent):
self.scene = QtGui.QGraphicsScene()
super(JYDGVWidget, self).__init_... |
# To change this template, choose Tools | Templates
# and open the template in the editor.
import unittest
import logging
from apgl.graph.VertexList import VertexList
from apgl.graph.SparseGraph import SparseGraph
from sandbox.misc.GeometricRandomGenerator import GeometricRandomGenerator
class GeometricRandomGenerato... |
# -*- coding: utf-8 -*-
from ..exceptions import UnimplementedException
class QuerySet(object):
"""
Generate an iterator over the response and cache the result for slicing like a list.
"""
def __init__(self, cls, **params):
self._per_page = params.get('per_page', 0)
self._page = param... |
# -*- coding: utf-8 -*-
'''
Created on 16 2010
@author: ivan
'''
import urllib2
import logging
import re
site = "http://myradio.ua/player/7"
def load_urls_name_page():
connect = urllib2.urlopen(site)
data = connect.read()
result = {}
file = open("MYRADIO_UA.fpl", "w")
for line in data.split(... |
"""Support for views."""
from __future__ import annotations
import asyncio
import json
import logging
from typing import Any, Callable
from aiohttp import web
from aiohttp.typedefs import LooseHeaders
from aiohttp.web_exceptions import (
HTTPBadRequest,
HTTPInternalServerError,
HTTPUnauthorized,
)
import ... |
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
# Not installing aliases from python-future; it's unreliable and slow.
from builtins import * # noqa
from binascii import hexlify
from nose.tools import eq_, ok_
from hamcrest import raises, assert_that, calli... |
#####################################################################################################################
# inversion: This module provide specialized functions for computing node inverses and localized inverses. #
# It is part of the Cuicuilco framework ... |
import numpy as np
import dnfpy.controller.runner as runner
from dnfpyUtils.scenarios.scenarioRobustness import ScenarioRobustness
from dnfpyUtils.scenarios.scenarioNoise import ScenarioNoise
from dnfpyUtils.scenarios.scenarioTracking import ScenarioTracking
from dnfpyUtils.scenarios.scenarioDistracters import Scenari... |
import os
import mutagen
from .config import PersistentDict
class Collection(PersistentDict):
# collection = {
# 'Artist': {
# 'key': 'asdf',
# 'albums': {
# 'Album': {
# 'tracks': [...],
# 'synced': false,
# },
# ... |
from socket import gethostname
import os
import socket
import sys
import threading
import time
import logging.config
import pickle
from tashi.rpycservices.rpyctypes import *
from tashi.util import getConfig, createClient, instantiateImplementation, boolean
import tashi
from zoni.services.rpycservices import *
import ... |
from collections import OrderedDict as OD
data = (
OD((
("enabled", "on"),
)),
OD((
("GlobalShortcuts", (
OD((
("select", ""),
("find", ""),
)),
(),
)),
("ContextualShortcuts", (
OD((
... |
import mock
from neutronclient.common import exceptions as neutron_client_exc
from neutronclient.v2_0 import client
from ironic.common import dhcp_factory
from ironic.common import exception
from ironic.common import pxe_utils
from ironic.common import utils
from ironic.conductor import task_manager
from ironic.dhcp i... |
import random
import re
import hashlib
import string
import datetime
from google.appengine.api import memcache
from google.appengine.ext import db
#convert "00:00:00" time format into seconds
def time_sec(time_str):
time_list = time_str.split(':')
return int(time_list[0])*3600 + int(time_list[1])*60 + float(ti... |
from mock import MagicMock
import pyaem
from pyaem import bagofrequests as bag
import unittest
from .util import HandlersMatcher
class TestPackageManagerServiceHtml(unittest.TestCase):
def setUp(self):
self.package_manager_sync = pyaem.packagemanagerservicehtml.PackageManagerServiceHtml(
'ht... |
# Note: asyncio is only compatible with Python 3
import asyncio
import functools
import threading
import pyarrow.plasma as plasma
import ray
from ray.experimental.async_plasma import PlasmaProtocol, PlasmaEventHandler
from ray.services import logger
handler = None
transport = None
protocol = None
class _ThreadSaf... |
# coding: utf-8
# at.py
# address tree.
import os
CURRENT_DIRECTORY = os.path.split(os.path.realpath(__file__))[0]+'/'
class node:
def __init__(self, data):
self._data = data
self._children = []
def getdata(self):
return self._data
def getchildren(self):
return self._children
def add(self, node):
se... |
import os
import logging
import pecan
import time
from threading import Thread
from joulupukki.worker.worker.builder import Builder
from joulupukki.worker.worker.docker_builder import DockerBuilder
from joulupukki.worker.worker.osx_builder import OsxBuilder
from joulupukki.common.datamodel.build import Build
from jo... |
import os
import smtplib
import ssl
import sys
from typing import List, Union
try:
import jinja2
except ModuleNotFoundError:
sys.exit("Jinja2 is a required dependency for this script")
try:
import click
except ModuleNotFoundError:
sys.exit("Click is a required dependency for this script")
SMTP_PORT =... |
import os
import sys
import transaction
import datetime
from sqlalchemy import engine_from_config
from pyramid.paster import (
get_appsettings,
setup_logging,
)
from pyramid.scripts.common import parse_vars
from ..models import (
DBSession,
Base,
BlogModel,
EventModel,
)
def usage(... |
#! /usr/bin/env python
from __future__ import print_function, division
from openturns import *
from otsvm import *
# Instanciate one distribution object
dimension = 2
meanPoint = Point(dimension, 1.0)
meanPoint[0] = 0.5
meanPoint[1] = -0.5
sigma = Point(dimension, 1.0)
sigma[0] = 2.0
sigma[1] = 3.0
R = CorrelationMat... |
from termcolor import cprint
from .subscriptions import Subscriptions
class SubscriptionHandler(object):
def __init__(
self, events_queue, init_offers, init_signals,
broker, database_handler
):
self.events_queue = events_queue
self.broker = broker
... |
import os, ctypes
from ctypes import *
_API_DIR = '/home/root/hros1-framework/Linux/project/api_wrapper2/api_wrapper2'
os.chdir(_API_DIR)
_apiwrapper = CDLL(os.path.join(_API_DIR, 'apiwrapper.so'))
Initialize = _apiwrapper.InitializeJS
Initialize.argtypes = []
Initialize.restype = c_bool
ServoShutdown = _... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from OracleDatabase import OracleDatabase
from time import sleep
import logging, os.path
from Constants import *
from Utils import sidOrServiceNameHasBeenGiven, stringToLinePadded, getCredentialsFormated, getSIDorServiceNameWithType, getSIDorServiceName
from random import shuf... |
"""
a collection of small, custom popup windows used by microMSQT
"""
from PyQt5 import QtWidgets
class blbPopupWindow(QtWidgets.QDialog):
'''
Window for setting blob finding parameters
'''
def __init__(self, parent=None):
'''
setup GUI and populate with current values
blobFind... |
import unittest
from spitfire.compiler import analyzer
from spitfire.compiler import ast
from spitfire.compiler import compiler
from spitfire.compiler import options
from spitfire.compiler import util
from spitfire.compiler import walker
from spitfire import test_util
class BaseTest(unittest.TestCase):
def __in... |
__license__ = "AGPLv3 or Proprietary (see LICENSE.txt)"
__author__ = 'Dan McDougall <<EMAIL>>'
__doc__ = """\
.. _sso.py:
About The SSO Module
====================
sso.py is a Tornado Single Sign-On (SSO) authentication module that implements
GSSAPI authentication via python-kerberos (import kerberos). If "Negotiate... |
import os
import shutil
import hashlib
import uuid
import ezRPConfig as gConfig
hash_md5 = lambda data: hashlib.md5(data).hexdigest()
remove_file_if_exists = lambda tfile: os.path.isfile(tfile) and os.remove(tfile)
def rootDirs(path):
dirs = os.walk(path).next()[1]
return list() if len(dirs) == 0 else dirs
#... |
import os
import unittest
from pymatgen.core.structure import Molecule
from pymatgen.electronic_structure.core import Spin
from pymatgen.io.gaussian import GaussianInput, GaussianOutput
from pymatgen.util.testing import PymatgenTest
test_dir = os.path.join(PymatgenTest.TEST_FILES_DIR, "molecules")
class GaussianInp... |
"""Custom middleware used by the pages application."""
import re
from django.conf import settings
from django.template.response import SimpleTemplateResponse
from cms.models import publication_manager, PublicationManagementError
class PublicationMiddleware(object):
"""Middleware that enables preview mode ... |
import os
import sys
import string
import contextlib
from subprocess import Popen, PIPE
check_output = None
def replace_check_output(command_args, **kwargs):
kwargs['stdout'] = PIPE
return Popen(' '.join(command_args), **kwargs).stdout.read()
try:
from subprocess import check_output
except ImportError:
... |
"""
tests
=====
Module which contains the functions required to test how good performs a
prediction out-of-sample.
"""
import time
import numpy as np
import warnings
with warnings.catch_warnings():
warnings.simplefilter("error")
###############################################################################
####... |
#$Id$
from projects.model.Folder import Folder
class Document:
"""This class is used to create object for Document."""
def __init__(self):
"""Initialize parameters for Document object."""
self.id = 0
self.file_name = ""
self.content_type = ""
self.versions = []
... |
from collections import OrderedDict
from typing import Dict, Type
from .base import LoggingServiceV2Transport
from .grpc import LoggingServiceV2GrpcTransport
from .grpc_asyncio import LoggingServiceV2GrpcAsyncIOTransport
# Compile a registry of transports.
_transport_registry = OrderedDict() # type: Dict[str, Type[... |
class SeqReconstruct():
def __init__(self, cutOff, lstAcc):
self.cutOff = cutOff;
self.lstAcc = lstAcc;
self.filePos1 = 0;
self.filePos2 = 0;
self.fOut2 = open(os.path.join(DIR_output, "out.fasta.txt"), "w");
def do(self, chr, posStart, posStop, new):
myret = SeqRet();
refSeqRecd = myret.ret(chr, posSta... |
# -*- coding: utf-8 -*-
import sys
import os
import re
from xml_parser import XMLParser
class AlignSplit(XMLParser):
default_output = u'alignment_MS.xml'
help = '''
Extract a single MS alignment file from a multi-MSS alignment file
'''
def run_custom(self, input_path_list, output_path):
... |
# -*- coding: utf-8 -*-
#
import uuid
import re
from django.db import models
from django.core.validators import MinValueValidator, MaxValueValidator
from django.utils.translation import ugettext_lazy as _
from orgs.mixins import OrgModelMixin
__all__ = [
'CommandFilter', 'CommandFilterRule'
]
class CommandFil... |
import datetime
from django.utils.translation import ugettext_noop
import settings
from corehq.apps.reports.filters.base import BaseDrilldownOptionFilter, BaseSingleOptionFilter, \
BaseMultipleOptionFilter
from corehq.apps.reports.filters.select import YearFilter
from corehq.apps.users.models import CommCareUser
f... |
import base64
import copy
import hashlib
import json
import os
import random
import subprocess
import subprocess as sp
import sys
from collections import OrderedDict
from collections.abc import Mapping
from typing import Union
import numpy
import ludwig.globals
from ludwig.constants import PROC_COLUMN
from ludwig.uti... |
# -*- coding: utf-8 -*-
from PyQt4 import QtGui, QtCore
from acq4.analysis.AnalysisModule import AnalysisModule
from acq4.util.flowchart import *
import os
from collections import OrderedDict
import acq4.util.debug as debug
import acq4.util.FileLoader as FileLoader
import acq4.util.DatabaseGui as DatabaseGui
import acq... |
"""Enhance nose with extra options and behaviors for running SQLAlchemy tests.
When running ./sqla_nose.py, this module is imported relative to the
"plugins" package as a top level package by the sqla_nose.py runner,
so that the plugin can be loaded with the rest of nose including the coverage
plugin before any of SQL... |
"""
Generic export/import functions.
.. moduleauthor:: Bogdan Neacsa <<EMAIL>>
.. moduleauthor:: Ionel Ortelecan <<EMAIL>>
"""
import os
from tvb.basic.config.settings import TVBSettings as cfg
from tvb.core.utils import get_unique_file_name
from tvb.core.entities.storage import dao
from tvb.core.entities.file.files_... |
import sys
from _pydevd_bundle import pydevd_xml
from os.path import basename
import traceback
from _pydev_bundle import pydev_log
try:
from urllib import quote, quote_plus, unquote, unquote_plus
except:
from urllib.parse import quote, quote_plus, unquote, unquote_plus # @Reimport @UnresolvedImport
#========... |
"""
Installation script for the OpenSSL package.
"""
import codecs
import os
import re
from setuptools import setup, find_packages
HERE = os.path.abspath(os.path.dirname(__file__))
META_PATH = os.path.join("src", "OpenSSL", "version.py")
def read_file(*parts):
"""
Build an absolute path from *parts* and a... |
import os
from fqmapper import *
from samprocessor import *
def Preprocess(opts):
bln_pair = True if opts.rev else False
opts.rev = opts.rev if bln_pair else ''
bln_long = True if opts.length == 'long' else False
str_proj = os.path.basename(os.path.splitext(opts.fwd)[0])[:-2] if bln_pair else os.path.b... |
import asyncio
import pytest
from aiohttp import web
@pytest.mark.run_loop
def test_middleware_modifies_response(create_app_and_client):
@asyncio.coroutine
def handler(request):
return web.Response(body=b'OK')
@asyncio.coroutine
def middleware_factory(app, handler):
@asyncio.corou... |
#!/usr/bin/env python3
import sys
import click
from csaopt.utils import internet_connectivity_available, get_configs
from csaopt import Runner
from csaopt import __appname__ as csaopt_name
from csaopt import __version__ as csaopt_version
CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
def eprint(*args, ... |
"""TO-DO: Write a description of what this XBlock is."""
import pkg_resources
from xblock.core import XBlock
from xblock.fields import Scope, Integer, String
from xblock.fragment import Fragment
class pdfXBlock(XBlock):
"""
TO-DO: document what your XBlock does.
"""
# Fields are defined on the class.... |
"""
Make sure the getting a variable path works and doesn't crash.
"""
from __future__ import print_function
import lldb
import lldbsuite.test.lldbutil as lldbutil
from lldbsuite.test.lldbtest import *
class TestVarPath(TestBase):
mydir = TestBase.compute_mydir(__file__)
# If your test case doesn't stres... |
import tools.valueExtractorClass as valueExtractor
#fieldOutputs.keys =
# 'CNORMF ASSEMBLY_SLAVE1/ASSEMBLY_MASTER1', 'COPEN ASSEMBLY_SLAVE1/ASSEMBLY_MASTER1',
# 'CPRESS ASSEMBLY_SLAVE1/ASSEMBLY_MASTER1', 'CSHEAR1 ASSEMBLY_SLAVE1/ASSEMBLY_MASTER1',
# 'CSHEAR2 ASSEMBLY_SLAVE1/ASSEMBLY_MASTER1', 'CSHEARF ASSEM... |
import pywps.configuration as wpsConfig
from . import StorageAbstract
from .implementationbuilder import StorageImplementationBuilder
from . import STORE_TYPE
import os
import logging
LOGGER = logging.getLogger('PYWPS')
class S3StorageBuilder(StorageImplementationBuilder):
def build(self):
bucket = wps... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import
from django.contrib.auth.models import AbstractUser
from django.core.urlresolvers import reverse
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
from opencv_engine import __version__
tests_require = [
'mock',
'nose',
'coverage',
'yanc',
'colorama',
'preggy',
'ipdb',
'coveralls',
'numpy',
'colour',
]
setup(
name='opencv_engine'... |
class HitchRunPyException(Exception):
pass
class UnexpectedException(HitchRunPyException):
"""
An unexpected exception was raised.
"""
def __init__(self, exception_type, message, formatted_stacktrace, command_output):
self.exception_type = exception_type
self.message = message
... |
from copy import deepcopy
from io import StringIO
from pathlib import Path
from neurom import check, load_neuron
from neurom.check import neuron_checks as nrn_chk
from neurom.core.dataformat import COLS
from neurom.core.types import dendrite_filter
from neurom.exceptions import NeuroMError
import pytest
from numpy.tes... |
from lxml import html
import csv, os, json
import requests
from exceptions import ValueError
from time import sleep
import urllib
import lxml.html
genList_shopclues = []
extracted_data_shopclues = []
data = []
papa = None
shoplist = []
def ShopcluesParser(url):
headers = {
'User-Agent': 'Mozilla/5.0 (X11... |
#!/usr/bin/env python
# Brandon Heller
#
# Parse processed mongo DB to output CSV suitable for Tableau exploration.
#
# See CommitCSVWriter for the fields and their ordering.
from optparse import OptionParser
import os
import time
from os.path import isfile
from datetime import datetime
from pymongo import Connection... |
"""
A fake server that "responds" to API methods with pre-canned responses.
All of these responses come from the spec, so if for some reason the spec's
wrong the tests might raise AssertionError. I've indicated in comments the
places where actual behavior differs from the spec.
"""
# W0102: Dangerous default value %s... |
#!/usr/bin/env python3
import sys
import os.path
from collections import OrderedDict
import packTab
if len (sys.argv) != 2:
print("""usage: ./gen-emoji-table.py emoji-data.txt
Input file, as of Unicode 12:
* https://www.unicode.org/Public/emoji/12.0/emoji-data.txt""", file=sys.stderr)
sys.exit (1)
f = open(sys.ar... |
'''
Test creating an instance of a Java class and fetching its values.
'''
from __future__ import absolute_import
import unittest
from jnius import autoclass, JavaException
class TestConstructor(unittest.TestCase):
'''
TestCase for using constructors with PyJNIus.
'''
def test_constructor_none(self)... |
from django.db import models
from django.core.validators import RegexValidator
import datetime
# Create your models here.
class Nodeowner(models.Model):
ad_client_id = models.DecimalField(max_digits=10,decimal_places=0,null=False,default=1000000)#Alternative Solution
ad_org_id = models.DecimalField(max_digits... |
"""
Django settings for myproject project.
Generated by 'django-admin startproject' using Django 1.8.5.
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... |
import os
from os.path import join
from .. import run_python_module
from .base import BaseTestApp
class TestNbGraderRelease(BaseTestApp):
def _release(self, assignment, exchange, flags=None, retcode=0):
cmd = [
"nbgrader", "release", assignment,
"--course", "abc101",
... |
import fileinput
bots = [{"chips": [], "low": -1, "high": -1, "lowout": False, "highout": False} for i in range(210)]
for line in fileinput.input():
line = line[:-1]
line = line.split()
if line[0] == "value":
bots[int(line[-1])]["chips"].append(int(line[1]))
elif line[0] == "bot":
bots... |
import random
import efl.elementary as elm
elm.init()
from efl.elementary.window import StandardWindow
from efl.elementary.label import Label
from efl.elementary.button import Button
from efl.evas import EVAS_HINT_EXPAND, EVAS_HINT_FILL
from elmextensions import FileSelector
EXPAND_BOTH = EVAS_HINT_EXPAND, EVAS_HINT... |
from __future__ import unicode_literals
import functools
import logging
import django
from django.db import models
from django.db.models import signals
from django.db.models.sql import query, EmptyResultSet
from django.utils import encoding
from caching import config
from .compat import DEFAULT_TIMEOUT
from .invalid... |
from mechanize import Browser
from BeautifulSoup import BeautifulSoup, BeautifulStoneSoup
import sys, re, string
from PyQt4.QtCore import *
from PyQt4.QtGui import *
#This module is responsible for displaying Purdue Campus news stories that
#are available through FeedBurner RSS feeds
class NewsHelper():
def __i... |
import json
import requests
from django.conf import settings
from django.http import JsonResponse
from django.shortcuts import get_object_or_404
from django.urls import reverse
from django.views.decorators.csrf import csrf_exempt
from django.views.generic import FormView
from django_fsm import can_proceed
from getpai... |
"""
The original of this file was taken from a Conduit branch of John Carr (http://git.gnome.org/cgit/conduit/log/?h=syncml),
It was modified significantly for PISI use by Michael Pilgermann.
Major keys are:
- there is a bit of a problem as Syncml is actually the server (making all the comparing) - but PISI has its e... |
from django.contrib.gis import forms
from django.contrib.gis.geos import GEOSGeometry
from django.forms import ValidationError
from django.test import SimpleTestCase, override_settings, skipUnlessDBFeature
from django.test.utils import patch_logger
from django.utils.html import escape
@skipUnlessDBFeature("gis_enable... |
from gi.repository import Gtk
from gi.repository import GObject
#-------------------------------------------------------------------------
#
# GRAMPS modules
#
#-------------------------------------------------------------------------
from gramps.gen.plug.report._constants import CATEGORY_DRAW
from ._docreportdialog i... |
from pyasn1_modules import rfc2315
from pyasn1_modules.rfc2459 import *
MAX = float('inf')
id_pkix = univ.ObjectIdentifier('1.3.6.1.5.5.7')
id_pkip = univ.ObjectIdentifier('1.3.6.1.5.5.7.5')
id_regCtrl = univ.ObjectIdentifier('1.3.6.1.5.5.7.5.1')
id_regCtrl_regToken = univ.ObjectIdentifier('1.3.6.1.5.5.7.5.1.1')
id_r... |
from unittest import TestCase
from rainbow.datasources import DataSourceCollection
from rainbow.preprocessor import Preprocessor
from rainbow.preprocessor.preprocessor_exceptions import InvalidPreprocessorFunctionException
from rainbow.preprocessor.instance_chooser import InvalidInstanceException
from rainbow.yaml_load... |
"""
Views for managing floating IPs.
"""
from django.core.urlresolvers import reverse_lazy
from django.utils.translation import ugettext_lazy as _
from neutronclient.common import exceptions as neutron_exc
from horizon import exceptions
from horizon import forms
from horizon import tables
from horizon import workflo... |
from totalimpact.providers import provider
from totalimpact.providers.provider import Provider, ProviderContentMalformedError
import re
import logging
logger = logging.getLogger('ti.providers.figshare')
class Figshare(Provider):
example_id = ("doi", "10.6084/m9.figshare.92393")
url = "http://figshare.com... |
from migrate import ForeignKeyConstraint
from sqlalchemy import MetaData, Table
TABLES = ['resource', 'sourceassoc', 'user',
'project', 'meter', 'source', 'alarm']
INDEXES = {
"resource": (('user_id', 'user', 'id'),
('project_id', 'project', 'id')),
"sourceassoc": (('user_id', 'user... |
class Context():
def __init__(self, arch, mode, shell_dir, mode_flags, verbose, timeout,
isolates, command_prefix, extra_flags):
self.arch = arch
self.mode = mode
self.shell_dir = shell_dir
self.mode_flags = mode_flags
self.verbose = verbose
self.timeout = timeout
self.isola... |
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
SECRET_KEY = '6k(n-k#4(ja#w2cbmu)eeapjkt81+%2zygs5k6b$3at9n^h3gr'
DEBUG = False
TEMPLATE_DEBUG = False
ALLOWED_HOSTS = ['localhost', ]
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'dj... |
__plugin_name__ = "RedstonerUtils"
__plugin_version__ = "3.0"
__plugin_mainclass__ = "foobar"
import sys
from traceback import format_exc as print_traceback
# damn pythonloader changed the PATH
sys.path += ['', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-linux2', '/usr/lib/python2.7/lib-tk', '/usr/lib/pytho... |
import argparse
from pprint import pprint
from TLO.TLO import TLO
def cmd_parse(cmd):
if len(cmd) == 1:
return cmd
else:
_type = cmd[0]
_name = ' '.join(cmd[1:len(cmd)])
return [_type, _name]
def main():
parser = argparse.ArgumentParser(prog='PROG', description='This program interfaces with CRITS \
allow... |
import cgi
import urllib
import webapp2
from google.appengine.ext import ndb
from google.appengine.api import images
from google.appengine.api import users
# [START model]
class Greeting(ndb.Model):
"""Models a Guestbook entry with an author, content, avatar, and date."""
author = ndb.StringPrope... |
from feat.agents.base import descriptor, replay, task
from feat.agencies.tasks import TaskState, NOT_DONE_YET
from feat.agencies import retrying
from feat.common import defer
from feat.interface import protocols
from feat.test import common
class SomeException(Exception):
pass
class BaseTestTask(task.BaseTask,... |
# coding: utf-8
from __future__ import unicode_literals
from ...tokenizer import Tokenizer
from ..util import get_doc, add_vecs_to_vocab
import pytest
@pytest.fixture
def vectors():
return [("apple", [0.0, 1.0, 2.0]), ("orange", [3.0, -2.0, 4.0])]
@pytest.fixture()
def vocab(en_vocab, vectors):
return add... |
import requests
import hashlib
import json
import time
from datetime import datetime
from Crypto.Cipher import AES
if False:
import logging
import httplib
httplib.HTTPConnection.debuglevel = 1
class Snapchat(object):
URL = 'https://feelinsonice-hrd.appspot.com/bq'
SECRET = ... |
# coding=utf-8
"""
InaSAFE Disaster risk assessment tool developed by AusAid -
**Exception Classes.**
Custom exception classes for the SAFE library
Contact : <EMAIL>
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published b... |
from mockfacebook import MockFacebook
from facebook.wsgi import FacebookWSGIMiddleware
user_info = [{
'name': 'Justin Tulloss',
'uid': 1909354,
'first_name': 'Justin',
'has_added_app': True,
'pic_big': 'bigurl',
'pic_square': 'squareurl',
'pic': 'picurl',
'sex': 'yes',
'music': 'Bri... |
import cookielib
import urllib2
import re
import mechanize
import json
import time
from bs4 import BeautifulSoup
import sys
id = ""
retryTime = 300
def work(username):
try:
global id
logincheck = br.open('https://www.fiverr.com/users/' + username + '/requests')
soup = BeautifulSoup(loginche... |
"""End to end test for create and deploy new project."""
import os
import shutil
import tempfile
import types
import unittest
import urllib.parse
from django_cloud_deploy.cli import new
from django_cloud_deploy.cli import update
from django_cloud_deploy.tests.e2e import e2e_utils
from django_cloud_deploy.tests.lib im... |
import logging
logger = logging.getLogger(__name__)
class TaskRegisterMemento(type):
"""
This class implements two separate features. It will ensure that all
class instances of the same name and arguments return the same cached
object. Second it will register each defined class and use this informat... |
from pkg_resources import resource_string
import logging
import json
import re
import tempfile
from copy import deepcopy
from org.bccvl.compute.utils import getdatasetparams
from zope.interface import provider
from org.bccvl.site.interfaces import IComputeMethod
from org.bccvl.tasks.compute import r_task
from org.bccvl... |
fips_to_st = {
'01': ('AL', 'Alabama'),
'02': ('AK', 'Alaska'),
'04': ('AZ', 'Arizona'),
'05': ('AR', 'Arkansas'),
'06': ('CA', 'California'),
'08': ('CO', 'Colorado'),
'09': ('CT', 'Connecticut'),
'10': ('DE', 'Delaware'),
'11': ('DC', 'District of Columbia'),
'12': ('FL', 'Flor... |
from linux_story.story.terminals.terminal_bernard import TerminalMkdirBernard
from linux_story.story.challenges.challenge_26 import Step1 as NextStep
from linux_story.step_helper_functions import unblock_cd_commands
class StepTemplateMkdir(TerminalMkdirBernard):
challenge_number = 25
class Step1(StepTemplateMkd... |
dataset_path = './data_small_100.h5'
train_file_name, dataset_keyword = '../data_small_100.h5', 'data_small'
image_height, image_width, image_depth=32,32,3
frames, height, width = 100, 256, 320
dropout_rate = 0.7
data_augmentation=False
append_CSVfile_FLAG = False
#data = (nsamples, 202*100*256*320) float32
experimen... |
"""
streamcloud urlresolver plugin
Copyright (C) 2012 Lynx187
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 ... |
"""
=======================
Morphological Filtering
=======================
Morphological image processing is a collection of non-linear operations related
to the shape or morphology of features in an image, such as boundaries,
skeletons, etc. In any given technique, we probe an image with a small shape or
template ca... |
# -*- coding: utf-8 -*-
# -*- Channel PelisPlay -*-
# -*- Created for Alfa-addon -*-
# -*- By the Alfa Develop Group -*-
import re
import sys
import urlparse
from channels import autoplay
from channels import filtertools
from core import httptools
from core import scrapertools
from core import servertools
from core.i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.