code stringlengths 1 199k |
|---|
import cv2
import numpy as np
import datetime as dt
faceCascade = cv2.CascadeClassifier('haarcascade_frontalface_alt.xml')
OPENCV_METHODS = {
"Correlation": 0,
"Chi-Squared": 1,
"Intersection": 2,
"Hellinger": 3}
hist_limit = 0.6
ttl = 1 * 60
q_limit = 3
total_count = 0
prev_count = 0
total_delta = 0
st... |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.home, name='home'),
url(r'^clients/$', views.clients, name='clients'),
url(r'^clients/(?P<id>\d+)/$', views.client_detail, name='client_detail'),
url(r'^clients/new/$', views.client_new, name='client_new'),
url(r'^... |
from __future__ import division, print_function, absolute_import
import unittest
from .. import common
import tempfile
import os
import platform
import numpy as num
from pyrocko import util, model
from pyrocko.pile import make_pile
from pyrocko import config, trace
if common.have_gui(): # noqa
from pyrocko.gui.qt_... |
class InvalidAge(Exception):
def __init__(self,age):
self.age = age
def validate_age(age):
if age < 18:
raise InvalidAge(age)
else:
return "Welcome to the movies!!"
age = int(raw_input("please enter your age:"))
try:
validate_age(age)
except InvalidAge as e:
print "Buddy!! you are very young at {}!! Grow up... |
"""A binary to train CIFAR-10 using a single GPU.
Accuracy:
cifar10_train.py achieves ~86% accuracy after 100K steps (256 epochs of
data) as judged by cifar10_eval.py.
Speed: With batch_size 128.
System | Step Time (sec/batch) | Accuracy
------------------------------------------------------------------
1 T... |
from django.apps import AppConfig
class CirculoConfig(AppConfig):
name = 'circulo' |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('scoping', '0294_titlevecmodel'),
]
operations = [
migrations.AddField(
model_name='doc',
name='tslug',
field=models.TextField(null=True),
),
] |
"""autogenerated by genpy from tf2_msgs/FrameGraphRequest.msg. Do not edit."""
import sys
python3 = True if sys.hexversion > 0x03000000 else False
import genpy
import struct
class FrameGraphRequest(genpy.Message):
_md5sum = "d41d8cd98f00b204e9800998ecf8427e"
_type = "tf2_msgs/FrameGraphRequest"
_has_header = Fals... |
import re
CJDNS_IP_REGEX = re.compile(r'^fc[0-9a-f]{2}(:[0-9a-f]{4}){7}$', re.IGNORECASE)
class Node(object):
def __init__(self, ip, version=None, label=None):
if not valid_cjdns_ip(ip):
raise ValueError('Invalid IP address')
if not valid_version(version):
raise ValueError('I... |
import gettext
_ = gettext.gettext
from gi.repository import Gtk
class Console(Gtk.Window):
def __init__(self):
super(Console, self).__init__()
sw = Gtk.ScrolledWindow()
sw.set_policy(
Gtk.PolicyType.AUTOMATIC,
Gtk.PolicyType.AUTOMATIC
)
self.textview ... |
import numpy as np
import matplotlib.pyplot as plt
import spm1d
dataset = spm1d.data.mv1d.cca.Dorn2012()
y,x = dataset.get_data() #A:slow, B:fast
np.random.seed(0)
alpha = 0.05
two_tailed = False
snpm = spm1d.stats.nonparam.cca(y, x)
snpmi = snpm.inference(alpha, iterations=100)
print( sn... |
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 field 'Question.order'
db.add_column(u'survey_question', 'order',
self.gf('django.db.models.fields.Integ... |
from gnuradio import blocks
from gnuradio import filter
from gnuradio import gr
from gnuradio.filter import firdes
import grgsm
import math
class clock_offset_corrector(gr.hier_block2):
def __init__(self, fc=936.6e6, ppm=0, samp_rate_in=1625000.0/6.0*4.0):
gr.hier_block2.__init__(
self, "Clock o... |
import numpy as np
mdir = "mesh3d/"
fname = "out_p6-p4-p8"
print "input mesh data file"
f1 = open(mdir+fname+".mesh", 'r')
for line in f1:
if line.startswith("Vertices"): break
pcount = int(f1.next())
xyz = np.empty((pcount, 3), dtype=np.float)
for t in range(pcount):
xyz[t] = map(float,f1.next().split()[0:3])
for ... |
from shapely.geometry import Point
from geocoon.sql import read_sql
from geocoon.core import GeoDataFrame, PointSeries
import unittest
from unittest import mock
class SQLTestCase(unittest.TestCase):
"""
Test SQL GeoCoon SQL routines.
"""
@mock.patch('pandas.io.sql.read_sql')
def test_read_sql(self, ... |
import csv
import decimal
import os
import datetime
from stocker.common.events import EventStreamNew, EventStockOpen, EventStockClose
from stocker.common.orders import OrderBuy, OrderSell
from stocker.common.utils import Stream
class CompanyProcessor(object):
def __init__(self, dirname, company_id):
self.di... |
import sys
sys.path.append('../')
from toolbox.hreaders import token_readers as reader
from toolbox.hreducers import list_reducer as reducer
SOLO_FACTURA = False
def reduction(x,y):
v1 = x.split(',')
v2 = y.split(',')
r = x if int(v1[1])>=int(v2[1]) else y
return r
_reader = reader.Token_reader("\t",1)
... |
from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, PageBreak
from reportlab.lib.styles import getSampleStyleSheet
from reportlab.rl_config import defaultPageSize
from reportlab.lib.units import cm
import operator
import os
import ConfigParser
import string
config = ConfigParser.Conf... |
r"""
csection.py -- Create a tree of contents, organized by sections and inside
sections the exercises unique_name.
AUTHOR:
- Pedro Cruz (2012-01): initial version
- Pedro Cruz (2016-03): improvment for smc
An exercise could contain um its %summary tag line a description of section
in form::
%sumary sect... |
import struct
import re
import time
import logging
from chirp import chirp_common, errors, util, memmap
from chirp.settings import RadioSetting, RadioSettingGroup, \
RadioSettingValueBoolean, RadioSettings
LOG = logging.getLogger(__name__)
CMD_CLONE_OUT = 0xE2
CMD_CLONE_IN = 0xE3
CMD_CLONE_DAT = 0xE4
CMD_CLONE_END ... |
import pygame
class EzMenu:
def __init__(self, *options):
self.options = options
self.x = 0
self.y = 0
self.font = pygame.font.Font(None, 32)
self.option = 0
self.width = 1
self.color = [0, 0, 0]
self.hcolor = [255, 0, 0]
self.height = len(self... |
"""
WSGI config for GoodDog project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_... |
"""Keywords (from "graminit.c")
This file is automatically generated; please don't muck it up!
To update the symbols in this file, 'cd' to the top directory of
the python source tree after building the interpreter and run:
python Lib/keyword.py
"""
__all__ = ["iskeyword", "kwlist"]
kwlist = [
'and',
... |
default_app_config = 'users.apps.UserConfig' |
"""Calculate exact solutions for the zero dimensional LLG as given by
[Mallinson2000]
"""
from __future__ import division
from __future__ import absolute_import
from math import sin, cos, tan, log, atan2, acos, pi, sqrt
import scipy as sp
import matplotlib.pyplot as plt
import functools as ft
import simpleode.core.util... |
class Sbs:
def __init__(self, sbsFilename, sbc_filename, newSbsFilename):
import xml.etree.ElementTree as ET
import Sbc
self.mySbc = Sbc.Sbc(sbc_filename)
self.sbsTree = ET.parse(sbsFilename)
self.sbsRoot = self.sbsTree.getroot()
self.XSI_TYPE = "{http://www.w3.org/20... |
from multiprocessing import Process, Event
import threading
import time
import signal, select
import traceback
import setproctitle
from APSyncFramework.utils.common_utils import PeriodicEvent
from APSyncFramework.utils.json_utils import ping, json_wrap_with_target
from APSyncFramework.utils.file_utils import read_confi... |
from ....model.util.HelperModule import get_partial_index
from ....model.DioptasModel import DioptasModel
from ....widgets.integration import IntegrationWidget
from ....widgets.plot_widgets.ImgWidget import IntegrationImgWidget
class PhaseInCakeController(object):
"""
PhaseInCakeController handles all the inter... |
import sys
import os
import shlex
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.todo',
'sphinx.ext.pngmath',
'sphinx.ext.ifconfig',
'sphinx.ext.viewcode',
]
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
project = u'last_letter'
copyright = u'2014, George Zogopoulos -... |
"""
An implementation of the time frequency phase misfit and adjoint source after
Fichtner et al. (2008).
:copyright:
Lion Krischer (krischer@geophysik.uni-muenchen.de), 2013
:license:
GNU General Public License, Version 3
(http://www.gnu.org/copyleft/gpl.html)
"""
import warnings
import numexpr as ne
impor... |
import json
import random
import requests
from plugin import create_plugin
from message import SteelyMessage
HELP_STR = """
Request your favourite bible quotes, right to the chat.
Usage:
/bible - Random quote
/bible Genesis 1:3 - Specific verse
/bible help - This help text
Verses are specified in the fo... |
"""
This program decodes the Motorola SmartNet II trunking protocol from the control channel
Tune it to the control channel center freq, and it'll spit out the decoded packets.
In what format? Who knows.
Based on your AIS decoding software, which is in turn based on the gr-pager code and the gr-air code.
"""
from g... |
from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib.auth.mixins import UserPassesTestMixin
from django.views.generic import ListView
from django.views import View
from django.db.models import Q
import posgradmin.models as models
from posgradmin import authorization as auth
from django.conf imp... |
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
_fromUtf8 = lambda s: s
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName(_fromUtf8("MainWindow"))
MainWindow.resize(1024, 768)
self.centralwidget = QtGu... |
import frappe
from frappe.model.document import Document
from frappe.website.utils import delete_page_cache
class Homepage(Document):
def validate(self):
if not self.description:
self.description = frappe._("This is an example website auto-generated from ERPNext")
delete_page_cache('home')
def setup_items(self... |
import abc
from ..utils import OrderedDict
from ..utils import enum
Architecture = enum('Test', 'X86', 'X8664', 'Mips', 'Arm', 'Generic',
enum_type='Architecture')
class Register(object):
_register_fmt = {16: '0x%032lX',
10: '0x%020lX',
8: '0x%016lX',
... |
import re
import traceback
import datetime
import urlparse
import sickbeard
import generic
from sickbeard.common import Quality
from sickbeard import logger
from sickbeard import tvcache
from sickbeard import db
from sickbeard import classes
from sickbeard import helpers
from sickbeard import show_name_helpers
from sic... |
from collections import defaultdict
class Solution(object):
def minWindow(self, S, T):
"""
:type S: str
:type T: str
:rtype: str
"""
pre = defaultdict(list)
for i, c in enumerate(T, -1):
pre[c].append(i)
for val in pre.values():
... |
from django.conf.urls import patterns, include, url
urlpatterns = patterns('',
url(r'^$', 'webinterface.view.dashboard.main'),
url(r'^dashboard/$', 'webinterface.view.dashboard.main'),
url(r'^login/$', 'webinterface.view.login.main'),
url(r'^login/ajax/$', 'webinterface.view.login.ajax'),
url(r'^set... |
import numpy
class DifferentialEvolutionAbstract:
amount_of_individuals = None
f = None
p = None
end_method = None
def __init__(self, min_element=-1, max_element=1):
self.min_element = min_element
self.max_element = max_element
self.f = 0.5
self.p = 0.9
self.f... |
import pickle
from matplotlib import pyplot as plt
plt.style.use('classic')
import matplotlib as mpl
fs = 12.
fw = 'bold'
mpl.rc('lines', linewidth=2., color='k')
mpl.rc('font', size=fs, weight=fw, family='Arial')
mpl.rc('legend', fontsize='small')
import numpy
def grad( x, u ) :
return numpy.gradient(u) / numpy.gr... |
../../../../share/pyshared/jockey/xorg_driver.py |
"""Holds all pytee logic.""" |
"""
unit test for filters module
author: Michael Grupp
This file is part of evo (github.com/MichaelGrupp/evo).
evo 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 optio... |
import string
import operator
import datetime
import SystemTime
import Schedule
import ScheduleItem
STATE_MAIN_MENU = 0
STATE_ADD_SCHEDULE = 1
STATE_DEL_SCHEDULE = 2
STATE_RELAY_STATES = 3
STATE_SCHEDULE = 4
STATE_SET_SYSTEM_TIME = 5
STATE_SHUTDOWN = 6
MODE_STANDARD = 0
MODE_CONFIRM = 1
class UserInterface:
def __in... |
import sys,os
class Solution():
def reverse(self, x):
sign=1
if x<0:
sign=-1
x=x*-1
token=str(x)
str_rev=""
str_len=len(token)
for i in range(str_len):
str_rev+=token[str_len-i-1]
num_rev=int(str_rev)
if sign==1 and ... |
__author__ = 'LIWEI240'
"""
Constants definition
"""
class Const(object):
class RetCode(object):
OK = 0
InvalidParam = -1
NotExist = -2
ParseError = -3 |
from modules.base_module import RanaModule
import cairo
from time import time
from math import pi
def getModule(*args, **kwargs):
return ClickMenu(*args, **kwargs)
class ClickMenu(RanaModule):
"""Overlay info on the map"""
def __init__(self, *args, **kwargs):
RanaModule.__init__(self, *args, **kwarg... |
"""
Created on Sun Sep 17 22:06:52 2017
Based on: print_MODFLOW_inputs_res_NWT.m
@author: gcng
"""
import numpy as np
import MODFLOW_NWT_lib as mf # functions to write individual MODFLOW files
import os # os functions
from ConfigParser import SafeConfigParser
parser = SafeConfigParser()
parser.read('settings.ini')
LOC... |
"""
"""
__version__ = "$Id$"
import EasyDialogs
valid_responses = { 1:'yes',
0:'no',
-1:'cancel',
}
response = EasyDialogs.AskYesNoCancel('Select an option')
print 'You selected:', valid_responses[response] |
from gi.repository import Gtk
from gi.repository import GdkPixbuf
from GTG.core.tag import ALLTASKS_TAG
from GTG.gtk.colors import get_colored_tags_markup, rgba_to_hex
from GTG.backends.backend_signals import BackendSignals
class BackendsTree(Gtk.TreeView):
"""
Gtk.TreeView that shows the currently loaded backe... |
import math
import time
from browser import doc
import browser.timer
class Point(object):
# 起始方法
def __init__(self, x, y):
self.x = x
self.y = y
# 繪製方法
def drawMe(self, g, r):
self.g = g
self.r = r
self.g.save()
self.g.moveTo(self.x,self.y)
self.g.... |
import time
timeformat='%H:%M:%S'
def begin_banner():
print ''
print '[*] swarm starting at '+time.strftime(timeformat,time.localtime())
print ''
def end_banner():
print ''
print '[*] swarm shutting down at '+time.strftime(timeformat,time.localtime())
print '' |
"""
<div id="content">
<div style="text-align:center;" class="print"><img src="images/print_page_logo.png" alt="projecteuler.net" style="border:none;" /></div>
<h2>Number letter counts</h2><div id="problem_info" class="info"><h3>Problem 17</h3><span>Published on Friday, 17th May 2002, 06:00 pm; Solved by 88413; Difficu... |
import gammalib
import cscripts
from testing import test
class Test(test):
"""
Test class for csiactobs script
This test class makes unit tests for the csiactobs script by using it
from the command line and from Python.
"""
# Constructor
def __init__(self):
"""
Constructor
... |
r"""
Simulation of standard multiple stochastic integrals, both Ito and Stratonovich
I_{ij}(t) = \int_{0}^{t}\int_{0}^{s} dW_i(u) dW_j(s) (Ito)
J_{ij}(t) = \int_{0}^{t}\int_{0}^{s} \circ dW_i(u) \circ dW_j(s) (Stratonovich)
These multiple integrals I and J are important building blocks that will be
used by most of th... |
content_template = """<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
</body>
</html>"""
toc_ncx = u"""<?xml version="1.0" encoding="utf-8"?>
<!D... |
import logging
from scap.model.oval_5.defs.windows.TestType import TestType
logger = logging.getLogger(__name__)
class Process58TestElement(TestType):
MODEL_MAP = {
'tag_name': 'process58_test',
} |
def main():
"""Instantiate a DockerStats object and collect stats."""
print('Docker Service Module')
if __name__ == '__main__':
main() |
import capstone
import _any_capstone
dis = capstone.Cs(capstone.CS_ARCH_ARM, capstone.CS_MODE_ARM)
def PROCESSOR_ENTRY():
return _any_capstone.Processor("arm_32", dis) |
"""Perform preprocessing and generate raytrace exec scripts for one focal plane.
For documentation using the python_control for ImSim/PhoSim version <= v.3.0.x,
see README.v3.0.x.txt.
For documentation using the python_control for ImSim/PhoSim version == v.3.2.x,
see README.txt.
The behavior of this script differs depe... |
from svgpathtools import svg2paths, wsvg
import numpy as np
import uArmRobot
import time
serialport = "/dev/ttyACM0" # for linux like system
myRobot = uArmRobot.robot(serialport,0) # user 0 for firmware < v4 and use 1 for firmware v4
myRobot.debug = True # Enable / Disable debug output on screen, by default disabled... |
import pymongo
from pymongo.errors import AutoReconnect
from lai.db.base import DBBase
from lai.database import UPDATE_PROCESS, COMMIT_PROCESS
from lai.database import DatabaseException, NotFoundError
from lai import Document
class DBMongo(DBBase):
def __init__(self, name, host='127.0.0.1', port=27017):
sel... |
from matplotlib import pyplot as plt
path = "C:/Temp/mnisterrors/chunk" + str(input("chunk: ")) + ".txt"
with open(path, "r") as f:
errorhistory = [float(line.rstrip('\n')) for line in f]
plt.plot(errorhistory)
plt.show() |
from numpy import *
from scipy.optimize import root
def eps(omk):
return omk**2/(2+omk**2)
def om_k(omc):
khi=arcsin(omc)
return sqrt(6*sin(khi/3)/omc-2)
omc=0.88
print 'omc=',omc,' omk=',om_k(omc) |
import sys
import os
output_dir = "erc2-chromatin15state-all-files"
if not os.path.exists(output_dir):
sys.stderr.write("Creating dir [%s]...\n" % (output_dir))
os.makedirs(output_dir)
prefix = "/home/cbreeze/for_Alex"
suffix = "_15_coreMarks_mnemonics.bed"
marks = [ '1_TssA',
'2_TssAFlnk',
'3_T... |
from ._common import *
from .rethinkdb import RethinkDBPipe
from .mongodb import MongoDBPipe |
import pandas as pd
from larray.core.array import Array
from larray.inout.pandas import from_frame
__all__ = ['read_stata']
def read_stata(filepath_or_buffer, index_col=None, sort_rows=False, sort_columns=False, **kwargs) -> Array:
r"""
Reads Stata .dta file and returns an Array with the contents
Parameters... |
"""Provides a way to hook GunGame messages."""
from core import AutoUnload
from .manager import message_manager
class MessageHook(AutoUnload):
"""Decorator used to register message hooks."""
def __init__(self, message_name):
"""Store the message name."""
self.message_name = message_name
... |
""" NodeChains are sequential orders of :mod:`~pySPACE.missions.nodes`
.. image:: ../../graphics/node_chain.png
:width: 500
There are two main use cases:
* the application for :mod:`~pySPACE.run.launch_live` and the
:mod:`~pySPACE.environments.live` using the default
:class:`NodeChain` and
* ... |
import pandas as pd
adv = pd.read_csv('Advertising.csv')
tv_budget_x = adv.TV.tolist()
print(tv_budget_x) |
from django.contrib import admin |
"""
Created on Mon Jul 22 17:01:36 2019
@author: raf
"""
from pdb import set_trace as stop
import copy
import numpy as np
from collections import OrderedDict
import string as st
import os
import pandas as pd
from vison.datamodel import cdp
from vison.support import files
from vison.fpa import fpa as fpamod
from vison.m... |
"""
MagPy
IAGA02 input filter
Written by Roman Leonhardt June 2012
- contains test, read and write function
"""
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import
from __future__ import division
from io import open
from magpy.stream import *
MISSING_DATA... |
class Solution:
def majorityElement(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
num1, cnt1 = 0, 0
num2, cnt2 = 1, 0
for num in nums:
if num == num1:
cnt1 += 1
elif num == num2:
cnt2 += 1
... |
import pandas as pd
from sklearn.datasets import load_boston
from sklearn.linear_model import LinearRegression
from sklearn.tree import DecisionTreeRegressor
from sklearn.cross_validation import train_test_split
from sklearn.metrics import mean_squared_error
from .auto_segment_FEMPO import BasicSegmenter_FEMPO
def demo... |
from os.path import join, abspath, dirname, exists
import os
import errno
import shutil
from tempfile import mkdtemp
import subprocess
import urllib2
import logging
import sys
import datetime
import re
from landsat.search import Search
from landsat.ndvi import NDVIWithManualColorMap
logging.basicConfig(stream=sys.stder... |
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import NoAlertPresentException
import unittest, time, re
class DownloadEnteredDataTest(unittest.TestCase):
def setUp(self):
self.driver = w... |
""" ARC Computing Element
"""
__RCSID__ = "58c42fc (2013-07-07 22:54:57 +0200) Andrei Tsaregorodtsev <atsareg@in2p3.fr>"
import os
import stat
import tempfile
from types import StringTypes
from DIRAC import S_OK, S_ERROR
from DIRAC.Resources.Computing.ComputingElement ... |
import re
a = [[0 for x in range(25)] for y in range(13)]
f=open("../distrib/spiral.txt","r")
s=f.readline().strip()
dx, dy = [0, 1, 0, -1], [1, 0, -1, 0]
x, y, c = 0, -1, 1
l=0
for i in range(13+13-1):
if i%2==0:
for j in range((25+25-i)//2):
x += dx[i % 4]
y += dy[i % 4]
... |
from __future__ import (absolute_import, division, print_function, unicode_literals)
from os import path
from mantid import logger
class WorkspaceLoader(object):
@staticmethod
def load_workspaces(directory, workspaces_to_load):
"""
The method that is called to load in workspaces. From the given ... |
"""Script for plotting distributions of epitopes per site for two sets of sites.
Uses matplotlib. Designed to analyze output of epitopefinder_getepitopes.py.
Written by Jesse Bloom."""
import os
import sys
import random
import epitopefinder.io
import epitopefinder.plot
def main():
"""Main body of script."""
ran... |
mcinif='mcini_gen2'
runname='gen_test2111b'
mcpick='gen_test2b.pickle'
pathdir='/beegfs/work/ka_oj4748/echoRD'
wdir='/beegfs/work/ka_oj4748/gen_tests'
update_prec=0.04
update_mf=False
update_part=500
import sys
sys.path.append(pathdir)
import run_echoRD as rE
rE.echoRD_job(mcinif=mcinif,mcpick=mcpick,runname=runname,wd... |
"""
Created on Fri Dec 18 14:11:31 2015
@author: Martin Friedl
"""
from datetime import date
import numpy as np
from Patterns.GrowthTheoryCell import make_theory_cell
from Patterns.GrowthTheoryCell_100_3BranchDevices import make_theory_cell_3br
from Patterns.GrowthTheoryCell_100_4BranchDevices import make_theory_cell_4... |
from rest_framework import serializers
from .models import CustomerWallet
class CustomerWalletSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = CustomerWallet
fields = ("wallet_id", "msisdn", "balance", "type", "status") |
import urllib2
import urllib
from BeautifulSoup import BeautifulSoup
import smtplib
import ConfigParser
config = ConfigParser.ConfigParser()
config.read('config.cfg')
user = config.get('data','user')
password = config.get('data','password')
fromaddr = config.get('data','fromaddr')
toaddr = config.get('data','toaddr')
s... |
import os
import json
import collections
import datetime
from flask import Flask, request, current_app, make_response, session, escape, Response, jsonify
from flask_jwt_extended import JWTManager, jwt_required, create_access_token, get_jwt_identity
from flask_socketio import SocketIO
from neo4j.v1 import GraphDatabase,... |
import sys
sys.path.append('/var/www/html/valumodel.com/scripts/dcf')
from calc_dcf import calc_dcf
def create_dcf(req, tax_rate, growth_rate_1_year_out, sga_of_sales, da_of_sales, capex_of_sales, nwc_of_sales, levered_beta, current_yield, exit_multiple, ticker):
assumptions = {}
try:
assumptions['Tax Rate'] ... |
import os
import re
import gettext
import locale
import threading # libsearchfilter_toggle starts thread libsearchfilter_loop
import operator
import gtk
import gobject
import pango
import ui
import misc
import formatting
import mpdhelper as mpdh
from consts import consts
import breadcrumbs
def library_set_data(album=No... |
from django.shortcuts import render
def about(request):
return render(request, "about.html", {})
def location(request):
return render(request, "location.html", {})
def failure(request):
return render(request, "failure.html", {}) |
import json
import urllib
import urllib2
def shorten(url):
gurl = 'http://goo.gl/api/url?url=%s' % urllib.quote(url)
req = urllib2.Request(gurl, data='')
req.add_header('User-Agent','toolbar')
results = json.load(urllib2.urlopen(req))
return results['short_url'] |
import wx
import os
import wx.xrc
import modules.baz.cDatabase as cDatabase
import linecache
class PubDialog ( wx.Dialog ):
## Konstruktor
def __init__( self ):
wx.Dialog.__init__ ( self, None, id = wx.ID_ANY, title = u"Zarządzanie Publikacjami", pos = wx.DefaultPosition, size = wx.Size( 450,430 ), styl... |
__author__ = 'xiaoxiaol'
import numpy as np
import pylab as pl
import scipy
import pandas as pd
import seaborn as sns
import os
import sys, getopt
from scipy.cluster import hierarchy
import platform
from scipy.stats.stats import pearsonr
import scipy.stats as stats
from PIL import Image
import glob
from sklearn.metrics... |
from xboxdrv_parser import Controller
from time import sleep
import argparse
import os
import sys
sys.path.append(os.path.abspath("../../.."))
from util.communication.grapevine import Communicator
from robosub_settings import settings
def main (args):
com = Communicator (args.module_name)
controller = Controlle... |
""" Integration test: permit call
"""
import os
import sys
myPath = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, myPath + '/../../')
import logging
import nose
from nose.tools import *
import inte_testutils
from telewall.core.model import TelephoneNumber
from telewall.core.util import sleep_until
loggi... |
from __future__ import absolute_import
import argparse
import os
import sys
import yarrharr
def main(argv=sys.argv[1:]):
parser = argparse.ArgumentParser(description="Yarrharr feed reader")
parser.add_argument("--version", action="version", version=yarrharr.__version__)
parser.parse_args(argv)
os.enviro... |
from datetime import date
from itertools import starmap
from hscommon.testutil import eq_
from ...model.amount import Amount
from ...model.currency import USD
from ...model.entry import Entry
from ...model.transaction import Transaction
from ...plugin.base_import_bind import ReferenceBind
def create_entry(entry_date, d... |
from django.core.management.base import BaseCommand, CommandError
from django.core import management
from django.db.models import Count
from scoping.models import *
class Command(BaseCommand):
help = 'check a query file - how many records'
def add_arguments(self, parser):
parser.add_argument('qid',type=... |
"""
IfExp astroid node
An if statement written in an expression form.
Attributes:
- test (Node)
- Holds a single node such as Compare.
- Body (List[Node])
- A list of nodes that will execute if the condition passes.
- orelse (List[Node])
- The else clause.
Example:
- test ... |
import pilas
archi = open('datos.txt', 'r')
nivel = archi.readline()
pantalla = archi.readline()
idioma = archi.readline()
archi.close()
if idioma == "ES":
from modulos.ES import *
else:
from modulos.EN import *
class EscenaMenu(pilas.escena.Base):
"Es la escena de presentación donde se elijen las opciones ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.