code stringlengths 1 199k |
|---|
"""Threaded IMAP4 client.
Based on RFC 2060 and original imaplib module.
Public classes: IMAP4
IMAP4_SSL
IMAP4_stream
Public functions: Internaldate2Time
ParseFlags
Time2Internaldate
"""
__all__ = ("IMAP4", "IMAP4_SSL", "IMAP4_stream"
... |
import numpy as numpy
import pandas as pandas
import sys
from Log import Log
from src.Sort import Sort
class Data(object):
def __init__(self, sourceCSV):
self.data = pandas.read_csv(sourceCSV, encoding='utf-8')
self.open_csv(sourceCSV)
self.appendPositions = {}
def open_csv(self, sourceC... |
import cv2
import opencv
from os.path import basename,splitext
import glob
import numpy as np
import argparse
ap = argparse.ArgumentParser()
ap.add_argument("-t", "--template", required=True, help="Path to template image")
ap.add_argument("-i", "--images", required=True, help="Path to images where template will be matc... |
import numpy as np
import ctypes
class Frame:
""" Class doc """
def __init__ (self, chains=None, bonds=None, mass_center=None):
""" Class initialiser """
if chains is None:
chains = {}
if bonds is None:
bonds = []
if mass_center is None:
mass_center = np.array([0.0, 0.0, 0.0])
... |
"""
.. module: drivers/picam_types
: platform: Windows
.. moduleauthor:: Daniel R. Dietze <daniel.dietze@berkeley.edu>
Defines data types and enums to be used with picam. See PICam user manual for more information.
..
This file is part of the pyFSRS app.
This program is free software: you can redistribute it an... |
from HTMLParser import HTMLParser
import urllib2
import urlparse
import os
def is_absolute(url):
return bool(urlparse.urlparse(url).netloc)
def get_domain(url):
parsed_uri = urlparse.urlparse(url)
domain = '{uri.scheme}://{uri.netloc}/'.format(uri=parsed_uri)
return domain
def download_image(img_url, lo... |
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'presence.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin', include(admin.site.urls)),
# TODO remove these vie... |
from django import forms
from tagging.forms import TagField
from debate.models import Reply
from qqq.utils import url_to_html
from qqq.questions.models import Question, Rating
LMAX = 5000
SMAX = 500
class AddQuestionForm(forms.Form):
"""
Users can submit questions and revisions using this form.
A valid form can b... |
import scrapy
from scrapy import Request
from qiushi.items import QiushiItem
class QiushiSpider(scrapy.Spider):
name = "Qiushi"
allowed_domains = ["qiushibaike.com"]
start_urls = [
"http://www.qiushibaike.com/hot/page/1",
]
headers = {
"Accept": "*/*",
"Accept-Encoding": ... |
import electrum, base64, ast, sys, os
from version import SEED_VERSION
try:
from lib import prompt_password
from lib.util import print_error
except ImportError:
from electrum import prompt_password
from electrum.util import print_error
if __name__ == "__main__":
try:
path = sys.argv[1]
e... |
import urllib.parse
import urllib.request
import urllib.error
import http.cookiejar
import json
import hashlib
import threading
try:
from bs4 import BeautifulSoup
except ImportError:
BeautifulSoup = None
API_v = 5.20
USER_AGENT = ('Mozilla/5.0 (Linux; U; Android 2.1; en-us; GT-I9000 '
'Build/ECLAI... |
"""
Example 3 Same example as Example1 but using systypes
Copyright (C) 2016 Walid Benghabrit
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 l... |
from bottle import ServerAdapter
class MyWSGIRefServer(ServerAdapter):
server = None
def run(self, handler):
from wsgiref.simple_server import make_server, WSGIRequestHandler
if self.quiet:
class QuietHandler(WSGIRequestHandler):
def log_request(*args, **kw): pass
... |
""" Class Intro Here"""
from numpy import *
from scipy import *
from matplotlib.pyplot import *
import time
class DeathStar:
#class owned vars
def __init__(self,dt=0.001,t1=0,t2=0,Jst=1,platemass=5,l1=1,l2=1,b1=1,b2=1,starscale=130,shotweight=0.1,mst=15,use_pygame=False):
self.t2store = t2
self.... |
import re
import sksurv
def test_show_versions(capsys):
sksurv.show_versions()
captured = capsys.readouterr()
assert "SYSTEM" in captured.out
assert "DEPENDENCIES" in captured.out
# check required dependency
assert re.search(r"numpy\s*:\s([0-9\.\+a-f]|dev)+\n", captured.out)
assert re.search... |
import re
import time
import thread
import urllib2
import random
if __name__ != "__main__":
from magnet_api import *
from magnet_utils import *
try:
try:
from bs4 import BeautifulSoup
soup_version = 4
except ImportError:
from BeautifulSoup import BeautifulSoup
soup_version = 3
except ImportError... |
from math import sqrt,log
import numpy as np
from matplotlib import pyplot
from spm1d import rft1d
eps = np.finfo(float).eps
def here_hotellingsT2(y):
N = y.shape[0]
m = np.matrix( y.mean(axis=0) )
T2 = []
for ii,mm in enumerate(m):
W = np.matrix( np.cov(y[:,ii,:].T, ddof=1) ) #estima... |
import itertools
print dir(itertools)
l = [1,2,3]
'''
def height_class(h):
if h > 180:
return "tall"
elif h < 160:
return "short"
else:
return "middle"
friends = [191, 158, 159, 165, 170, 177, 181, 182, 190]
for m, n in itertools.groupby(friends, key=height_class):
print(m)
p... |
DOCUMENTATION = '''
---
module: s3_lifecycle
short_description: Manage s3 bucket lifecycle rules in AWS
description:
- Manage s3 bucket lifecycle rules in AWS
version_added: "2.0"
author: Rob White (@wimnat)
notes:
- If specifying expiration time as days then transition time must also be specified in days
- If ... |
"""
Impact Layer Merge Dialog.
.. 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 by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
"""
__author__ = 'Christ... |
"""
包装选股worker进行,完善前后工作
"""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
from .ABuPickStockWorker import AbuPickStockWorker
from ..CoreBu.ABuEnvProcess import add_process_env_sig
from ..MarketBu.ABuMarket import split_k_market
from ..TradeBu.ABuKLManag... |
"""177. Integer angled Quadrilaterals
https://projecteuler.net/problem=177
Let ABCD be a convex quadrilateral, with diagonals AC and BD. At each vertex
the diagonal makes an angle with each of the two sides, creating eight corner
angles.

For example, at vertex A, the two angles are CAD... |
import logging
import requests
from . import ticket
__author__ = 'dranck, rnester, kshirsal'
logger = logging.getLogger(__name__)
class RedmineTicket(ticket.Ticket):
"""
A Redmine Ticket object. Contains Redmine-specific methods for working with tickets.
"""
def __init__(self, url, project, auth=None, t... |
"""" Module for testing KMCLocalConfiguration """
import unittest
import numpy
from KMCLib.Exceptions.Error import Error
from KMCLib.Backend import Backend
from KMCLib.CoreComponents.KMCLocalConfiguration import KMCLocalConfiguration
class KMCLocalConfigurationTest(unittest.TestCase):
""" Class for testing the KMCL... |
from django.db import models
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from django.utils.translation import ugettext as _
from bcmon.models import Playout
from bcmon.models import ChannelPlugin as ChannelPluginModel
@plugin_pool.register_plugin
class ChannelPlugin(CMSPluginBase):... |
import logging
import signal
import sys
import warnings
warnings.filterwarnings("ignore", ".*psycopg2 wheel package will be renamed.*")
from dnslib.server import DNSServer
from sccommon.logging import logging_setup
from .logger import ToPyLogger
from .resolver import ScorekeeperResolver
def main():
logging_set... |
"""
Peak Fitting Program
Author: Jack Griffiths
Date: March 2018
This allows for Lorentzian peaks to be fit easily to a time series of spectra. This spectral scan should be cleaned up using the adaptive-polynomial
method to remove any non-constant background.
To run this, use Run(Array,x_axis,Threshold=None). Array is ... |
import os
import platform
import threading
from PyQt5.QtCore import Qt, pyqtSignal, PYQT_VERSION_STR, QUrl
from PyQt5.QtGui import QBrush, QDesktopServices
from PyQt5.QtWidgets import QMainWindow, QApplication, QFileDialog, QTableWidgetItem, QMessageBox
from PyQt5.uic import loadUi
import application
from movie import ... |
import os
from PySide2.QtCore import *
from PySide2.QtGui import *
if __name__ == '__main__':
from basedialog import BaseDialog
else:
from .basedialog import BaseDialog
class SettingsDialog(BaseDialog):
def __init__(self, pa, styleoptions, parent=None):
super(SettingsDialog, self).__init__(styleopti... |
import unittest
from l3xdg.tests.testconstraints import *
from l3xdg.tests.testcs import *
loader = unittest.defaultTestLoader
runner = unittest.TextTestRunner(verbosity=1)
def projectors():
print('Running projector tests')
suite = loader.loadTestsFromTestCase(TestProjectors)
runner.run(suite)
def sprecsele... |
'''
Copyright 2010 Beech Horn
This file is part of lesscss-python.
lesscss-python 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.
lesscss-pyt... |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^(?P<page>\d+)?/?$', views.GalleriesView.as_view(), name='galleries'),
url(r'^gallery/(?P<slug>[-\w]+)/(?P<page>\d+)?/?$',
views.GalleryView.as_view(), name='gallery'),
# url(r'^image/(?P<id>\d+)/$', views.ImageView.as_view()... |
from service import *
from property import * |
import os
import sys
import codecs
def is_windows():
return sys.platform.startswith('win')
def is_linux():
return sys.platform.startswith('linux')
def is_macosx():
return sys.platform.startswith('darwin')
def get_basepath():
""" Return the base path where all database, cached streams and config files ar... |
import csv
from taxacomponents import RankTable, Taxon, Name
from nameresolve import NamesResolver
class TaxoCSVError(Exception):
"""
A basic exception class for reporting errors encountered while processing a
taxonomy CSV file.
"""
def __init__(self, msg):
msg = 'Error while parsing taxonom... |
import requests
from cloudbot import hook
from cloudbot.util import web
api_root = 'http://api.rottentomatoes.com/api/public/v1.0/'
movie_search_url = api_root + 'movies.json'
movie_reviews_url = api_root + 'movies/{}/reviews.json'
@hook.command('rottentomatoes', 'rt')
def rotten_tomatoes(text, bot):
"""rt <title> ... |
from itools.core import get_abspath
from ikaaro.registry import register_document_type
from ikaaro.skins import register_skin
from blog import Post
path = get_abspath('ui')
register_skin('blog', path)
register_document_type(Post) |
__license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
"""
This module contains the logic for dealing with XML book lists found
in the reader cache.
"""
import xml.dom.minidom as dom
from base64 import b64decode as decode
from base64 import b64encode as encode
import re
from calibre.devi... |
from __future__ import absolute_import, unicode_literals
import adsputils
from adsmsg import OrcidClaims
from ADSOrcid import app as app_module
from ADSOrcid import updater
from ADSOrcid.exceptions import ProcessingException, IgnorableException
from ADSOrcid.models import KeyValue
from kombu import Queue
import datetim... |
from sanic import Blueprint
from .info import TeacherListView
bp_v1 = Blueprint('api', url_prefix='/api/v1')
bp_v1.add_route(TeacherListView.as_view(), '/teachers') |
import os
import sqlite3
from wsgiref.handlers import CGIHandler
import sys
sys.path.append("..")
import custom_functions
try:
from custom_functions import WebConfig
except ImportError:
from philologic.runtime import WebConfig
from philologic.Config import MakeDBConfig
from philologic.runtime.DB import DB
def g... |
from distutils.core import setup
setup(name='spectra',
version='0.2',
description='Basic spectral analysis using lmfit',
author='Rohan Isaac',
author_email='rohan_isaac@yahoo.com',
url='https://github.com/rohanisaac/spectra',
packages=['spectra'],
install_requires=['numpy', 'lm... |
import numpy as np
from PyQt5 import QtGui
def calcBlackness(image, circleParams, dL, startAngle, spanAngle):
"""Given image, a QImage, a circle defined by circleParams (a dict
containing the radius and centre coordinates of a circle), a
startAngle and spanAngle (both in degrees) specifying an arc of that
... |
from __future__ import unicode_literals
import frappe
import os
from frappe import _
from frappe.utils import get_fullname, flt, cstr
from frappe.model.document import Document
from erpnext.hr.utils import set_employee_name
from erpnext.accounts.party import get_party_account
from erpnext.accounts.general_ledger import... |
def compute_ranks(graph):
d = 0.8 # damping factor
numloops = 10
ranks = {}
npages = len(graph)
for page in graph:
ranks[page] = 1.0 / npages
for i in range(0, numloops):
newranks = {}
for page in graph:
newrank = (1 - d) / npages
for node in grap... |
"""Basic network-building tools"""
from __future__ import print_function
from __future__ import division
import tensorflow as tf
from .layer import Layer
class FFNetwork(object):
"""Implementation of simple fully connected feedforward neural network
Attributes:
scope (str): name scope for network
... |
from __future__ import unicode_literals
import frappe
import unittest
class TestLicensegroup(unittest.TestCase):
pass |
import collections
c = collections.Counter(a=3, b=1)
d = collections.Counter(a=1, b=2)
c + d
c - d
c & d
c | d |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('django_ca', '0005_auto_20170307_1839'),
]
operations = [
migrations.AlterField(
model_name='certificate',
name='csr',
field=models.TextField(blank=True, verb... |
import datetime
import smtplib
import os
from email.message import EmailMessage
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import __init__
class Message:
def __init__(self, user_id, messages = [], users = []):
self.__user_id = user_id
self.__messages = messages
self.__use... |
#!/usr/bin/python
import sys
import os
from main_src.tools.tools import logical_argv
from main_src.tools.tools import get_argv
import main_src.constants as constants
'''
onlyshallowsurface
shallowandrillsurface
diffuseshallowsurface
shallowrillstreamsurface
surfaceandsubsurfacestreamflow
'''
print "----------... |
from setuptools import setup
from os.path import join, dirname
import gitcheck
setup(name='gitcheck',
version = gitcheck.__version__,
author = gitcheck.__author__ ,
author_email = gitcheck.__email__,
url = 'http://github.com/johnjosephhorton/gitcheck',
packages = [''],
package_data =... |
import math
import numpy as np
import matplotlib.pyplot as plt
from scipy import spatial
import collections
import sys
import csv
import os
import random
if(len(sys.argv) < 2):
print 'insufficient args'
sys.exit(1)
pd_file = open(sys.argv[1],'r')
pd_reader = csv.reader(pd_file, delimiter=' ')
pd = np.array([[fl... |
import matplotlib.pyplot as plt
from hyperspy.drawing.marker import MarkerBase
class HorizontalLineSegment(MarkerBase):
"""Horizontal line segment marker that can be added to the signal figure
Parameters
---------
x1: array or float
The position of the start of the line segment in x.
If ... |
import os
import time
from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import GdkPixbuf
from gi.repository import Pango
from gi.repository import GObject
from gi.repository import GLib
import gtkgui_helpers
import gui_menu_builder
import message_control
import dialogs
import history_window... |
import MD_IO
A = MD_IO.resinfo(top='AHEYKA.top')
A.summary(1)
for a in A.bondterms(2):
print a
for a in A.angleterms(3):
print a
for a in A.dihedralterms(4):
print a |
import xbmc, xbmcaddon, xbmcgui, xbmcplugin, os, sys, xbmcvfs, glob
import shutil
import urllib2,urllib
import re
import uservar
import time
import datetime
from datetime import date
from resources.libs import extract, downloader, notify, traktit, skinSwitch, uploadLog, wizard as wiz
ADDON_ID = uservar.ADDON_ID
A... |
import sys
import xml.sax
import xml.sax.handler
class QuxmlaElementStats():
"""Stats for a path"""
def __init__(self):
self.times_total = 1
self.times_min = 0
self.times_max = 0
self.children = dict()
def printMe(self):
print " {0}\t{1}\t{2}".format(
... |
import os
from modeller import *
import modeller.salign
log.verbose()
env = environ()
env.io.atom_files_directory = ['pdb', 'models']
pdb_chain = []
pdb_chain.append(('2o7a', 'A'))
pdb_chain.append(('spmx', 'A'))
pdb_chain.append(('2anv', 'A'))
pdb_chain.append(('3hdf', 'A'))
pdb_chain.append(('SpmX-Pb.B99990001', ''))... |
"""
WSGI config for CtrlVET 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.9/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_M... |
import argparse
from decimal import Decimal
import re
import subprocess
import sys
def mk_arg_parser():
p = argparse.ArgumentParser(description='Print current CPU frequency in MHz',
epilog=('This tool reads two CPU performance counters (a.k.a. MSRs)'
' two times. The first counter is increment... |
import logging
logger = logging.getLogger(__name__)
from _replayswidget import ReplaysWidget as Replays |
###########################################################################
from numpy.fft import fftshift, ifftshift
from numpy import real, exp as npexp, ComplexWarning
from numpy import arange, floor, kron, ones, float32
from numpy import pad, hanning, zeros, concatenate, tile, finfo
from numpy import zeros, mean, ... |
import tensorflow as tf
import numpy as np
if __name__ == '__main__':
with tf.variable_scope('foo'):
data = tf.placeholder(tf.float32,[None,None,2])
cell = tf.nn.rnn_cell.GRUCell(2)
output,state=tf.nn.dynamic_rnn(cell,data,dtype=tf.float32)
tf.get_variable_scope().reuse_variables()
output1,state1=tf.nn.dynam... |
import logging
import pbr.version
__version__ = pbr.version.VersionInfo(
'splitter').version_string()
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger('splitter')
logger.addHandler(logging.NullHandler()) |
import sqlite3
class claims:
def __init__(self, claim_id):
self.claim_id = claim_id
db_conn = sqlite3.connect('bot.db', check_same_thread = False)
conn_cursor = db_conn.cursor()
def getclaimdetails(self):
t = (self.claim_id,)
self.conn_cursor.execute("SELECT username, reward_name... |
import numpy as np
from layers import *
class SeqNN(object):
def __init__(self, word_to_idx, wordvec_dim=128, hidden_dim=128,
cell_type='rnn', sentlen=7, storylen=70, qlen=5,
dtype=np.float32):
if cell_type not in {'rnn', 'lstm', 'gru'}:
raise ValueError('Invalid cell_type "%s"' % c... |
'''
.. currentmodule:: pele.concurrent
Parallel connect jobs (`pele.concurrent`)
===========================================
Concurrent programming concepts allow pele connect jobs to be run in parallel. We use the package
Pyro4 which makes this amazingly simple.
The server manages the central database and decides whic... |
from glob import glob
import functions_generate_data
import os, pprocess
NPROC = 4 # number of processors for 1 specfem simulation
total_number_processors = 4 # total number of processors available
num_events = len(glob('../input_files/CMTSOLUTION_files/*'))
output_data_directory = 'true_model_seismograms'
print "Linki... |
"""
Django settings for spockdock project.
Generated by 'django-admin startproject' using Django 1.10.3.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import os
f... |
from .root__general_child import RootGeneralChildEndpoint
from ....general.endpoint import Endpoint
class NetworksEndpoint(RootGeneralChildEndpoint):
@classmethod
def get_paths(cls):
return [
"/networks"
]
@classmethod
def get_name(cls):
return "network entities"
... |
import re
__author__ = 'Chris Ottersen'
"""
:type exp_template:
"""
exp_template = re.compile(
r"""
^
(?P<SMStext>I\x00P\x00M\x00\.\x00S\x00M\x00S\x00t\x00e\x00x\x00t\x00\x00\x00) # Indicates that
\x01
(?P<content>
(?:
(?P<phone_1>(?:..){,20}?\x00\x... |
import sys
from itcc.molecule import read
def moldiff(mol1, mol2):
assert len(mol1) == len(mol2)
return [sum((mol1.coords[i] - mol2.coords[i])**2)**0.5
for i in range(len(mol1))]
def main():
if len(sys.argv) != 3:
import os.path
sys.stderr.write('Usage: %s mol1fname mol2fname\n' ... |
"""A setuptools based setup module.
See:
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/navigateproject
"""
from setuptools import setup, find_packages
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'DESCRIPTION.rst'), ... |
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL)... |
from distutils.core import setup
import py2exe
import sys, os, site, shutil
site_dir = site.getsitepackages()[1]
include_dll_path = os.path.join(site_dir, "gnome")
gtk_dirs_to_include = ['etc', 'lib\\gtk-3.0', 'lib\\girepository-1.0',
'lib\\gio', 'lib\\gdk-pixbuf-2.0', 'share\\glib-2.0', 'share\\fonts',
'share\\icons',... |
"""Simple program to download files using a scraper."""
import os.path as path
import os
import shlex
import ConfigParser
import logging
import sys
import subprocess
import time
import re
import pprint
from configparser import ConfigParser
from lxml import html
from requests import get
import requests
from datetime imp... |
import k_session
sessions = k_session.sessionDict
RESPONSE['Content-Type'] = 'text/plain'
for k,v in sessions.iteritems():
print "session key",k
for x in dir(v):
print '[%s] %s' %(x,getattr(v,x))
print |
"""Audio annotation objects.
This module provides audio aggregators. We generally use frame numbers
as the reference point, with the frames per second and audio sampling rate
values making it possible to translate from the audio samples to visual frames.
"""
from os.path import join
from matplotlib.pyplot import (
... |
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('elections', '0033_auto_20180717_2345... |
import json
import os
from django.shortcuts import redirect
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
from app_proyecto_tecnico.models import ProyectoMotes, Proyecto
from app_mote.models import Mote
from django_angular import General
from django.conf import settings
impor... |
from distutils.core import setup
setup(name='python-CM_LowercaseCoinNamerpc',
version='0.1',
description='Enhanced version of python-jsonrpc for use with CM_UppercaseCoinName',
long_description=open('README').read(),
author='Jeff Garzik',
author_email='<jgarzik@exmulti.com>',
maintai... |
from subprocess import CalledProcessError
from typing import Dict, List, Union
from snapcraft import formatting_utils
from snapcraft.internal import steps
class SnapcraftError(Exception):
"""Base class for all snapcraft exceptions.
:cvar fmt: A format string that daughter classes override
"""
fmt = "Dau... |
'''
@author: Yuhuang Hu
@contact: duguyue100@gmail.com
@note: An implementation of Convolutional Neural Network Layer
'''
import numpy as np;
import theano;
import theano.tensor as T;
from theano.tensor.signal import downsample;
from theano.tensor.nnet import conv;
import telauges.nnfuns as nnf;
class ConvNetLayer(obje... |
import picker
def select_segnames(segname_list, system_description):
title_txt = 'Segments to include in model'
chosen_segnames = picker.Picker(
title = title_txt,
options = segname_list,
info = system_description
).getSelected()
return chosen_segnames |
import math # used for math.copysign(1, delta_x)
from point import Point
"""
Extensible image processing and Etch-a-sketch drawing program
Copyright (C) 2014 Oliver Hickman
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 ... |
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.schema import MetaData
NAMING_CONVENTION = {
"ix": 'ix_%(column_0_label)s',
"uq": "uq_%(table_name)s_%(column_0_name)s",
"fk": "fk_%(table_name)s_%(column_0_name)s_%(referred_table_name)s",
"pk": "pk_%(table_name)s"
}
metadata = Met... |
import os
from torndb import Connection
from tornado.options import options
import logging
logger = logging.getLogger(__name__)
from tasks import mltshp_task
import postmark
@mltshp_task()
def migrate_for_user(user_id=0, **kwargs):
"""
This tasks handles copying MLKSHK user data over to the MLTSHP tables.
"... |
from setuptools import setup, find_packages
with open("README.md", "r") as fh:
long_description = fh.read()
requirements = [
"python-jose",
"cryptography",
"everett",
"everett[ini]",
"configobj",
"flask",
"flask_cors",
"boto",
"boto3",
"botocore",
"six",
"aws-xray-sdk... |
from django.shortcuts import render
def cookie_policy(request):
return render(request, 'legal/cookie_policy.html')
def legal_terms(request):
return render(request, 'legal/terms.html') |
from flask import Flask
app = Flask(__name__)
def configure_app(app, production=True, debug=False):
app.debug = debug
app.use_evalex = False
return app |
FLAG_LOCATION = 'flag.png'
MINE_LOCATION = 'mine.png'
RED_X_LOCATION = 'red_x.png'
DIFFICULTY = 'beginner'
#ROWS = 16
#COLS = 30
#MINES = 99
#ROWS = 16
#COLS = 16
#MINES = 40
#ROWS = 9
#COLS = 9
#MINES = 10
BLACK = ( 0, 0, 0)
WHITE = ( 255, 255, 255)
DARKGREEN= ( 0, 100... |
import json
import itertools
import logging
import sys
import celery
import redis
from django.conf import settings
from django.utils import timezone
from laniakea.core.userdata import UserData
from celeryconf import app
from . import cron # noqa ensure cron tasks get registered
from .common.prices import get_price_med... |
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
from django.conf import settings
import cms.utils.permissions
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations ... |
from . import purchase |
from __future__ import absolute_import
import datetime
MAX_KEY_LENGTH = 8000
VCS_TYPES = ("arch", "bzr", "cvs", "darcs", "git", "hg", "mtn", "svn")
SLOCCOUNT_LANGUAGES = (
# sloccount 2.26 languages
"ada", "asm", "awk", "sh", "ansic", "cpp", "cs", "csh", "cobol", "exp",
"fortran", "f90", "haskell", "java", ... |
from django.contrib import admin
from .models import PlatformEmail
@admin.register(PlatformEmail)
class PlatformEmailAdmin(admin.ModelAdmin):
list_display = ('subject', 'sent')
date_hierarchy = 'sent' |
from odoo import fields, models
class FirebaseNotificationStatistics(models.Model):
_name = "firebase.notification.statistics"
_description = "Notification statistics"
notification_id = fields.Many2one(
"firebase.notification",
"Notification",
required=True,
ondelete="cascade... |
from osv import fields, osv
class oehealth_lab_test_unit(osv.osv):
_name = "oehealth.lab_test.unit"
_columns = {
'name' : fields.char('Unit', size=25),
'code' : fields.char('Code', size=25),
'info' : fields.text ('Description'),
}
_sql_constraints = [('name_uniq', 'unique(nam... |
import json
import re
import django.forms
from django.forms import MultiValueField, MultiWidget, FileField, DateInput
from django.forms.widgets import CheckboxSelectMultiple
from django.utils.safestring import mark_safe
from django.urls import reverse
from collections import OrderedDict
from rdrf.forms.dynamic import f... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.