content string |
|---|
# Django settings for website project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', '<EMAIL>'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'website.db', ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
import json
import logging
import os
import re
import sys
import time
import unicodedata
import urllib.error
import urllib.request
from concurrent.futures import ThreadPoolExecutor
from functools import partial
import requests
MINIMUM_SIZE = 10
DOWNLOAD_... |
import os
import numpy
from scipy import ndarray, array
from qutip.cyQ.codegen import Codegen
from qutip.odeoptions import Odeoptions
from qutip.odechecks import _ode_checks
from qutip.odeconfig import odeconfig
from qutip.qobj import Qobj
from qutip.superoperator import spre, spost
def rhs_clear():
"""
Rese... |
#
# mcts.py
#
# Created by Andrey Kolishchak on 04/21/18.
#
import numpy as np
class Node:
def __init__(self):
self.total_visits = 0
self.reward = 0
self.visits = None
self.value = None
self.mean_value = None
self.policy = None
self.action_mask = None
clas... |
# coding=utf-8
#!/usr/bin/env python
import os
def yesnoanswer (question):
answer = input(question + "[j/n]")
answer = answer.replace(" ", "")
if answer == "j":
answer = True
elif answer == "y":
answer = True
elif answer == "J":
answer = True
elif answer == "Y":
... |
from shitsu import xmpp
from shitsu import modules
class Join(modules.MessageModule):
acl = modules.ACL_OWNER
args = (0, 1)
thread_safe = False
def run(self, conf=None, permanent=True):
"""[conf]
Join the conference and add it to the startup
conference list.
Format: <... |
import sys
from qhue import Bridge
from rgb_cie import Converter
import os
converter = Converter()
f = open("hue_id.txt", "r")
hue_id = f.readlines()[-1].rstrip()
f.close()
b = Bridge(hue_id, "elbLovRPUcHaqss904iEJMH9LZrRwsvFeOKSfvOP")
strip_bri = b.lights[1]()['state']['bri']
bloom_1_bri = b.lights[2]()['state'... |
from functools import wraps
from nose import SkipTest
class Capabilities(dict):
def __missing__(self, capability):
probe = getattr(self, '_' + capability)
self[capability] = have = probe()
return have
def _genshi(self):
try:
from genshi.template import MarkupTemp... |
from __future__ import print_function
import time
import os
import sys
import json
from urllib2 import urlopen, HTTPError, URLError
from elasticsearch import Elasticsearch
from elasticsearch.exceptions import ConnectionError
class Metadata(object):
def __init__(self, filename, url, directory, es_url, es_main_... |
# encoding: utf-8
"""
community.py
Created by Thomas Mangin on 2009-11-05.
Copyright (c) 2009-2015 Exa Networks. All rights reserved.
"""
# ============================================================== Communities (8)
# http://www.iana.org/assignments/bgp-extended-communities
from exabgp.bgp.message.update.attribut... |
import datetime
from haystack import indexes
from django.contrib.contenttypes.models import ContentType
from transifex.actionlog.models import LogEntry
from transifex.projects.models import Project
class ProjectIndex(indexes.RealTimeSearchIndex, indexes.Indexable):
text = indexes.CharField(document=True, use_temp... |
# -*- coding: utf-8 -*-
# /etl/public/forms.py
"""Public forms."""
from flask_wtf import Form
from wtforms import PasswordField, StringField
from wtforms.validators import DataRequired
from etl.user.models import User
class LoginForm(Form):
"""Login form."""
username = StringField('Username', validators=[... |
from __future__ import absolute_import
from datetime import date
import re
import unittest2
from normalize import FieldSelector
from normalize import FieldSelectorException
from normalize import JsonCollectionProperty
from normalize import JsonProperty
from normalize import JsonRecord
from normalize import JsonRecord... |
from discord.ext import commands
from .utils import checks
import discord, asyncio
import inspect
import urllib
class Support:
"""Support Commands, used for reporting bugs and giving suggestions"""
def __init__(self, bot):
self.bot = bot
self.config = bot.config.get(self.__class__.__name__, {}... |
import os
from setuptools import setup, find_packages
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(name='GooCalendar',
version='0.3',
author='Cédric Krier',
author_email='<EMAIL>',
url='http://code.google.com/p/goocalendar/',
description='A calenda... |
class LDAPTestDirectory(object):
top = ('o=test', {'o': 'test'})
example = ('ou=example,o=test', {'ou': 'example'})
admin = ('cn=admin,ou=example,o=test',
{
'cn': 'admin',
'userPassword': ['ldaptest']
})
alice = ('uid=alice,ou=example,o=test'... |
import os
import private
is_dev = os.uname()[1] in private.DEV_SERVERS
if is_dev:
DEBUG = True
else:
DEBUG = False
TEMPLATE_DEBUG = DEBUG
ADMINS = (
(private.ADMIN_FULLNAME, private.ADMIN_EMAIL),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': private.DB_ENGINE,
'NAME': pr... |
from ....common.db.sql import VARCHAR, Numeric as NUMBER, DateTime as DATETIME, Column, BaseModel, CLOB, DATE
VARCHAR2 = VARCHAR
class AShareMonthlyReportsofBrokers(BaseModel):
"""
4.55 中国A股券商月报
Attributes
----------
object_id: VARCHAR2(100)
对象ID
s_info_windcode: VARCHAR2(40)
... |
# encoding: utf-8
"""
WordprocessingML Package class and related objects
"""
from __future__ import absolute_import, print_function, unicode_literals
from docx.image.image import Image
from docx.opc.constants import RELATIONSHIP_TYPE as RT
from docx.opc.package import OpcPackage
from docx.opc.packuri import PackURI
... |
import pandas as pd
from pandas import DataFrame, read_csv
import sys
import cPickle as pickle
from datetime import datetime
#def init(location):
location = 'data/trip_data_2.csv'
df = pd.read_csv(location)
call_x = df.pickup_latitude
call_y = df.pickup_latitude
df['pickup_datetime'] = pd.to_datetime(df.pickup_datetim... |
import shutil
import tempfile
from unittest import TestCase
from basset.exceptions import *
from basset.helpers.configuration_manager import ConfigurationManager
class TestConfigurationManager(TestCase):
temp_dir_path = ""
config_files_path = "configs"
sample_xcassets_dir = "sample_xcassets_dir"
sam... |
import json
import os
from tempest import config
from tempest.lib.common import rest_client
from murano_tempest_tests import utils
import six
CONF = config.CONF
class ArtifactsClient(rest_client.RestClient):
"""Tempest REST client for Glance Artifacts"""
def __init__(self, auth_provider):
super(Ar... |
from django import template
from django.utils.safestring import mark_safe
import markdown
from markdown.inlinepatterns import LinkPattern
register = template.Library()
class OEmbedExtension(markdown.Extension):
class OEmbedPattern(LinkPattern):
def handleMatch(self, m):
el = markdown.util.et... |
'''
Python client for the Mapbox Routing service.
'''
import json
import requests
from cartodb_services.metrics import Traceable
from cartodb_services.tools import PolyLine
from cartodb_services.tools.coordinates import (validate_coordinates,
marshall_coordinates)
from c... |
from oslo_db.sqlalchemy import models
from oslo_utils import uuidutils
import sqlalchemy as sa
from sqlalchemy.ext import declarative
from sqlalchemy import orm
from neutron.api.v2 import attributes as attr
class HasTenant(object):
"""Tenant mixin, add to subclasses that have a tenant."""
# NOTE(jkoelker) t... |
from PyQt4 import QtCore, QtGui
import re
from config import Settings
import util
import hashlib
from client import ClientState
class LoginWizard(QtGui.QWizard):
def __init__(self, client):
QtGui.QWizard.__init__(self)
self.client = client
self.login = client.login
self.password =... |
from datetime import datetime
import actstream.actions
import django_filters
import json
from django.contrib.contenttypes.models import ContentType
from django.db.models import Q
from rest_framework import serializers, viewsets, permissions, filters, status, pagination
from rest_framework.decorators import detail_rout... |
#!/usr/bin/env python
from _panel import *
import pygtk
pygtk.require("2.0")
import gtk
import gobject
import sys
PLUGIN_ARGV_0, \
PLUGIN_ARGV_FILENAME, \
PLUGIN_ARGV_UNIQUE_ID, \
PLUGIN_ARGV_SOCKET_ID, \
PLUGIN_ARGV_NAME, \
PLUGIN_ARGV_DISPLAY_NAME, \
PLUGIN_ARGV_COMMENT, \
PLUGIN_ARGV_BACKGROUND_IMAGE, \
PLUGIN_AR... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations, IntegrityError, transaction
import galaxy.main.fields
import galaxy.main.mixins
class Migration(migrations.Migration):
dependencies = [
('main', '0010_auto_20150826_1017'),
]
@transaction.a... |
#!/usr/bin/env python3
# Python 2/3 compatibility.
from __future__ import print_function
from collections import OrderedDict
import pkg_resources
from plover.registry import Registry
def sorted_requirements(requirements):
return sorted(requirements, key=lambda r: str(r).lower())
# Find all available distrib... |
#! /usr/bin/env python
import os
from prepare_sim_data import *
def main():
homedir = os.path.expanduser('~')
script_path = homedir+"/Workspace/AnimationEditor/Script/prepare"
data_root = homedir+"/Workspace/AnimationEditor/Data"
temp_fold = data_root + "/pattern"
obj_file = data_root + "/b... |
__revision__ = "test/Batch/callable.py rel_2.5.1:3735:9dc6cee5c168 2016/11/03 14:02:02 bdbaddog"
"""
Verify passing in a batch_key callable for more control over how
batch builders behave.
"""
import os
import TestSCons
test = TestSCons.TestSCons()
test.subdir('sub1', 'sub2')
test.write('SConstruct', """
def batc... |
# -*- coding: utf-8 -*-
import urlparse
from datetime import datetime
import psycopg2
psycopg2.extensions.register_type(psycopg2.extensions.UNICODE)
psycopg2.extensions.register_type(psycopg2.extensions.UNICODEARRAY)
class Database(object):
def __init__(self, conn_str=None):
self.conn_str = conn_str
... |
"""\
AtomicGrid.py Simple atomic grids, based on:
A.D. Becke, 'A multicenter numerical integration scheme for
polyatomic molecules.' J. Chem. Phys 88(4) 1988.
The atomic grids are constructed from atomic grids that use
Lebedev grids for the angular part, and Legendre grids for
the radial parts.
This program... |
#!/usr/bin/env python
"""
_jenkins_
Publisher plugin that uses jenkins to handle publishing documentation
"""
import json
import os
from requests_toolbelt import MultipartEncoder
from cirrus.logger import get_logger
from cirrus.plugins.jenkins import JenkinsClient
from cirrus.publish_plugins import Publisher
from c... |
# encoding: UTF-8
"""
DualThrust交易策略
"""
from datetime import time
from vnpy.trader.app.ctaStrategy.ctaTemplate import CtaTemplate
from vnpy.trader.vtConstant import EMPTY_STRING
from vnpy.trader.vtObject import VtBarData
########################################################################
class DualThrustStra... |
import gettext
class Language:
def __init__(self, conf):
home = conf.home
op_folder = conf.get('GENERAL', 'op_folder')+'/openplotter'
locale_folder = home+op_folder+'/locale'
language = conf.get('GENERAL', 'lang')
gettext.install('openplotter', locale_folder, unicode=False)
presLan_en = gettext.transla... |
from __future__ import print_function
import os
import re
import warnings
import numpy as np
from astropy.utils import OrderedDict
from astropy.io import registry as io_registry
from astropy.table import Table
from astropy import log
from astropy import units as u
from astropy.io.fits import HDUList, TableHDU, BinT... |
# this is copied from @natronics: https://github.com/open-notify/Open-Notify-API/blob/master/util.py
from functools import wraps
from flask import jsonify, request, current_app
def safe_float(s, range, default=False):
try:
f = float(s)
except:
return default
if f > range[1]:
retur... |
from copy import deepcopy
from typing import Any, Dict, List
from ..utils.access_permissions import BaseAccessPermissions
from ..utils.auth import async_has_perm, async_in_some_groups
class MotionAccessPermissions(BaseAccessPermissions):
"""
Access permissions container for Motion and MotionViewSet.
"""
... |
import prairielearn as pl
import lxml.html
import os
def prepare(element_html, data):
element = lxml.html.fragment_fromstring(element_html)
pl.check_attribs(element, required_attribs=['file-name'], optional_attribs=['type', 'directory', 'label', 'force-download'])
def render(element_html, data):
element... |
"""
This module applies the Gene Set Enrichment Analysis to a file containing
multiple gene sets and a file containing gene expression profile data, producing
an output file tabulating the results.
"""
import numpy as np
from gsea.dataprep import IO
from gsea.gep import Gene_Expression_Profile
np.set_printoptions(s... |
# -*- coding: utf-8 -*-
# XXX Update Docstring
"""
pyFuckery - test_vm.py
Created on 2/12/17.
"""
# Stdlib
import io
import logging
import os
# Third party code
import pytest
# Custom code
from fuckery.exc import VMError
from fuckery.parser import parse_program
from fuckery.vm import VirtualMachine
import tests.com... |
#!/usr/bin/env python
"""models.py
server-side Python App Engine data & ProtoRPC models
"""
import httplib
import endpoints
from protorpc import messages
from google.appengine.ext import ndb
class ConflictException(endpoints.ServiceException):
"""ConflictException -- exception mapped to HTTP 409 response"""
... |
import time
from django.conf import settings
from requests_oauthlib import OAuth2Session
config = {
'authorization_url': getattr(settings, 'OAUTH_AUTHORIZATION_URL', ''),
'client_id': getattr(settings, 'HELLO_BASE_CLIENT_ID', ''),
'client_secret': getattr(settings, 'HELLO_BASE_CLIENT_SECRET', ''),
't... |
#!/usr/bin/env python
# -*- coding: utf8 -*-
__version__ = '$Id: binclock_bcd_curses.py 780 2010-10-19 10:33:34Z mn $'
# binary clock, bcd version
import sys
import time
import curses
def bin_old(n):
"""bin() that works with Python 2.4"""
if n < 1:
return '0'
result = []
while n:
if n % 2:
result.append('... |
#!/usr/bin/env python
"""
Created on Thu Jun 18 10:32:50 2015
Author: Oren Freifeld
Email: <EMAIL>
"""
import numpy as np
from scipy import sparse
from of.utils import *
from of.gpu import CpuGpuArray
from cpab.cpaNd import CpaSpace as CpaSpaceNd
from cpab.cpaNd.utils import null
from cpab.cpaHd.utils import *
fr... |
from bs4 import element
from core import *
from selectors import *
from evaluators import *
class Actor(object):
"""Acts on one tag"""
def __init__(self, evaluator=None):
self.evaluator = evaluator
def act(self, tag):
pass
class Scorer(Actor):
def __init__(self, evaluator, reset_children=False):
Actor.... |
from Components.config import config
from enigma import eServiceReference, eActionMap
def zapService(session, id, title = ""):
service = eServiceReference(id)
if len(title) > 0:
service.setName(title)
else:
title = id
if config.ParentalControl.configured.value:
config.ParentalControl.configured.value = F... |
import os
import base64
import xmlrpclib
import urllib2
import cookielib
import httplib
import cherrypy
import pickle
from tempfile import mkstemp
from openipam.utilities import error
class PickleCookieJar( cookielib.CookieJar ):
def __init__( self, *args ):
self._initargs = args
cookielib.CookieJar.__init__(se... |
from glob import glob
from io import BytesIO
from os import mkdir
from os.path import join
from shutil import rmtree
from tarfile import TarInfo
from tempfile import mkdtemp
from typing import Dict
from unittest import TestCase
from unittest.mock import Mock
from uuid import uuid4
from opwen_email_client.domain.email.... |
from chains.service import Service
from chains.common import log
import hashlib, time, urllib2, urllib, sys, json
class RuterService(Service):
"""
Service implementing Ruter API
Needs fromplace, toplace and transporttypes in config to work.
How to get fromplace and toplace:
1) Find your line numbe... |
from urllib2 import urlopen, Request
from json import loads
def change_endianness(x):
""" Changes the endianness (from BE to LE and vice versa) of a given value.
:param x: Given value which endianness will be changed.
:type x: hex str
:return: The opposite endianness representation of the given value... |
"""
Django settings for hello project.
Generated by 'django-admin startproject' using Django 1.9.5.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
# B... |
# -*- coding: utf-8 -*-
'''
Created on 2014��11��21��
@author: ���
'''
class DotDict2(dict):
'''
classdocs
'''
def __init__(self, dict_data = None, **kwargs):
super(DotDict2, self).__init__(self, **kwargs)
self.update(dict_data)
def update(self, dict_data=None):
if ... |
import ldap
from lib389.plugins import MemberOfPlugin
from lib389.cli_conf.plugin import add_generic_plugin_parsers
def manage_attr(inst, basedn, log, args):
if args.value is not None:
set_attr(inst, basedn, log, args)
else:
display_attr(inst, basedn, log, args)
def display_attr(inst, basedn... |
import sys
import re
"""Baby Names exercise
Define the extract_names() function below and change main()
to call it.
For writing regex, it's nice to include a copy of the target
text for inspiration.
Here's what the html looks like in the baby.html files:
...
<h3 align="center">Popularity in 1990</h3>
....
<tr align... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import sys
import logging
import time
import json
import random
from threading import Thread
from flask_cors import CORS, cross_origin
from pogom import config
from pogom.app import Pogom
from pogom.utils import get_args, insert_mock_data, load_credentials, FakeArg... |
#!/usr/bin/python
from os.path import join
import dirs
class FactoryFile(object):
def __init__(self, prefix, name):
self.name = (name if prefix is None else prefix + name)
def getName(self):
return self.name
def getPath(self):
return None
def getH(self):
return self.name + ".h"
def getM(self):
ret... |
# -*- coding: UTF-8 -*-
from pprint import pprint
from feedrsub.ingestion.parsers.rss.rss_item_parser import RssItemParser
from feedrsub.models.author import Author
from feedrsub.models.author_map import AuthorMap
from feedrsub.models.entry import Entry
from tests.conftest import valid_uuid
from tests.factories import... |
import mesh
from mesh.core import _get_distinct_colors
import tracking
import copy
import matplotlib as mpl
import matplotlib.pyplot as plt
import random
from os import path
from os.path import dirname
import numpy as np
import colorsys
first_filename = path.join(dirname(__file__),'..','..','..','test','test_on_data',... |
import pickle
import numpy
import matplotlib.pyplot as plot
from matplotlib import cm
import os
import random
def compare_keys():
keys = []
freqs = [0]*256
for f in os.listdir("./keys"):
with open("./keys/" + f, "rb") as k:
keys.append(pickle.load(k))
#freqs.append([0]*256)
for i in range(512):
for j in ... |
'''
InfPomAlignmentMisc
'''
##
# Import modules
#
import Logger.Log as Logger
from Library import DataType as DT
from Library.Misc import ConvertArchList
from Object.POM.ModuleObject import BinaryFileObject
from Object.POM import CommonObject
## GenModuleHeaderUserExt
#
#
def GenModuleHeaderUserExt(De... |
post_broadcast_schema = {
"$schema": "http://json-schema.org/draft-07/schema",
"type": "object",
"required": [
"msgType",
"reference",
"category",
"content",
"areas",
],
"additionalProperties": False,
"properties": {
"reference": {
"typ... |
import datetime
from django.test import TestCase
from base.templatetags import offer_year_calendar_display as offer_year_calendar_display_tag
from base.tests.factories.academic_calendar import AcademicCalendarFactory
from base.tests.factories.academic_year import AcademicYearFactory
from base.tests.factories.educatio... |
# encoding: utf-8
from __future__ import absolute_import, print_function, division
import os
import subprocess
from pebble_tool.exceptions import ToolError
from pebble_tool.util.versions import version_to_key
def check_npm():
try:
npm_version = subprocess.check_output(["npm", "--version"]).strip()
... |
import os
import setproctitle
import time
from multiprocessing import Process, Event
class GooglePing(object):
def __init__(self, log, gpio = None):
self._log = log
self._gpio = gpio
self._process = None
self.exit = Event()
def __ping(self, title):
hostname = "www.google.com"
was_down = Fa... |
#encoding:utf-8
# Must be run from same folder for relative import path to work!
import sys
sys.path.append("../tv.boxeeplay.svtplay3")
from wlps import WlpsClient
from wlps_mc import category_to_list_item, show_to_list_item, episode_to_list_item, has_episodes
from logger import Level, BPLog, SetEnabledPlus
import simp... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###########################################################
# WARNING: Generated code! #
# ************************** #
# Manual changes may get lost if file is generated again. #
# Only code inside the [MANUAL] ta... |
import re
import urllib2, urllib
import logging
from datetime import date
PACER_BASE_URL = "https://ecf.%s.uscourts.gov/"
PACER_CGI_URL = PACER_BASE_URL + "cgi-bin/"
class PacerClient():
def __init__(self, username, password):
self.username = username
self.password = password
self._open... |
"""
Django production settings for swh-web.
"""
from .common import * # noqa
from .common import (
MIDDLEWARE, CACHES, ALLOWED_HOSTS, WEBPACK_LOADER
)
from .common import swh_web_config
from .common import REST_FRAMEWORK
# activate per-site caching
if 'GZip' in MIDDLEWARE[0]:
MIDDLEWARE.insert(1, 'django.midd... |
import unittest
import IECore
import Gaffer
import GafferScene
import GafferSceneTest
class PruneTest( GafferSceneTest.SceneTestCase ) :
def testPassThrough( self ) :
sphere = IECore.SpherePrimitive()
input = GafferSceneTest.CompoundObjectSource()
input["in"].setValue(
IECore.CompoundObject( {
"bound... |
# -*- coding: utf-8 -*-
"""
Tests for the Shopping Cart Models
"""
import datetime
import StringIO
from textwrap import dedent
import pytz
from django.conf import settings
from mock import patch
from six import text_type
from course_modes.models import CourseMode
from shoppingcart.models import (
CertificateItem,... |
from pida.utils.testing.mock import Mock
from unittest import TestCase
class SkeletonTest(TestCase):
def test_sekeleton(self):
pass
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: |
import sys
from PyQt4 import QtGui
from PyQt4.QtCore import Qt
import _oatr_commons
import _naf_database as nafdb
class cTestsuiteView(QtGui.QWidget):
def __init__(self, parent, model):
super(cTestsuiteView, self).__init__(parent)
self.mapper = QtGui.QDataWidgetMapper()
... |
import xml.etree.ElementTree as XmlElementTree
import subprocess
import httplib2
import tempfile
import settings
import requests
import logging
import json
import os
from extentions import EnumHelper, FileHelper, TextHelper
from signal import signal, SIGINT, SIGTERM, SIGABRT
from pyvona import create_voice as ivona_voi... |
'''
SASMOL: Copyright (C) 2011 Joseph E. Curtis, Ph.D.
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.
... |
#!/usr/bin/env python
"""
Compute homogenized elastic coefficients for a given microstructure.
"""
from __future__ import print_function
from __future__ import absolute_import
from argparse import ArgumentParser
import sys
import six
sys.path.append('.')
import numpy as nm
from sfepy import data_dir
import sfepy.disc... |
from django.conf import settings as django_settings
CONVERTERS = (
'pyston.converters.JSONConverter',
'pyston.converters.XMLConverter',
'pyston.converters.CSVConverter',
'pyston.converters.TXTConverter',
)
DEFAULT_FILENAMES = (
(('pdf', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'txt', 'csv'), ... |
from sqlalchemy import Column, Integer, String, ForeignKey, Boolean
from sqlalchemy.orm import relationship
from inbox.models.backends.imap import ImapAccount
from inbox.models.secret import Secret
PROVIDER = 'generic'
class GenericAccount(ImapAccount):
id = Column(Integer, ForeignKey(ImapAccount.id, ondelete='... |
import pygame, common
from visualizer import Visualizer
from cursor import Cursor
from game import Game
from camera import Camera
from uicontroller import UiController
def main():
pygame.init()
my_font = pygame.font.SysFont("Courier", 16)
screen = pygame.display.set_mode((common.WIDTH, common.HEIGHT), py... |
FILE_PATTERN = "{name}-{partition}-{volume}.data"
BLOCK_SIZE = 1048576 # 1MB
BASE_SYSTEM_SIZE = 0 #TODO (in bytes)
LOG_FILE = "/var/tmp/carbono.log"
EOF = -1
VERSION = (0, 1, 0, "alpha", 0)
def get_version():
version = "%s.%s" % (VERSION[0], VERSION[1])
if VERSION[2]:
version = "%s.%s" % (version, VERS... |
import pytz
import lxml
import dateutil.parser
import datetime
from openstates.utils import LXMLMixin
from pupa.scrape import Scraper, Event
class MAEventScraper(Scraper, LXMLMixin):
_TZ = pytz.timezone("US/Eastern")
date_format = "%m/%d/%Y"
def scrape(self, chamber=None, start=None, end=None):
... |
"""启动调度器"""
import json
import tornado.ioloop
from ..common import Logger, PickleContainer
from ..server import web
from .handlers import packages, workers, projects, buckets, queues
logger = Logger.instance('pyloom')
def parse_configs(configs: dict):
return {
'server': {
'bind': configs.get(... |
import pytest
import attr
from houston.connection import Message
from houston.command import Command, Parameter
from houston.valueRange import DiscreteValueRange
from houston.specification import Idle
from houston.connection import Message
def test_eq():
@attr.s(frozen=True)
class M1(Message):
foo = ... |
import pandas as pd
import numpy as np
from faps.sibshipCluster import sibshipCluster
def summarise_sires(sibships, drop_na=False):
"""
Summarise mating events across maternal families.
This is a wrapper function to call `sibshipCluster.sires()` across
multiple sibshipCluster objects stored in a dict... |
"""Tests for information criteria."""
import robustness_metrics as rm
import tensorflow.compat.v1 as tf
class InformationCriteriaTest(tf.test.TestCase):
def testEnsembleCrossEntropy(self):
"""Checks that ensemble cross entropy lower-bounds Gibbs cross entropy."""
# For multi-class classifications.
bat... |
#pylint: disable=no-init,invalid-name
from __future__ import (absolute_import, division, print_function)
import mantid.simpleapi as msapi
import mantid.api as api
import mantid.kernel as kernel
from mantid import config
import os
EXTENSIONS = [".dat", ".txt"]
INSTRUMENTS = ["ARCS", "BASIS", "CNCS", "SEQUOIA"]
TYPE1 ... |
import os
import sys
import smtplib
import traceback
# python 2.4 does not have email.mime; email.MIMEText is available in 2.6
from email.MIMEText import MIMEText
if 'CONARY_PATH' in os.environ:
sys.path.insert(0, os.environ['CONARY_PATH'])
sys.path.insert(0, os.environ['CONARY_PATH']+"/scripts")
... |
'''This module contains the main object to "execute" a template and
fill in the parameters, call functions etc. The L{TemplateProcessor}
defined here takes care of the template control flow ('IF', 'FOR', etc.).
Also see the L{expression} sub module that contains logic for executing
expressions in the template.
'''
t... |
from taskflow.patterns import linear_flow as flow
from octavia.common import constants
from octavia.controller.worker.v2.flows import l7policy_flows
import octavia.tests.unit.base as base
class TestL7PolicyFlows(base.TestCase):
def setUp(self):
self.L7PolicyFlow = l7policy_flows.L7PolicyFlows()
... |
#!/usr/bin/env python
#
# Field class implementation
import struct
import array
import sys
from air.air_common import *
from iri_exception import *
def field_width_get(field_name, attrs, field_values, remaining_bits=None):
"""
@brief Get the width of a field based on current values
@param field_name The... |
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 21 12:08:08 2015
@author: noore
"""
import os, re, csv
import pandas as pd
import matplotlib
import seaborn as sns
from colorsys import hls_to_rgb
from cycler import cycler
import numpy as np
import matplotlib.pyplot as plt
from collections import OrderedDict
import defin... |
#!/usr/bin/python
'''
Create overview comparison table beween different GCxxx chips on different platforms.
The input data is specified in JSON format, the output is in HTML.
'''
# Copyright (c) 2012-2013 Wladimir J. van der Laan
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of thi... |
import os
import logging
import socket
import requests
from flask import Flask, Response, jsonify
import json
app = Flask(__name__)
app.config['JSONIFY_PRETTYPRINT_REGULAR'] = False
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
logger.addHandler(logging.StreamHandler())
hostname = sock... |
from twisted.python import log
from twisted.python.log import logging
from twisted.protocols.basic import LineReceiver
from twisted.internet import error
from twisted.internet.defer import Deferred, inlineCallbacks, returnValue
from foneworx.errors import FoneworxException
from foneworx.utils import *
class FoneworxPr... |
"""Contains classes/functions related to Google Cloud Storage."""
import logging
import ntpath
import os
import posixpath
import re
from absl import flags
from perfkitbenchmarker import errors
from perfkitbenchmarker import linux_packages
from perfkitbenchmarker import object_storage_service
from perfkitbenchmarker i... |
import numpy as np
from MDAnalysis import *
import sys, os
import csv
from collections import defaultdict
# my_path = os.getcwd() + "/"
mySetups = ["init_nochm_full","init_chm_full","init_chm_fullfixedCHM","init_chm_fullfixedGC"]
my_path = "/home/scratch/mosaics/arm/dna/schofield/fixed_tors/"
os.chdir(my_path)
myBigF... |
import pytest
from fixture.application import Application
from fixture.db import DbFixture
import json
import os.path
import importlib
import jsonpickle
fixture = None
target = None
def load_config(file):
global target
if target is None:
config_file = os.path.join(os.path.dirname(os.path.abspath(__fil... |
import zstackwoodpecker.test_state as ts_header
import os
TestAction = ts_header.TestAction
def path():
return dict(initial_formation="template5", checking_point=8, path_list=[
[TestAction.create_vm, 'vm1', ],
[TestAction.create_volume, 'volume1', 'flag=scsi'],
[TestAction.attach_volume, 'vm1', 'volume1'],
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.