content string |
|---|
# Import the HARK library. The assumption is that this code is in a folder
# contained in the HARK folder.
import sys
sys.path.insert(0,'../')
import SetupConsumerParameters as Params
import ConsumptionSavingModel as Model
import SetupSCFdata as Data
from HARKsimulation import drawDiscrete
from HARKestimation impor... |
#!/bin/python
# -*- coding: utf-8 -*-
import psycopg2
from itertools import combinations
import os
import time
import sys
# db credentials
dbHost = "localhost"
dbName = "myDBName"
dbUser = "myUser"
dbPass = "myPassword"
con = None
start_time = time.time()
try:
con = psycopg2.connect(host=dbHost, database=dbNam... |
from os.path import join
import os
import numpy as n
import glob
import sys
import time
import astropy.io.fits as fits
env = os.environ['EBOSSDR14_DIR']
path_2_file = join(env, "catalogs", "spAll-v5_10_0.fits")
data = fits.open(path_2_file)[1].data
selection = (data['ZWARNING_NOQSO']==0) & (data['CLASS_NOQSO']=="GAL... |
from setuptools import setup
from mimir import __version__
# Make sure 'twisted' doesn't appear in top_level.txt
try:
from setuptools.command import egg_info
egg_info.write_toplevel_names
except (ImportError, AttributeError):
pass
else:
def _top_level_package(name):
return name.split('.', 1)[0... |
import numpy as np
from astropy import units as u
from ..util import alinspace
from .angles import E_to_nu, nu_to_E
@u.quantity_input(min_nu=u.rad, ecc=u.one, max_nu=u.rad)
def sample_closed(min_nu, ecc, max_nu=None, num_values=100):
"""Sample a closed orbit
If ``max_nu`` is given, the sampling interval wil... |
"""
This package contains classes necessary for input parsing OGC WPS requests,
working with list of processes, executing them and redirecting OGC WPS
responses back to client.
example how to use this module::
import sys
request="service=wps&request=getcapabilities"
wps = Pywps(pywps.METHOD_GET)
if... |
from bs4 import BeautifulSoup
import math
import os
from .colorgradient import linear_gradient
def choropleth(map_type, data, min_val, max_val, base_color, steps):
'''
Parse svg map and set initial style
'''
svg_path = os.path.dirname(__file__)+'/svg/%s.svg' % map_type
svg = open(svg_path, 'r',).... |
#!/usr/bin/env python
from distutils.log import warn as printf
from os.path import dirname
from random import randrange as rand
from sqlobject import *
from ushuffle_dbU import DBNAME, NAMELEN, randName, FIELDS, tformat, cformat, setup
DSNs = {
'mysql': 'mysql://root@localhost/%s' % DBNAME,
'sqlite... |
"""
This module contains AWS S3 operators.
"""
from typing import Optional
from airflow.models import BaseOperator
from airflow.providers.amazon.aws.hooks.s3 import S3Hook
class S3CreateBucketOperator(BaseOperator):
"""
This operator creates an S3 bucket
:param bucket_name: This is bucket name you want ... |
XXXXXXXXX XXXXX
XXXXXX
XXXXXX
XXXXX XXXXXXXXXXXXXXXX
XXXXX XXXXXXXXXXXXX XXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX XXXXXXX X XXX XXXXXXXXX X XXXXXX XXX XXXXXXXXXXXXXX
XXXXX XXXXXXXXXXXXXXXX XXXXXXXXX... |
# coding: utf-8
"""
MINDBODY Public API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: v6
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
impo... |
"""
Test builders
"""
import unittest
from mc.builders import DockerRunner
from werkzeug.security import gen_salt
class TestDockerRunner(unittest.TestCase):
"""
Test the docker runner
"""
def setUp(self):
self.name = 'livetest-redis-{}'.format(gen_salt(5))
self.builder = DockerRunner(... |
# _*_ encoding: utf-8 _*_
import pytest
@pytest.fixture()
def full_trie():
from trie import Trie
new_trie = Trie()
new_trie.insert('words')
new_trie.insert('trie')
new_trie.insert('trip')
new_trie.insert('in')
new_trie.insert('i')
new_trie.insert('worldly')
return new_trie
def te... |
import re #To perform the search and replace.
from ..Script import Script
class ColorMix(Script):
def __init__(self):
super().__init__()
def getSettingDataString(self):
return """{
"name":"ColorMix 2-1 V1.2.1",
"key":"ColorMix 2-1",
"metadata": {},
... |
# Benjamin Chu
# Python Script - Test Case #3
# Using the World of Warcraft Item Set Web API,
# retrieve data for 'Finkle's Lava Dredger' 10,000+
# times to confirm throttling.
import requests
import json
item_id = 18803 # Finkle's Lava Dredger Item ID
# API Urls for individual regions
api_us_url = "http://us.battl... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'clicking.ui'
import sip,os
os.environ['QT_API'] = 'pyqt'
sip.setapi("QString", 2)
sip.setapi("QVariant", 2)
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
... |
import os
import sys
import django
from django.conf import settings
from coverage import coverage
from termcolor import colored
cov = coverage(config_file=True)
cov.erase()
cov.start()
TESTS_THRESHOLD = 100
TESTS_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
settings.configure(
TIME_ZONE='... |
import hmac
import stat
import time
import os.path
import hashlib
import logging
import optparse
import urllib
import urlparse
import httplib as http
from wsgiref.simple_server import make_server
class WSGIApp(object):
def simple_response(self, code, headers=None, body=None):
status = '%d %s' % (cod... |
from __future__ import print_function
from setuptools import setup, find_packages
import io
import os
import synnefo_ssh
here = os.path.abspath(os.path.dirname(__file__))
def read(*filenames, **kwargs):
encoding = kwargs.get('encoding', 'utf-8')
sep = kwargs.get('sep', '\n')
buf = []
for filename in... |
# -*- encoding: utf-8 -*-
from wx.combo import BitmapComboBox
iconDir = APPDIR+"icons/logo.png"
#Окно
PaintFrame = Frame(None, ID_ANY, "Графический редактор")
PaintFrame.Center()
PaintFrame.SetSize(Size(800, 600))
PaintFrame.Show(True)
PaintFrame.SetBackgroundColour(Colour(255, 255, 255))
PaintFrame.SetIcon(Icon(icon... |
"""
Colour-related utilities
"""
from collections import namedtuple
import curses
from enum import Enum
import sys
Colour = namedtuple('Colour', ('red', 'green', 'blue', 'alpha'))
MAX_VALUE = 255
BACKGROUND = Colour(MAX_VALUE, MAX_VALUE, MAX_VALUE, 0)
BRIGHTNESS_THRESHOLD = 333
ANSI_BLACK = 0
ANSI_WHITE = 15
# T... |
#!/usr/local/bin/python2
# Solution.b
import abc
import math
class Shape(object):
"""
Shape abstract base class.
"""
__metaclass__ = abc.ABCMeta
"""
=====================================================================
Place your shape functions here. The functions needed are:
tr... |
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.db import models
class Group(models.Model):
"""
Store a group of students in a class.
Note that this model is unrelated to django.contrib.auth.models.Group
"""
title = models.CharField('Title', m... |
#!/usr/bin/python3
import subprocess, shutil, os, sqlite3, re
import utils
from email_validator import validate_email as validate_email_, EmailNotValidError
def validate_email(email, mode=None):
# Checks that an email address is syntactically valid. Returns True/False.
# Until Postfix supports SMTPUTF8, an email ad... |
#encoding: utf-8
from hashlib import sha1
from random import randint
from struct import pack, unpack
from exceptions import HashError
def entropy(bytes):
"""随机生成字符串"""
s = ""
for i in range(bytes):
s += chr(randint(0, 255))
return s
def intify(hstr):
"""把20字节的hash值转换为数字"""
... |
# generates documentation based on configuration file
import json
import copy
import route
# information shown as:
# comment
# url
# command
# recv
# send
# dict, _model_<model>, _list_model_<model>
def concDict(d1,d2,fullDict,name):
if isinstance(d2,str) or isinstance(d2,unicode):
models = fullDict['_models']
... |
from test_env import TestEnv
class TestSet(TestEnv):
def test_cpy_constructor(self):
code="""
def are_equal(s1):
s2 = set(s1)
return s2 == s1
"""
self.run_test(code, {'jack', 'sjoerd'}, are_equal=[{str}])
def test_in(self):
self.run_test("def _in(a,b):\n return b in a", {'aze',... |
import pytest
from petra.annotation import Vars, Expr
from petra.net import Net
from petra.place import Place
from petra.transition import Transition
@pytest.fixture
def place_name():
return "place_0"
@pytest.fixture
def transition_name():
return "transition_0"
@pytest.fixture
def place(place_name):
ret... |
from __future__ import (nested_scopes, generators, division, absolute_import, with_statement,
print_function, unicode_literals)
from collections import defaultdict
from contextlib import closing
import os
from zipfile import ZipFile
from pex.compatibility import to_bytes
from pants.backend.jv... |
#pylint: disable=invalid-name, too-few-public-methods, too-many-public-methods
#pylint: disable=protected-access, missing-docstring, too-many-locals
#pylint: disable=too-many-arguments
#pylint: disable=deprecated-method
from __future__ import print_function, absolute_import, division
from test.consam_test.writers_test... |
"""
"""
from __future__ import absolute_import
import re
import xml.etree.ElementTree as ET
import poioapi.io.graf
class Parser(poioapi.io.graf.BaseParser):
def __init__(self, filepath):
"""Class's constructor.
Parameters
----------
filepath : str
Path of the Too... |
# Django settings for mysite1 project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', '<EMAIL>'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': '', # Or... |
from django.core.serializers.json import Serializer, Deserializer
from django.db import models
class Manager(models.Manager):
def get_query_set(self):
return FakeQuerySet(self.model, using=self._db)
class FakeQuerySet(models.query.EmptyQuerySet):
"""Faked QuerySet that always treats itself as evalua... |
from __future__ import division, absolute_import, print_function
import sys
from numpy.core import arange
from numpy.testing import *
import numpy.lib.utils as utils
from numpy.lib import deprecate
if sys.version_info[0] >= 3:
from io import StringIO
else:
from StringIO import StringIO
def test_lookfor():
... |
from scrapy.spiders import Spider
from projects.zuishushenqi.zuishushenqi.items import XiaoShuoListItem
import json
import urlparse
from urllib import unquote,quote
class CatList(Spider):
name = "CatList"
allowed_domains = ["zhuishushenqi.com"]
def setHeader(self,r):
r.headers.setdefault("X-User... |
from kombu import Exchange, Queue
geoserver_exchange = Exchange("geonode", type="topic", durable=False)
queue_all_events = Queue("broadcast", geoserver_exchange, routing_key="#")
queue_email_events = Queue("email.events", geoserver_exchange, routing_key="email")
queue_geoserver = Queue("all.geoserver", geoserver_exch... |
"""websocket handler
Loads the UMFRouter and registers our sample message handlers.
Also sets up the handling of each websocket and passes messages onto the
umf_router as they're received.
"""
__author__ = 'carlosjustiniano'
import json
import random
import message
from umf.umf_router import UMFRouter
from umf.umf_me... |
from beritest_tools import BaseBERITestCase
class test_addiu_overflow(BaseBERITestCase):
def test_handled(self):
self.assertRegisterEqual(self.MIPS.a2, 0, "addiu triggered overflow exception") |
import os
import argparse
import windows
import windows.test
import windows.generated_def as gdef
from windows.debug import symbols
parser = argparse.ArgumentParser(prog=__file__, formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('--dbghelp', help='The path of DBG help to use (default use e... |
from PyQt4 import QtGui, QtCore
from selectFeaturesUI import Ui_SelectFeatureDlg
class SelectFeaturesDlg(QtGui.QDialog):
def __init__(self, statsTestResults, parent=None):
QtGui.QWidget.__init__(self, parent)
# initialize GUI
self.ui = Ui_SelectFeatureDlg()
self.ui.setupUi(self)
self.... |
import logging
import logging.handlers
import os
import sys
import warnings
from logging import getLogger, StreamHandler
class ColorFormatter(logging.Formatter):
"""Logging formatter adding console colors to the output."""
black, red, green, yellow, blue, magenta, cyan, white = range(8)
colors = {
... |
import requests
import base64
class StannpClient():
def __init__( self, api_key ):
self.api_key = api_key
def perform_request( self, endpoint_url, payload=None ):
r = requests.post( endpoint_url, data=payload, auth=(self.api_key,"") )
return r.json()
def get_balance( self ):
... |
import numpy as np
from numpy import array
from explauto.exceptions import ExplautoBootstrapError
from explauto.sensorimotor_model.non_parametric import NonParametric
from explauto.utils import bounds_min_max
from explauto.utils import rand_bounds
class DemonstrableNN(NonParametric):
def __init__(self, conf, sigm... |
import logging
from .peakslib import *
logger = logging.getLogger('main.chk.cab..')
logger.debug("init logger")
def check_for_cable_reflection(data, band, pol, parset):
"""
:param data: recorded antenna data data
:param band: band to check
:param pol: polarity to check
:param parset: parameterset ... |
from __init__ import encrypt, decrypt
import getpass, argparse
parser = argparse.ArgumentParser(description='Encrypt or decrypt a message using Emage')
parser.add_argument('-e','--encrypt', help='set mode to encrypt', action='store_true', required=False)
parser.add_argument('-m','--message', help='the message you want... |
import urllib
import datetime
from weboob.capabilities.base import NotAvailable
from weboob.tools.misc import to_unicode
from weboob.tools.browser import BasePage
from weboob.tools.browser import BrokenPageError
from weboob.tools.browser import BaseBrowser
from weboob.tools.browser.decorators import id2url
from weboob.... |
# coding=utf-8
"""thumbnail.py - Thumbnail module for Comix implementing (most of) the
freedesktop.org "standard" at http://jens.triq.net/thumbnail-spec/
Only normal size (i.e. 128x128 px) thumbnails are supported.
"""
from __future__ import absolute_import
import os
import re
import shutil
import tempfile
from hashl... |
from datetime import datetime, timedelta
import numpy as np
import pytest
import pandas as pd
from pandas import (
Categorical,
DataFrame,
Index,
MultiIndex,
Series,
date_range,
option_context,
period_range,
timedelta_range,
)
import pandas._testing as tm
class TestSeriesRepr:
... |
#!/usr/bin/python
from __future__ import division #Avoid division problems in Python 2
import sys
import math
import zlib
import base64
import pyaudio
PyAudio = pyaudio.PyAudio
BITRATE = 14400
RATE = 16000
class Exfiltrator():
def __init__(self, file_path):
self.file_path = file_path
self.PyAud... |
"tsv_creator.py - Get tsv file for UCSC genome browser track(special mission)"
import argparse
from flask import Flask, render_template, url_for
import json
import requests
requests.packages.urllib3.disable_warnings()
import sys
import time
import civic_api_client
import utils
from variants_lister import VariantsList... |
import os
import unittest
from nose.plugins.attrib import attr
from conans.model.info import ConanInfo
from conans.model.ref import ConanFileReference
from conans.paths import BUILD_INFO_CMAKE, CONANINFO
from conans.test.utils.cpp_test_files import cpp_hello_conan_files
from conans.test.utils.tools import NO_SETTINGS... |
__title__ = "FreeCAD FEM mesh boundary layer ViewProvider for the document object"
__author__ = "Bernd Hahnebach, Qingfeng Xia"
__url__ = "https://www.freecadweb.org"
## @package view_mesh_boundarylayer
# \ingroup FEM
# \brief view provider for mesh boundary object
from femtaskpanels import task_mesh_boundarylayer
... |
#!/usr/bin/env python
import sys
import os.path
import tempfile
import gtk
import gtk.glade
import pango
import random
import traceback
import thread
import getopt
import conduit
from conduit.Database import GenericDB,ThreadSafeGenericDB
from conduit.gtkui.Database import GenericDBListStore
class Tester(object):
... |
# encoding: utf-8
from django.utils import timezone
from time import time
import datetime
from django.db import models
class Brigade(models.Model):
brigade_title = models.CharField(max_length=200)
pub_date = models.DateTimeField('Datum publikování', default=timezone.now())
def __unicode__(self): ... |
# MenuTitle: Toggle enumerate node (from first to last)
# -*- coding: utf-8 -*-
from __future__ import division, print_function, unicode_literals
__doc__ = """
Toggle between with or without names in nodes by running the script and then pressing OPT + CMD + R.
Please note that the enumeration follows the contours dir... |
import pickle
import osv
import pooler
def ir_set(cr, uid, key, key2, name, models, value, replace=True, isobject=False, meta=None):
obj = pooler.get_pool(cr.dbname).get('ir.values')
return obj.set(cr, uid, key, key2, name, models, value, replace, isobject, meta)
def ir_del(cr, uid, id):
obj = pooler.get_... |
"""
RPC server and client implementation.
"""
import logging
from threading import Thread
from xmlrpc.server import SimpleXMLRPCServer
from xmlrpc.client import ServerProxy
class RPCServer(object):
"""
An aynchronous RPC server.
"""
def __init__(self, port, context):
self.__running = False
... |
#!/usr/bin/env python2.7
import unittest
import logging
from time import sleep
from multiprocessing import Lock
from SiddhiCEP3.core.query.output.callback.QueryCallback import QueryCallback
from SiddhiCEP3.core.util.EventPrinter import PrintEvent
logging.basicConfig(level=logging.INFO)
from SiddhiCEP3.DataTypes.L... |
"""Tests for Infoblox Plugin
:Requirement: Infoblox
:CaseLevel: System
:CaseComponent: Infobloxintegration
:TestType: Functional
:CaseImportance: High
:Upstream: No
"""
import pytest
from robottelo.decorators import tier3
from robottelo.decorators import upgrade
from robottelo.test import TestCase
class Infobl... |
from enum import Enum, unique
from pykickstart.constants import AUTOPART_TYPE_PLAIN, AUTOPART_TYPE_BTRFS, AUTOPART_TYPE_LVM, \
AUTOPART_TYPE_LVM_THINP
from pyanaconda.core.constants import CLEAR_PARTITIONS_NONE, CLEAR_PARTITIONS_ALL, \
CLEAR_PARTITIONS_LIST, CLEAR_PARTITIONS_LINUX, CLEAR_PARTITIONS_DEFAULT, B... |
#!/usr/bin/env python
#
# By Reynaldo R. Martinez P.
# Sept 23, 2016
# TigerLinux AT Gmail DOT Com
# Buttons and Message BOXES arrangment - basic
#
#
import sys
if sys.version_info.major == 2:
# from Tkinter import Button, mainloop
# import Tkinter as tkinter
from Tkinter import *
else:
# from tkinte... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Update encrypted deploy password in Travis config file
"""
from __future__ import print_function
import base64
import json
import os
from getpass import getpass
import yaml
from cryptography.hazmat.primitives.serialization import load_pem_public_key
from cryptography.h... |
from django.test import TestCase
from easy_test.metas.meta_model import ModelMeta
from easy_test.util import contains_option
class ModelTest(TestCase, metaclass=ModelMeta):
def setUp(self):
if not self._concrete:
return
self.obj = self._meta.obj.save()
def test_create(self):
... |
"""
Tests for miscellaneous functionality in the `funcs` module
"""
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import numpy as np
from numpy import testing as npt
from ...tests.helper import pytest
from ...extern import six
from ... import units as u... |
import GangaCore.Utility.logging
from GangaCore.GPIDev.Base.Proxy import stripProxy
from GangaCore.GPIDev.Base.Objects import GangaObject
from GangaCore.GPIDev.Schema import Schema, SimpleItem, Version
from GangaCore.GPIDev.Lib.GangaList.GangaList import makeGangaList
from GangaCore.Core.GangaRepository.Registry import... |
import xml.etree.ElementTree as ET
import xml.dom.minidom
from pathoscope.pathodb import dbUtils
class Gene:
value = ""
protein_id = ""
locus_tag = ""
product = ""
ref_name = ""
def __init__(self, value):
self.value = value
def buildElement(self):
root = ET.Element("gene")
if self.protein_id:
root.set(... |
"""
Searchcode (It)
@website https://searchcode.com/
@provide-api yes (https://searchcode.com/api/)
@using-api yes
@results JSON
@stable yes
@parse url, title, content
"""
from urllib import urlencode
from json import loads
# engine dependent config
categories = ['it']
paging = True
# s... |
import logging
import pytest
from src.piece import Color
from src.game import Game
from src.position import Position, Square
from src.util import to_algebraic, to_numeric
from tst.util import InvalidMoveException
from tst.util import DidNotFindAllLegalMovesException
from tst.standard_starting_position_data import pos... |
'''
New Simulator Test for VPC SNAT
@author: Hengguo Ge
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.operations.vpc_operations as vpc_ops
import os
test_stub = test_lib.lib_get_test_stub()
tes... |
from math import sqrt
def coll_lines( ((x11,y11), (x12,y12)), ((x21,y21), (x22,y22)) ):
"""Get intersection of two lines.
Line 1: ((x11,y11), (x12,y12)), Line 2: ((x21,y21), (x22,y22))
Returns intersection point or None in case of no intersection."""
# make sure points are sorted by x
if x11>x12: ... |
#!/usr/bin/env python
from Unsatisfactory import *
def c_slugify( name ):
return name.replace( " ", "_" ).replace( "-", "_" )
def c_gensym( entry ):
if isinstance( entry, TransientEvent ):
return "engine->EVENT_%s" % c_slugify( entry.name )
if isinstance( entry, State ):
return "engine->STATE_%s" % c_s... |
import socket
import contextlib
from collections import namedtuple
from datetime import datetime
import logging
from backports.functools_lru_cache import lru_cache
from .tools import retry
log = logging.getLogger(__name__)
Bar = namedtuple('IQFeedBar', ['datetime', 'open', 'high', 'low', 'close', 'volume'])
def _... |
{'name': 'Check Availability after Inventories',
'version': '1.0',
'depends': ['stock',
'procurement',
],
'author': "Camptocamp",
'description': """
Check again availability of delivery orders after inventories
=============================================================
When an inventor... |
"""
Installer for KBase narrative Python libraries
"""
import glob
import re
import sys
import ez_setup
ez_setup.use_setuptools()
from setuptools import setup, find_packages
# added command classes
from biokbase.narrative.common.util import BuildDocumentation
long_desc = "This Python package contains all the KBase Pyt... |
from nrs import fileform
import os
import utils
def test_findheader_not_found():
# Header should not be found in non-nsisi files.
with open(os.path.join(utils.SAMPLES_DIR, 'empty'), 'rb') as empty:
assert fileform._find_firstheader(empty) is None
def test_findheader_found():
# Header found in NSIS... |
#!/usr/bin/env python
from datasets import cp
from datasets import variables
from datasets import Camera
def loaddataset():
setglobalvariables()
loadcameras()
return getcameras(), loadconfiguration()
def setglobalvariables():
variables.current_dataset_path = variables.datasets_path + '/caviar'
... |
import os
from starcluster import node
from starcluster import volume
from starcluster import static
from starcluster import exception
from base import CmdBase
class CmdCreateVolume(CmdBase):
"""
createvolume [options] <volume_size> <volume_zone>
Create a new EBS volume for use with StarCluster
"""... |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Activity'
db.create_table(u'activity_activity', (
(u'id', self.gf('django.db.mod... |
"""
Configuration tags for the rbf.ini file.
"""
import os
import json
import logging
class Config:
"""
class to gather all configuration read from the .ini config file
the path/name of the file is given by the environment variable RBFINI, otherwise
taken from the current directory
:param env:... |
"""
Kill Bill
Kill Bill is an open-source billing and payments platform # noqa: E501
OpenAPI spec version: 0.22.22-SNAPSHOT
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class Tenant(object):
"""NOTE: This class is... |
from node import nullid, bin, hex, short
from i18n import _
import encoding
import error
import errno
def findglobaltags(ui, repo, alltags, tagtypes):
'''Find global tags in repo by reading .hgtags from every head that
has a distinct version of it, using a cache to avoid excess work.
Updates the dicts allt... |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
import sys
import os
from distutils.core import setup, Extension
import numpy
import sipdistutils
import PyQt4.pyqtconfig
config = PyQt4.pyqtconfig.Configuration()
#-- PyQt4 library configuration
# R... |
# pylint: disable=too-many-arguments, too-many-locals, too-many-instance-attributes
"""`SequentialModule` is a container module that chains a number of modules together."""
import logging
import copy
from ..initializer import Uniform
from .base_module import BaseModule
class SequentialModule(BaseModule):
"""A S... |
#!/usr/bin/env python
r"""
autosummary_generate.py OPTIONS FILES
Generate automatic RST source files for items referred to in
autosummary:: directives.
Each generated RST file contains a single auto*:: directive which
extracts the docstring of the referred item.
Example Makefile rule::
generate:
./e... |
from __future__ import absolute_import, division, print_function, unicode_literals
from pants.build_graph.intermediate_target_factory import IntermediateTargetFactoryBase
class IntransitiveDependencyFactory(IntermediateTargetFactoryBase):
"""Creates a dependency which is intransitive.
This dependency will not b... |
import multiprocessing.pool
import json
import socket
import time
from iresponsible.lib import util
class IResponsibleDaemon(object):
def __init__(self, hostname, port):
self.pool = multiprocessing.pool.ThreadPool(1)
self.port = port
self.hostname = hostname
self.sock = socket.sock... |
import networkx
from solar.core.log import log
from solar.events.api import add_events
from solar.events.controls import Dependency
from solar.interfaces import orm
def guess_mapping(emitter, receiver):
"""Guess connection mapping between emitter and receiver.
Suppose emitter and receiver have common inputs... |
__source__ = 'https://leetcode.com/problems/minimum-cost-to-hire-k-workers/'
# Time: O(NlogN) sorting, PQ
# Space: O(N)
#
# Description: Leetcode # 857. Minimum Cost to Hire K Workers
#
# There are N workers. The i-th worker has a quality[i] and a minimum wage expectation wage[i].
# Now we want to hire exactly K work... |
import matplotlib.pyplot as plt
import pickle
import datetime, time
import threading
class ParetoPlot():
def __init__(self):
self.work = False
self.limx = None
self.limy = None
self.file = 'moga.dat'
self.x = []
self.y = []
self.xnd = []
self.ynd ... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import app_data.fields
import ella.photos.models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('sites', '0001_initial'),
('core', '0001_initial'),
... |
from django.db import models
from django.core.validators import MaxValueValidator, MinValueValidator
class Blog(models.Model):
name = models.CharField(max_length=100)
tagline = models.TextField()
def __str__(self): # __unicode__ on Python 2
return self.name
class Author(models.Model... |
# $Id: ImportManager.py,v 1.6 2007/04/03 01:56:24 tavis_rudd Exp $
"""Provides an emulator/replacement for Python's standard import system.
@@TR: Be warned that Import Hooks are in the deepest, darkest corner of Python's
jungle. If you need to start hacking with this, be prepared to get lost for a
while. Also note, ... |
import uuid
from mock import Mock
from mock import patch
from trove.cluster.models import Cluster
from trove.cluster.models import ClusterTasks
from trove.cluster.models import DBCluster
from trove.common import cfg
from trove.common import exception
from trove.common import remote
from trove.common.strategies.cluster... |
__metaclass__ = type
import sys
class AnnotateColorMap:
really_old_color = "#0046FF"
colors = {
20.: "#FF0000",
40.: "#FF3800",
60.: "#FF7000",
80.: "#FFA800",
100.:"#FFE000",
120.:"#E7FF00",
140.:"#AFFF00",
160.:"#77FF00",
180.:"#3FFF... |
import os
import re
try:
from setuptools import setup, find_packages
except ImportError:
from distutils.core import setup
def get_version(package):
"""
Return package version as listed in `__version__` in `init.py`.
"""
init_py = open(os.path.join(package, '__init__.py')).read()
return re... |
'''
@author Emad Ehsan
1. Picks up a line from sourceLang file, e.g. './en/strings.txt'
2. Request google to translate the query
3. Creates a file for targetLang, e.g. './ur/strings.txt'
4. Places translation at exact line number to targetLang file
'''
from html.parser import HTMLParser
import requ... |
import io
import linecache
import queue
import sys
import time
import traceback
import _thread as thread
import threading
import warnings
import tkinter # Tcl, deletions, messagebox if startup fails
from idlelib import autocomplete # AutoComplete, fetch_encodings
from idlelib import calltips # CallTips
from idleli... |
# Low-level execution of AST commands using xdotool.
import os, platform
from spark import GenericASTTraversal
from automators import XDoAutomator, CLIClickAutomator, NirCmdAutomator
class ExecuteCommands(GenericASTTraversal):
def __init__(self, ast, real = True):
GenericASTTraversal.__init__(self, ast)
... |
# coding=utf-8
"""
Some generic utilities
"""
"""
Copyright 2012-2014 Anthony Beville
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless require... |
# Configuration file for Sphinx,
# see https://www.sphinx-doc.org/en/master/usage/configuration.html
import sys
import os
from subprocess import check_output
sys.path.insert(0, os.path.abspath('../src'))
sys.path.insert(0, os.path.abspath('.'))
# Fake import to avoid actually loading CFFI and the JACK library
import... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.