code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
from django.contrib import admin
# Register your models here.
from .models import Topic, Post
class PostAdmin(admin.ModelAdmin):
list_display = ['owner', 'topic', 'date_created']
class PostInline(admin.TabularInline):
model = Post
extra = 0
fields = ['owner', 'content', 'date_created']
class Topi... | fabteam1/komsukomsuhuhu | komsukomsuhuu/entities/admin.py | Python | mit | 504 |
from abc import ABCMeta, abstractmethod
#Node object, important for traversing the search graph. Abstract class
#that contain abstract methods that has to be implemented by subclasses.
#These abstract methods, is what constitute the specialization of the A*
#for this problem domain.
class Node(object):
__metaclass... | olavvatne/agac | abstractnode.py | Python | mit | 2,220 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import sys
import requests
import yajl as json
import progressbar as pb
dir = os.path.split(os.path.split(os.path.realpath(__file__))[0])[0]
sys.path.append(dir)
from termcolor import colored as color
from utilities.prompt_format import item as I
def CreateDatase... | luiscape/hdxscraper-noaa | app/hdx_register/create.py | Python | mit | 10,196 |
import dnest4.classic as dn4
from pylab import *
plt.rcParams["font.family"] = "serif"
plt.rcParams["font.size"] = 16
plt.rc("text", usetex=True)
data = loadtxt('galaxies.txt')
posterior_sample = atleast_2d(dn4.my_loadtxt('posterior_sample.txt'))
x = linspace(0., 50.0, 10001)
def mixture(x, params):
N = int(para... | eggplantbren/DNest4 | code/Examples/RJObject_1DMixture/display.py | Python | mit | 1,414 |
import random
classes = [
('Barbarian', ['STR', 'CON', 'DEX', 'WIS', 'CHA', 'INT']),
('Bard', ['CHA', 'CON', 'STR', 'DEX', 'WIS', 'INT']),
('Cleric', ['WIS', 'CHA', 'CON', 'DEX', 'INT', 'STR']),
('Druid', ['WIS', 'CON', 'STR', 'DEX', 'INT', 'CHA']),
('Fighter', ['STR', 'CON', 'DEX', 'WIS', 'INT', '... | laisrael/Game-Tools-NPC-Generator | classgen.py | Python | mit | 1,109 |
#!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name='git2elastic',
version='0.0.1',
author='Avishai Ish-Shalom',
author_email='avishai.ishshalom@gmail.com',
packages=find_packages(),
entry_points={
'console_scripts': [
'git2elastic = git2elastic:g... | avishai-ish-shalom/git2elastic | setup.py | Python | mit | 506 |
from collections import defaultdict
from datetime import date
from itertools import count, product
from string import ascii_uppercase
from urllib.parse import urlparse
from github import Github
from slacker import Error
from src import settings
from src.utils import slack
from src.utils.google_api import get_service
... | beproud/bp-cron | src/handlers/github_reminder.py | Python | mit | 4,990 |
import copy
import re
import string
from connection import _cached_users
from context.nlp.entities import name_tokens, best_matches
from context.nlp.util import tokenize
from context.services import discover_twitter_users_via_bing
from context.services.twitter import get_timeline, discover_users
ALNUM_PAT = re.compil... | NUinfolab/context | web/stakeholders.py | Python | mit | 5,364 |
# -*- coding: utf-8 -*-
from __future__ import division, print_function, unicode_literals
try:
from crowdin.connection import Connection, Configuration
except ImportError:
from connection import Connection, Configuration
import six
import logging
import json
import zipfile
import shutil
import io
import os
l... | PaulGregor/crowdin-cli | crowdin/methods.py | Python | mit | 19,747 |
import datetime
try:
import urlparse
except (ImportError):
import urllib.parse as urlparse
import calendar
import pytz
import re
from maicroft.util import Util
from maicroft.activity_metrics_proc import process_metrics
from maicroft.activity_metrics_proc import process_submission_metrics
from maicroft.subreddi... | thundergolfer/mAIcroft | maicroft/social_info_extraction.py | Python | mit | 15,272 |
__author__ = 'adam'
import configparser
import os
import os.path
from sys import argv
import logging
import postgresql
import db
import parsing
# read configuration
config = configparser.ConfigParser()
config.read(argv[1:])
gsod_conf = config['GSOD FILES']
pg_conf = config['POSTGRES']
gsod_root = gsod_conf['bas... | dikaiosune/whether | py_whether/processor.py | Python | mit | 2,959 |
"""
Listens events:
forget (string)
Given string can be task name, remembered field (url, imdb_url) or a title. If given value is a
task name then everything in that task will be forgotten. With title all learned fields from it and the
title will be forgotten. With field value only that particular field i... | cvium/Flexget | flexget/plugins/filter/seen.py | Python | mit | 11,590 |
def ShellSort(A):
def GetCols(n):
cols = [1]
val = 1
while val < n:
val = int(val * 2.2)
cols.insert(0, val)
return cols
for h in GetCols(len(A)):
for i in range(h, len(A)):
cur = A[i]
j = i
while j >= h and A[j... | ActiveState/code | recipes/Python/577084_shell_sort/recipe-577084.py | Python | mit | 411 |
import _plotly_utils.basevalidators
class ColoraxisValidator(_plotly_utils.basevalidators.SubplotidValidator):
def __init__(
self,
plotly_name="coloraxis",
parent_name="scatterternary.marker.line",
**kwargs
):
super(ColoraxisValidator, self).__init__(
plotly... | plotly/plotly.py | packages/python/plotly/plotly/validators/scatterternary/marker/line/_coloraxis.py | Python | mit | 581 |
'''
Custom optimization routines for distributions where ML estimators perform
poorly or do not exist.
'''
import numpy as np
def _residual_error(self, theta, x, y_fun, **kwargs):
'''
Return special purspose lsq objective error function to minimize.
Method is overwritten to hook into scipy.stats optimiza... | 4Subsea/evapy | evapy/_optimize.py | Python | mit | 1,491 |
"""
Inverted Pendulum MPC control
author: Atsushi Sakai
"""
import matplotlib.pyplot as plt
import numpy as np
import math
import time
import cvxpy
print("cvxpy version:", cvxpy.__version__)
l_bar = 2.0 # length of bar
M = 1.0 # [kg]
m = 0.3 # [kg]
g = 9.8 # [m/s^2]
Q = np.diag([0.0, 1.0, 1.0, 0.0])
R = np.... | AtsushiSakai/PyAdvancedControl | inverted_pendulum_mpc_control/inverted_pendulum_mpc_control.py | Python | mit | 4,100 |
from proteus import *
from twp_navier_stokes_p import *
from dambreak_Gomez import *
if timeDiscretization=='vbdf':
timeIntegration = VBDF
timeOrder=2
stepController = Min_dt_cfl_controller
elif timeDiscretization=='flcbdf':
timeIntegration = FLCBDF
#stepController = FLCBDF_controller_sys
step... | erdc-cm/air-water-vv | 3d/dambreak_Gomez/twp_navier_stokes_n.py | Python | mit | 1,782 |
def str_length(line):
return len(line)
if __name__ == '__main__':
# These "asserts" using only for self-checking and not necessary for auto-testing
assert str_length("") == 0, "1st example";
assert str_length("mo") == 2, "2st example";
assert str_length("length") == 6, "3st example";
print("Co... | edwardzhu/checkio-solution | EmpireOfCode/common/Adamantite Mines/strlen.py | Python | mit | 391 |
# -*- coding: utf-8 -*-
#
# davos documentation build configuration file, created by
# sphinx-quickstart on Sat Jul 29 08:01:32 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All... | linuxserver/davos | docs/source/conf.py | Python | mit | 5,191 |
#!/usr/bin/python
import re
import smbus
# ===========================================================================
# Adafruit_I2C Class
# ===========================================================================
class Adafruit_I2C(object):
@staticmethod
def getPiRevision():
"Gets the version number of ... | 3DRPP/printer | Adafruit_MotorHAT/Adafruit_I2C.py | Python | mit | 5,465 |
import chainer
import chainer.functions as F
import chainer.links as L
class Cifar10(chainer.Chain):
def __init__(self, n_class, in_ch):
super().__init__(
conv1=L.Convolution2D(in_ch, 32, 5, pad=2),
conv2=L.Convolution2D(32, 32, 5, pad=2),
conv3=L.Convolution2D(32, 64,... | 0shimax/DL-vision | src/net/cifar10.py | Python | mit | 1,111 |
import pytest
from geonet.network import SteinerTree
from geonet.optimization import Instance, Solution, enum_fsts
def test_enum_fst():
'''Call and check the structure of result (but not content).'''
term_pos = {'a':(0,0), 'b':(10,0), 'c':(0,10)}
demand = {'a':-30, 'b':20, 'c':10}
diams = [0.4, 0.6, ... | leethargo/geonet | tests/test_optimization.py | Python | mit | 995 |
from __future__ import unicode_literals
from django.db import models
class Foo(models.Model):
user = models.ForeignKey('auth.User', on_delete=models.CASCADE)
name = models.CharField(max_length=100, default="A new foo")
def __str__(self):
return self.name
| cypreess/django-plans | demo/example/foo/models.py | Python | mit | 278 |
import os
import unittest
from conans.client.cache.cache import CONAN_CONF
from conans.client.conf import ConanClientConfigParser
from conans.paths import DEFAULT_PROFILE_NAME
from conans.test.utils.test_files import temp_folder
from conans.util.files import save
default_client_conf = '''[storage]
path: ~/.conan/data... | memsharded/conan | conans/test/unittests/util/client_conf_test.py | Python | mit | 1,569 |
# -*- coding: utf-8 -*-
# !/usr/bin/python
# mavri kütüphanesi yükle
import mavri
# json kütüphanesi yükle
import json
wiki='tr.wikipedia'
username= 'Mavrikant Bot'
# Kullanıcı girişi yap
xx = mavri.login(wiki, username)
# Giriş denemesini sonucunu ekrana JSON ile düzenleyerek yazdır
print json.dumps(json.loads(xx... | Mavrikant/WikiBots | deneme.py | Python | mit | 826 |
from lacuna.building import MyBuilding
class fission(MyBuilding):
path = 'fission'
def __init__( self, client, body_id:int = 0, building_id:int = 0 ):
super().__init__( client, body_id, building_id )
| tmtowtdi/MontyLacuna | lib/lacuna/buildings/boring/fission.py | Python | mit | 219 |
from django.db import models
models.options.DEFAULT_NAMES += ('_DATABASE',)
class Weekstructure(models.Model):
setid = models.TextField(max_length=10)
weeknumber = models.BigIntegerField(null=True, blank=True)
startdate = models.DateField(primary_key=True)
description = models.TextField(null=True, ma... | uclapi/uclapi | backend/uclapi/timetable/models.py | Python | mit | 65,300 |
"""
The command line interface for the Threema Gateway Callback Server.
"""
import asyncio
import functools
import click
import logbook
import logbook.more
from threema.gateway import __version__ as _version
from threema.gateway import (
Connection,
util,
)
from threema.gateway.e2e import AbstractCallback
fro... | threema-ch/threema-msgapi-sdk-python | threema/gateway/bin/callback_server.py | Python | mit | 4,446 |
from seth import versioning
from seth.tests import IntegrationTestBase
from seth.classy.rest import generics
class DefaultVersioningResource(generics.GenericApiView):
def get(self, **kwargs):
return {}
class NotShowVersionResource(generics.GenericApiView):
display_version = False
def get(self,... | jnosal/seth | seth/tests/test_versioning.py | Python | mit | 6,814 |
import logging
from logging.handlers import TimedRotatingFileHandler
log = logging.getLogger()
file_name = "./test.log"
logformatter = logging.Formatter('%(asctime)s [%(levelname)s]|%(message)s')
loghandle = TimedRotatingFileHandler(file_name, 'midnight', 1, 2)
loghandle.setFormatter(logformatter)
loghandle.suffix = '%... | ganmk/python-prctice | py-日志.py | Python | mit | 411 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import, division
from alchemist import management
from flask import Flask
class TestManager:
def setup(self):
self.app = Flask('alchemist')
self.app.config['COMPONENTS'] = ['alchemist']
def test_discover_commands(self)... | concordusapps/alchemist | alchemist/tests/test_management.py | Python | mit | 489 |
import tensorflow as tf
import numpy as np
from tensorflow.examples.tutorials.mnist import input_data
from IPython import embed
from tensorflow import flags
def main(_):
mnist = input_data.read_data_sets("./data", one_hot=True)
# defien model input: image and ground-truth label
model_inputs = tf.placeholder(dty... | kiseyno92/SNU_ML | Practice7/code/eval.py | Python | mit | 1,438 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-08-20 01:22
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('app', '0002_auto_20170819_2342'),
]
operations = [
migrations.RemoveField(
... | rcatlin/ryancatlin-info | Api/app/migrations/0003_remove_tag_articles.py | Python | mit | 388 |
#!/usr/bin/env python
from lib.swap import *
def insertion_sort(L=[]):
''' Unstable implementation of insertion sort.
:param L: list of sortable elements.
'''
if len(L) < 2: return L
for i in range(len(L)):
j = i
while j and L[j] < L[j-1]:
swap(L, j, j-1)
j -... | pymber/algorithms | algorithms/sorting/insertion_sort.py | Python | mit | 336 |
"""Root URL definitions."""
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib import admin
urlpatterns = [
url(r'^accounts/', include('accounts.urls', namespace='accounts')),
url(r'^admin/', admin.site.urls),
url(r'^'... | knyghty/bord | bord/urls.py | Python | mit | 413 |
# -*- coding: utf-8 -*-
#
# This class was auto-generated from the API references found at
# https://epayments-api.developer-ingenico.com/s2sapi/v1/
#
from ingenico.connect.sdk.data_object import DataObject
class ConvertAmount(DataObject):
__converted_amount = None
@property
def converted_amount(self):
... | Ingenico-ePayments/connect-sdk-python3 | ingenico/connect/sdk/domain/services/convert_amount.py | Python | mit | 1,045 |
import vtk
from vtk.util.misc import vtkGetDataRoot
import render_mpr
reader = vtk.vtkMetaImageReader()
reader.SetFileName("C:\\Users\\fei.wang\\PycharmProjects\\Rendering\\data\\org.mha")
reader.Update()
render_mpr = render_mpr.RendererMPR()
render_mpr.set_volume(reader)
render_mpr.set_output_image_siz... | comedate/VolumeRendering | test_mpr.py | Python | mit | 580 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/network/azure-mgmt-network/azure/mgmt/network/v2020_04_01/aio/operations/_virtual_network_peerings_operations.py | Python | mit | 22,821 |
import dilap.core.uinfo as di
import dilap.core.sgraph as dsg
import dilap.core.model as dm
import dilap.io.io as dio
import dilap.degenerate.overgrown as dog
import pdb
iotypes = dio.iotypes
###############################################################################
### simple functions which return simple dila... | ctogle/dilapidator | src/dilap/BROKEN/destruct.py | Python | mit | 951 |
# coding: utf-8
"""
Qc API
Qc API # noqa: E501
The version of the OpenAPI document: 3.0.0
Contact: cloudsupport@telestream.net
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
from telestream_cloud_qc.configuration import Configuration
class... | Telestream/telestream-cloud-python-sdk | telestream_cloud_qc_sdk/telestream_cloud_qc/models/partition_status_test.py | Python | mit | 8,207 |
from setuptools import setup
setup(
name='Cumuliform',
version='0.1.0',
author="Ross Delinger",
author_email="rdelinger@helixoide.com",
packages=['cumuliform'],
license='license.txt',
description='Listen to the latest sound cloud tracks on hypem spy',
long_description=open('README.txt')... | rossdylan/cumuliform | setup.py | Python | mit | 531 |
from __future__ import division
from scipydirect import minimize
import numpy as np
from mpl_toolkits.mplot3d import axes3d
import matplotlib.pyplot as plt
from matplotlib import cm
import os
def obj(x):
"""Six-hump camelback function"""
x1 = x[0]
x2 = x[1]
f = (4 - 2.1*(x1*x1) ... | andim/scipydirect | doc/tutorialfig.py | Python | mit | 947 |
# Copyright 2018 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
# License MIT (https://opensource.org/licenses/MIT).
{
"name": """WeChat Payments in POS""",
"summary": """Support WeChat QR-based payments (scan and show)""",
"category": "Point of Sale",
# "live_test_url": "",
"images": ["... | it-projects-llc/pos-addons | pos_wechat/__manifest__.py | Python | mit | 1,032 |
from microbit import *
import music
# Plays a different note when pressing different fruits
# Put a buzzer between pin0 and Gnd
# Attach a fruit to Pin1 and Pin2
# Have a loose wire from Gnd
# Hold the Gnd wire
# Press your other hand on the fruits to hear notes
note_low = ["C4:4"]
note_high = ["C5:4"]
while True:... | garybake/microbake | fruity_notes.py | Python | mit | 547 |
from dbhelper import DBHelper
from flask import Flask
from flask import render_template
from flask import request
app = Flask(__name__)
DB = DBHelper()
@app.route("/")
def home():
try:
data = DB.get_all_inputs()
except Exception as e:
print e
data = None
return render_template("ho... | abacuspix/NFV_project | Flask_By_Example/chapter6/crimemap.py | Python | mit | 726 |
#!/usr/bin/env python
import sys
sys.path.append("../")
import unittest
import numpy as np
from toy_datasets import load_digit_dataset
from lib.optimization import mini_batch_sgd, mini_batch_sgd_with_annealing
class skLearnDigitTest(unittest.TestCase):
def setUp(self):
tr_data, xtr_data, ts_data = load_di... | mitenjain/R3N | tests/nnTests.py | Python | mit | 5,157 |
__author__ = 'thor'
from bs4 import BeautifulSoup
from functools import wraps
@wraps(BeautifulSoup.find_all, assigned=('__module__', '__qualname__', '__annotations__', '__name__'))
def gen_find(tag, *args, **kwargs):
"""Does what BeautifulSoup.find_all does, but as an iterator.
See find_all documentation... | thorwhalen/ut | slurp/util.py | Python | mit | 2,391 |
# coding: utf-8
"""
Those are common settings overwritten for more specific tasks
You should use either settings.development or settings.production
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
# One level up from this file (dirname(dirname()) == ../)
BASE_DIR = os.path.dirna... | robsontpm/hiruotso | src/hiruotso/settings/common.py | Python | mit | 2,916 |
from releash import *
# these objects only tag when they are exe
gitpush = ReleaseTargetGitPush()
# core package
core = add_package("packages/vaex-core", "vaex-core")
version_core = VersionSource(core, '{path}/vaex/core/_version.py')
gittag_core = ReleaseTargetGitTagVersion(version_source=version_core, prefix='core-v'... | maartenbreddels/vaex | .releash.py | Python | mit | 3,029 |
from state.logging_state_provider import LoggingStateProviderWithListeners
from sensorfusion.height_provider import HeightProvider
from sensorfusion.attitude_provider import AttitudeProvider, AttitudeState
class SensorFusionMaster(LoggingStateProviderWithListeners):
"""
This class is responsible for taki... | timdelbruegger/freecopter | src/python3/sensorfusion/fusion_master.py | Python | mit | 987 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-05-12 11:51
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('ossuo', '0021_merge'),
('ossuo', '0022_signupformpage_signupformpagebullet_signupformpagelogo... | spketoundi/CamODI | waespk/core/migrations/0023_merge.py | Python | mit | 399 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/servicebus/azure-mgmt-servicebus/azure/mgmt/servicebus/v2015_08_01/operations/_namespaces_operations.py | Python | mit | 52,182 |
#!/usr/bin/env python
#title :comsumeMsgs.py
#description :The class is a simple cosumer to print message
#author :Ajay Krishna Teja Kavuri
#date :01252017
#version :0.1
#==============================================================================
# Libraries
from kafka impor... | PseudoAj/MyInsightRepo | data/examples/consumer/comsumeMsgs.py | Python | mit | 1,513 |
'''
Created on 21.03.2012
@author: michi
'''
from PyQt4.QtGui import QTableView
from ems.qt4.gui.mapper.base import BaseStrategy #@UnresolvedImport
from ems.xtype.base import DictType, ObjectInstanceType #@UnresolvedImport
from ems.qt4.gui.itemdelegate.xtypes.objectinstancetype import ObjectInstanceDelegate #@Unresol... | mtils/ems | ems/qt4/gui/mapper/strategies/dict_strategy.py | Python | mit | 857 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'FilterListItemCopy.date_created'
db.alter_column('api_... | haystack/eyebrowse-server | api/migrations/0003_auto__chg_field_filterlistitemcopy_date_created.py | Python | mit | 6,965 |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import common
import SocketServer
import sys
class UDPEchoHandler(SocketServer.BaseRequestHandler):
"""
This class works similar to the TCP handler class, except that
self.request consists of a pair of data and client socket, and since
there is no conne... | if1live/wireless-latency-benchmark | benchmark/udp_server.py | Python | mit | 877 |
from distutils.core import setup
import os
root_dir = os.path.dirname(__file__)
if root_dir:
os.chdir(root_dir)
data_files = []
for dirpath, dirnames, filenames in os.walk('endless_pagination'):
for i, dirname in enumerate(dirnames):
if dirname.startswith('.'): del dirnames[i]
if '__init__.py' in ... | fhahn/django-endless-pagination | setup.py | Python | mit | 1,430 |
#!/usr/bin/env python
import os
import shutil
import time
import yaml
import util
import simulator
from lib import gsample
from tools import fastq2sam
from lib import sam
class Teaser:
def __init__(self, mate, config):
self.mate = mate
self.config = config
self.supported_platforms = ["illumina","454","ion_to... | Cibiv/Teaser | lib/teaser.py | Python | mit | 17,308 |
from brv1 import *
main()
| bveina/TempSensorNode | main.py | Python | mit | 26 |
<<<<<<< HEAD
<<<<<<< HEAD
from test.support import verbose, run_unittest, import_module, reap_children
#Skip these tests if either fcntl or termios is not available
fcntl = import_module('fcntl')
import_module('termios')
import errno
import pty
import os
import sys
import select
import signal
import socket
import uni... | ArcherSys/ArcherSys | Lib/test/test_pty.py | Python | mit | 33,998 |
# -*- coding: utf-8 -*-
import json
import tornado.web
import logging
from template_settings import Jinja2TemplateRender
logger = logging.getLogger('tutu.' + __name__)
class BaseHandler(tornado.web.RequestHandler, Jinja2TemplateRender):
"""A class to collect common handler methods - all other handlers should
... | shizhz/tutu | handlers/base.py | Python | mit | 1,997 |
'''@file nnet.py
contains the functionality for a Kaldi style neural network'''
import shutil
import os
import itertools
import numpy as np
import tensorflow as tf
import classifiers.activation
from classifiers.dnn import DNN
from trainer import CrossEnthropyTrainer
from decoder import Decoder
class Nnet(object):
... | waterxt/tensorflowkaldi | neuralNetworks/nnet.py | Python | mit | 9,220 |
import tft_ir_api as IR
n = 2
unrolls = 2
low = 1.0
high = 10.0
A = list()
for j in range(n):
row = list()
for i in range(n):
row.append(IR.RealVE("a{}{}".format(i,j), 0, low, high))
A.append(row)
b = list()
for i in range(n):
b.append(IR.RealVE("b{}".format(i), 1, low, high))
x = li... | soarlab/FPTuner | examples/micro/jacobi-n2u2.py | Python | mit | 916 |
# -*- coding: utf-8 -*-
##################################################################
# Example of usage:
##################################################################
from __future__ import print_function, division, absolute_import
import sys
import time
import inspect
from numbers import Number
from dateti... | imito/odin | odin/utils/progbar.py | Python | mit | 17,930 |
class Frame:
def __init__(self,width,height,color):
self.width = width
self.height = height
self.data = []
for h in range(height):
row = []
for w in range(width):
row.append(color)
self.data.append(row)
def clear(self,color):
for h in range(self.height):
for w in range(self.width):
s... | keyvank/pyglare | pyglare/image/frame.py | Python | mit | 343 |
# -*- coding: utf-8 -*-
'''
An interface for music21 using mod_wsgi
To use, first install mod_wsgi and include it in the HTTPD.conf file.
Add this file to the server, ideally not in the document root,
on mac this could be /Library/WebServer/wsgi-scripts/music21wsgiapp.py
Then edit the HTTPD.conf file to re... | arnavd96/Cinemiezer | myvenv/lib/python3.4/site-packages/music21/alpha/webapps/server/urlqueryapp.py | Python | mit | 3,408 |
"""
To use the SQLite3 module we need to add an import statement to our python script:
________________________________________________________________________________
>>> import sqlite3
________________________________________________________________________________
We can check sqlite version:
_______________________... | Valka7a/python-playground | sqlite3/tutorials/module-in-python.py | Python | mit | 756 |
from django.db import models
class Build(models.Model):
build_id = models.CharField(max_length=64, primary_key=True)
build_date = models.DateTimeField()
target_machine = models.CharField(max_length=64)
class BuildDetails(models.Model):
build = models.ForeignKey(Build, on_delete=models.CASCADE)
rep... | alimon/reproducible-builds | mainapp/models.py | Python | mit | 1,040 |
# -*- coding: utf-8 -*-
import json
from scrapy.xlib.pydispatch import dispatcher
from scrapy import signals
from scrapy.contrib.exporter import JsonItemExporter
class LetrasPipeline(object):
def process_item(self, item, spider):
return item
# class JsonExportPipeline(object):
# def __init__(self):
#... | Diegow3b/tastypie-api-scrapy | crawler/pipelines.py | Python | mit | 970 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/datadog/azure-mgmt-datadog/azure/mgmt/datadog/models/__init__.py | Python | mit | 6,653 |
import unittest
import numpy as np
import bayesnet as bn
class TestAdd(unittest.TestCase):
def test_add(self):
x = bn.Parameter(2)
z = x + 5
self.assertEqual(z.value, 7)
z.backward()
self.assertEqual(x.grad, 1)
x = np.random.rand(5, 4)
y = np.random.rand(4... | ctgk/BayesianNetwork | test/math/test_add.py | Python | mit | 561 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('post_office', '0002_auto_20150204_1403'),
]
operations = [
migrations.AddField(
model_name='emailbackend',
... | CasherWest/django-post_office | post_office/migrations/0003_auto_20150608_1115.py | Python | mit | 699 |
# sgmake script to use clang instead of gcc
makefile_params=["CXX=\'clang++\'"]
| flipcoder/bitplanes | sg.py | Python | mit | 80 |
"""
The collection of decorators for the ``color()`` method, each CA model
should have.
The method should be decorated by one of the classes below, otherwise
the correct model behavior will not be guaranteed.
All decorators are get the ``(red, green, blue)`` tuple from
``color()`` method, then process it to create so... | a5kin/hecate | xentica/core/color_effects.py | Python | mit | 4,034 |
import subprocess
import sys
import re
streams = {
"main": "http://173.231.136.91:8000/",
"random": "http://173.231.136.91:8050/",
"rock": "http://173.231.136.91:8020/",
"metal": "http://173.231.136.91:8090/",
"indie": "http://173.231.136.91:8070/"
}
def main():
if len(sys.argv) > 1:
s... | gkbrk/radioreddit-cli | radioreddit-cli.py | Python | mit | 1,333 |
#local urls.py file
from django.conf.urls import url, include
from . import views
urlpatterns = [
#url(r'^', views.appView.postLocation, name = 'postLocation'),
url(r'^volunteer/', views.appView.member, name = 'member'),
#url(r'^(?P<member_id>[0-9]+)/$', views.appView.detail, name = 'd... | Fazer56/Assignment3 | charitysite/volunteer/urls.py | Python | mit | 352 |
"""feedfinder: Find the Web feed for a Web page
http://www.aaronsw.com/2002/feedfinder/
Usage:
feed(uri) - returns feed found for a URI
feeds(uri) - returns all feeds found for a URI
>>> import feedfinder
>>> feedfinder.feed('scripting.com')
'http://scripting.com/rss.xml'
>>>
>>> feedfinder.fe... | Einsteinish/PyTune3 | utils/feedfinder.py | Python | mit | 13,462 |
import math
print "loaded script"
#LoadScript("Map.py")
LoadScript("Entity.py")
LoadScript("StateMachine.py")
LoadScript("WaitState.py")
LoadScript("Util.py")
LoadScript("Actions.py")
LoadScript("Trigger.py")
gTiledMap = TileMap.LoadMap("small_room.json")
gMap = Map(gTiledMap)
gMap.GotoTile(5,5)
class Chara... | ericrrichards/rpgEngine | RpgEngine/RpgEngine/Scripts/Main.py | Python | mit | 1,809 |
## Demonstrate PyPSA unit commitment with a one-bus two-generator example
#
#
#This tutorial runs through examples of unit commitment for generators at a single bus. Examples of minimum part-load, minimum up time, minimum down time, start up costs, shut down costs and ramp rate restrictions are shown.
#
#To enable unit... | PyPSA/PyPSA | examples/unit-commitment.py | Python | mit | 5,541 |
# "Smart" parser for handling libmagic signature results. Specifically, this implements
# support for binwalk's custom libmagic signature extensions (keyword tags, string processing,
# false positive detection, etc).
import re
import binwalk.core.module
from binwalk.core.compat import *
from binwalk.core.common import... | Tepira/binwalk | src/binwalk/core/smart.py | Python | mit | 12,128 |
"""Init Extension."""
from flask_cache import Cache
cache = Cache()
def setup_app(app):
"""Init the extension with app context."""
cache.init_app(app)
return app
| PawelPamula/who-are-you | webfest/extensions/cache/__init__.py | Python | mit | 178 |
N, K = map(int, input().split())
A = [int(input()) for _ in range(N)]
A.sort()
dp = [[0] * int(2e5) for _ in range(2)]
dp[0][0] = 1
limit = 0
MOD = 10 ** 9 + 7
for i in range(N):
prev, now = i % 2, (i + 1) % 2
for j in range(limit + 1):
dp[now][j] = dp[prev][j]
for j in range(limit + 1):
dp[... | knuu/competitive-programming | atcoder/corp/codethanksfes2017_f.py | Python | mit | 421 |
import unittest
import smarty
from openforcefield.typing.chemistry.environment import *
from openforcefield.utils.utils import read_molecules
from smarty.sampler_smirky import *
from smarty import utils
from smarty import score_utils
from operator import itemgetter, attrgetter
import openeye.oechem
from openeye.oechem ... | open-forcefield-group/smarty | smarty/tests/test_smirky_sampler.py | Python | mit | 7,993 |
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
import os, sys
import pkg_resources
import norikraclient
long_description = open(os.path.join("README.rst")).read()
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: System Administrators",
"License :: OSI Approve... | norikra/norikra-client-python | setup.py | Python | mit | 1,304 |
import numpy as np
import matplotlib.pyplot as plt
import pylab
import scipy.integrate as integrate
x= -500
y= -500
z = 10
# Konstanten fuer CMZ
xc =-50 # Position Mitte in allg Koordinaten
yc = 50
TettaC = 70
#Konstanten fuer DISK
alpha = 13.5
beta = 20.
TettaD = 48.5
# Abmessungen in CMZ Koordinaten
XMAX=250
... | lukasmerten/GitPlayground | UsefulPythonScripts/Ferrie2007_Innen.py | Python | mit | 3,648 |
# ----------------------------------------------------------------------
# Copyright (c) 2014 Rafael Gonzalez.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including... | astrorafael/ema | ema/dev/photometer.py | Python | mit | 4,416 |
# Set modules to be exported with "from oaxmlapi import *"
__all__ = ['commands', 'connections', 'datatypes', 'utilities']
| derekperry/oaxmlapi | oaxmlapi/__init__.py | Python | mit | 123 |
# -*- coding: utf-8 -*-
#------------------------------------------------------------------------------
# Copyright (c) 2012-2014, Michael Reuter
# Distributed under the MIT License. See LICENSE.txt for more information.
#------------------------------------------------------------------------------
from .moon_info im... | mareuter/lct-python | lct/utils/observing_info.py | Python | mit | 1,166 |
'''
salt.targeting
~~~~~~~~~~~~~~
'''
import logging
log = logging.getLogger(__name__)
from .parser import *
from .query import *
from .rules import *
from .subjects import *
#: defines minion targeting
minion_targeting = Query(default_rule=GlobRule)
minion_targeting.register(GlobRule, None, 'glob')
minion_target... | johnnoone/salt-targeting | src/salt/targeting/__init__.py | Python | mit | 816 |
#!/usr/bin/env python
from setuptools import setup
from mp import version
setup(
name="mpfshell",
version=version.FULL,
description="A simple shell based file explorer for ESP8266 and WiPy "
"Micropython devices.",
author="Stefan Wendler",
author_email="sw@kaltpost.de",
url="https://github... | wendlers/mpfshell | setup.py | Python | mit | 673 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import functools
import hypothesis
from hypothesis import given, settings, HealthCheck
import hypothesis.strategies as st
import numpy as np
from caffe2.python import c... | ryfeus/lambda-packs | pytorch/source/caffe2/python/operator_test/adadelta_test.py | Python | mit | 7,954 |
#!/usr/bin/python
import shutil, string, sys, tempfile
from argparse import ArgumentParser
from fbreader.format.epub import EPub
def verify_key(key, name):
if len(key) != 32:
raise Exception('Incorrect %s length %d, 32 expected' % (name, len(key)))
for sym in key:
if not sym in string.hexdigi... | geometer/book_tools | encrypt.py | Python | mit | 1,584 |
from __future__ import unicode_literals
import re
try:
from collections import OrderedDict
except ImportError:
OrderedDict = None
from django import forms
from django.utils.translation import ugettext_lazy as _
from django.contrib import auth
from django.contrib.auth import get_user_model
from account.conf... | ntucker/django-user-accounts | account/forms.py | Python | mit | 7,903 |
from django.conf.urls import url
from refreshtoken.routers import router
from refreshtoken.views import DelegateJSONWebToken
urlpatterns = router.urls + [
url(r'^delegate/$', DelegateJSONWebToken.as_view(),
name='delegate-tokens'),
]
| lock8/django-rest-framework-jwt-refresh-token | tests/urls.py | Python | mit | 248 |
import os
import sys
import logging
from pyomo.environ import *
from pyomo.opt import TerminationCondition
import numpy as np
import pandas as pd
class CALVIN():
def __init__(self, linksfile, ic=None, log_name="calvin"):
"""
Initialize CALVIN model object.
:param linksfile: (string) CSV file containin... | msdogan/pyvin | calvin/calvin.py | Python | mit | 16,224 |
from lib.modtag import *
from lib.modtag.tracker import *
from struct import unpack
class ModuleFormat():
"""Interface for different module formats."""
@property
def name(self):
raise NotImplementedError("module format must have a name")
@classmethod
def identify(cls, bytes):
"""Checks if the given bytes... | seece/modrip | lib/modtag/format.py | Python | mit | 4,161 |
"""
Task
Students of District College have subscription of English and French newspapers. Some students have subscribed to only English, some have subscribed to only French and some have subscribed to both newspapers.
You are given two sets of roll numbers of students, who have subscribed to English and French newspap... | spradeepv/dive-into-python | hackerrank/domain/python/sets/intersection.py | Python | mit | 1,336 |
from mock import patch
from django.contrib.contenttypes.models import ContentType
from django.contrib.sites.models import Site
from django.contrib.auth import get_user_model
from django.core import exceptions
from django_dynamic_fixture import G
from django_webtest import WebTest
from icekit.models import Layout
from... | ic-labs/django-icekit | icekit/plugins/map/tests.py | Python | mit | 2,961 |
from simulator.BaseEvaluator import BaseEvaluator
from simulator.TradeSimulator import TradeSimulator
from utils.csvdata import get_data_of_symbol
from analysis.portfolio import get_portfolio_stats
import importlib
import numpy as np
class StrategyEvaluator(BaseEvaluator):
def __init__(self, start_date, end_date... | hchim/stockanalyzer | simulator/StrategyEvaluator.py | Python | mit | 2,074 |
#!/usr/bin/env python3
if __name__ == '__main__':
from collatz import collatz
import argparse
desc = 'Find the number with the longest Collatz sequence under a given ceiling.'
parser = argparse.ArgumentParser(description=desc)
parser.add_argument('ceiling', type=int, default=13, nargs='?')
arg... | tylermumford/euler | 14/python/main.py | Python | mit | 752 |