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
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('management', '0016_demoresourcedata_validation_result'), ] operations = [ migrations.AlterField( model_name='dem...
gregoil/rotest
src/rotest/management/migrations/0017_auto_20181202_0752.py
Python
mit
434
import os import unittest from pyfluka.utils import ShellUtils class TestShellUtils(unittest.TestCase): def setUp(self): pass def tearDown(self): os.removedirs("testdir") def testMkDir(self): self.assertFalse(os.path.exists("testdir")) ShellUtils.mkdir("testdir") ...
morgenst/pyfluka
tests/TestShellUtils.py
Python
mit
364
""" Ethiopian Movie Database. """ __author__ = "EtMDB Developers (developers@etmdb.com)" __date__ = "Date: 25/05/2017" __version__ = "Version: 1.0" __Copyright__ = "Copyright: @etmdb" """ etmdbots URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangop...
etmdb/facebookbot
etmdbots/urls.py
Python
mit
1,010
''' sentlex.py - Lexicon Management Classes This module implements class structure for sentment lexicons used elsewhere in SentimentAnalysis. Sentiment lexicons encapsulate information from publicly available Lexicons from research literature in a common Pythonic interface. What a Lexicon object does: - for a given ...
bohana/sentlex
sentlex/sentlex.py
Python
mit
18,601
import pathlib import subprocess import sys import unittest import numpy import pytest from cupy.cuda import nccl from cupy import testing from cupyx.distributed import init_process_group nccl_available = nccl.available def _run_test(test_name, dtype=None): # subprocess is required not to interfere with cupy ...
cupy/cupy
tests/cupyx_tests/distributed_tests/test_comm.py
Python
mit
2,852
#!/usr/bin/env python """Convert text and (start, end type) annotations into HTML.""" __author__ = 'Sampo Pyysalo' __license__ = 'MIT' import sys import json import re import unicodedata from collections import namedtuple from collections import defaultdict from itertools import chain # the tag to use to mark anno...
restful-open-annotation/restoa-explorer
so2html.py
Python
mit
25,363
import wegene wegene.Configuration.BASE_URI = 'https://api.wegene.com' wegene.Configuration.o_auth_access_token = '<A Valid Access Token with Proper Scope>' profile_id = '' try: user = wegene.WeGeneUser().get_user() profile_id = user.profiles[0].id print('--- Profile ---') print(profile_id) print(...
xraywu/wegene-python-sdk
example/query/example.py
Python
mit
3,770
#! /usr/bin/env python # coding=utf8 from BotModule import BotModule import urllib2 import unicodedata from BeautifulSoup import BeautifulSoup import os, sys, re, time, datetime # This seems like somebody did not know what they were doing... def toFloat(s): f = 0.0 try: f = float(s) except: pass return f ...
fsi-hska/fsiBot
modules/MensaModule.py
Python
mit
4,149
#!/usr/bin/env python # -*- coding: utf-8 -*- # Author: Moises Gautier Gomez # Proyecto fin de carrera - Ing. en Informatica # Universidad de Granada # Configuracion del ORM de Django para su uso externo a la aplicacion import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "secproject.settings") from django.c...
MGautier/security-sensor
trunk/version-1-0/webapp/secproject/controller.py
Python
mit
9,212
import urllib import json import numpy as np import pandas as pd import multiprocessing from multiprocessing.pool import ThreadPool from functools import partial import time from yelp.client import Client from yelp.oauth1_authenticator import Oauth1Authenticator import config as cf class Timer: def __init__(se...
FiniteElementries/OneBus
Database/query_api.py
Python
mit
8,957
import unittest from word2number import w2n class TestW2N(unittest.TestCase): def test_positives(self): self.assertEqual(w2n.word_to_num("two million three thousand nine hundred and eighty four"), 2003984) self.assertEqual(w2n.word_to_num("nineteen"), 19) self.assertEqual(w2n.word_to_num("...
akshaynagpal/w2n
unit_testing.py
Python
mit
3,007
""" Django settings for project. Generated by 'django-admin startproject' using Django 1.9.4. For more information on this file, see https://docs.djangoproject.com/en/1.9/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.9/ref/settings/ """ import os # Build p...
chitnguyen169/connect4CaseStudy
app/settings.py
Python
mit
4,650
import functools import re from django.db import connections, connection from six import text_type import sqlparse from . import app_settings EXPLORER_PARAM_TOKEN = "$$" # SQL Specific Things def passes_blacklist(sql): clean = functools.reduce(lambda sql, term: sql.upper().replace(term, ""), [t.upper() for t...
enstrategic/django-sql-explorer
explorer/utils.py
Python
mit
4,026
import time import requests from requests.compat import urljoin from twitch.conf import backoff_config from twitch.constants import BASE_URL DEFAULT_TIMEOUT = 10 class TwitchAPI(object): """Twitch API client.""" def __init__(self, client_id, oauth_token=None): """Initialize the API.""" sup...
tsifrer/python-twitch-client
twitch/api/base.py
Python
mit
3,006
#!/usr/bin/env python3 ''' Convert debug info for C interpreter debugger. Usage: tools/gen_debug_info.py src/game/game_debuginfo.h ''' import sys import sundog_info out = sys.stdout def gen(out): proclist = sundog_info.load_metadata() info = [] for k,v in proclist._map.items(): if v.name is not N...
laanwj/sundog
tools/gen_debug_info.py
Python
mit
857
"""Routines related to PyPI, indexes""" from __future__ import absolute_import import cgi import itertools import logging import mimetypes import os import posixpath import re import sys from collections import namedtuple from pip._vendor import html5lib, requests, six from pip._vendor.distlib.compat import unescape ...
TeamSPoon/logicmoo_workspace
packs_web/butterfly/lib/python3.7/site-packages/pip/_internal/index.py
Python
mit
34,791
import argparse import os import requests API_URL = "https://api.assemblyai.com/v2/" def get_transcription(transcription_id): """Requests the transcription from the API and returns the JSON response.""" endpoint = "".join([API_URL, "transcript/{}".format(transcription_id)]) headers = {"authorization...
fullstackpython/blog-code-examples
transcribe-speech-text-script/get_transcription.py
Python
mit
953
# -*- coding: utf-8 -*- # PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN: # https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code from ccxt.base.exchange import Exchange import json from ccxt.base.errors import ExchangeError from ccxt.base.errors import AuthenticationE...
ccxt/ccxt
python/ccxt/ndax.py
Python
mit
95,009
""" GitHub methods that are functionally separate from anything Sublime-related. """ import re from collections import namedtuple from webbrowser import open as open_in_browser from functools import partial import sublime from ..common import interwebs GitHubRepo = namedtuple("GitHubRepo", ("url", "fqdn", "owner", ...
ypersyntelykos/GitSavvy
github/github.py
Python
mit
3,189
#Este programa muestra el codigo para entrenar una red neuronal basado en el #bloque Resnet #Para empezar se carga las librerias necesarias de Keras y de Numpy from keras.models import Model from keras.models import Sequential from keras.layers import merge from keras.layers import normalization from keras.lay...
a-bacilio/Codigo-de-tesis-descarte
mapahsl_resnet.py
Python
mit
7,546
from __future__ import absolute_import, unicode_literals import django from django import forms from django.conf import settings from django.contrib.admin.templatetags.admin_static import static from django.contrib.admin.widgets import AdminTextareaWidget from django.template import Context from django.template.loader...
djangonauts/django-hstore
django_hstore/widgets.py
Python
mit
2,389
# -*- coding: utf-8 -*- # # Guidoc documentation build configuration file, created by # sphinx-quickstart on Sun Aug 7 16:13:07 2016. # # 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. # # Al...
kevinpt/guidoc
doc/conf.py
Python
mit
8,757
#!/usr/bin/python3 import os import sys import http.server import socketserver import socket import shutil from base64 import b64encode from urllib.parse import quote from os.path import basename, splitext, join, isfile from collections import defaultdict from subprocess import run from distutils.dir_util import copy_...
bitterfly/kuho
examples/html_test/static/generate.py
Python
mit
5,311
__program_name__ = 'RabbitHole' __version__ = '1.0.0'
LeadPipeSoftware/LeadPipe.RabbitHole
RabbitHole/__init__.py
Python
mit
54
from utils.testcase import EndpointTestCase from rest_framework import status from rest_framework.test import APIClient from player.models import Room import sure class TestRooms(EndpointTestCase): def test_get(self): client = APIClient() response = client.get('/rooms') response.status_c...
Amoki/Amoki-Music
endpoints/tests/test_rooms.py
Python
mit
772
# -*- coding: utf-8 -*- from __future__ import print_function import time import numpy as np from six.moves import range import acq4.util.ptime as ptime from acq4.Manager import logMsg from acq4.devices.OptomechDevice import OptomechDevice from acq4.util import Qt from acq4.util.HelpfulException import HelpfulExcept...
acq4/acq4
acq4/devices/Scanner/Scanner.py
Python
mit
18,048
# -*- coding: utf-8 -*- import os from pyhammer.tasks.taskbase import TaskBase from pyhammer.utils import execProg class VsTestTask(TaskBase): """Cs Project Build Step""" def __init__( self, csProjectPath ): super(VsTestTask, self).__init__() self.command = """vstest.console.exe \"%s\...
webbers/pyhammer
pyhammer/tasks/helpers/vstesttask.py
Python
mit
680
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('dashboards', '0002_auto_20150615_0916'), ('users', '0001_initial'), ] operations = [ migrations.AddField( ...
alphagov/stagecraft
stagecraft/apps/dashboards/migrations/0003_dashboard_owners.py
Python
mit
484
import gpioRap as gpioRap import RPi.GPIO as GPIO import subprocess import time import random #Create GpioRap class using BCM pin numbers gpioRapper = gpioRap.GpioRap(GPIO.BCM) #Create an LED, which should be attached to pin 17 white1 = gpioRapper.createLED(4) white2 = gpioRapper.createLED(17) red1 = gpioRapper.creat...
martinohanlon/pumpkinpi
pumpkinpi.py
Python
mit
2,293
#!/usr/bin/env python # -*- coding: utf-8 -*- # pyvows testing engine # https://github.com/heynemann/pyvows # Licensed under the MIT license: # http://www.opensource.org/licenses/mit-license # Copyright (c) 2013 Richard Lupton r.lupton@gmail.com from pyvows import Vows, expect from pyvows.reporting import VowsDefaul...
marcelometal/pyvows
tests/reporting/error_reporting_vows.py
Python
mit
3,044
# (c) 2017 Gregor Mitscha-Baude import numpy as np from nanopores import user_params, user_param import nanopores.models.pughpore as pugh from folders import fields ddata = {2: dict(name="Dpugh", Nmax=1e5, dim=2, r=0.11, h=1.0), 3: dict(name="Dpugh", Nmax=2e6, dim=3, r=0.11, h=2.0)} physp = dict( bV = -0...
mitschabaude/nanopores
scripts/forcefield/ff_one.py
Python
mit
808
import rupes import twitter import time import logging def main(): # Start logging logging.basicConfig(filename="/homec/organis2/rupes_murdoch/rupes.log", level='DEBUG') # Connect to API consumer_key = 'F1aosrucfBbYnJwZLfUrQLxh9' consumer_secret = open("/homec/organis2/rupes_murdoch/private/consum...
organisciak/rupe_bot
rupe_bot.py
Python
mit
2,010
from ..Security import * from ..Resources import * from ...Library import * def getAccessToken(refreshToken, preferredServerName=None): #Decode and validate refreshToken credentials = Crypt.getUsernameAndPasswordFromToken(refreshToken) if not credentials: return response.makeError(constants.ERROR_USER_REFRESH_TOK...
KJSCE-C12/VDOC
Source/Cloud/VDOC/Depends/Models/UserModel/AccessToken.py
Python
mit
1,997
#!/usr/bin/env python -B class binary: def transform(self,input,params={}): return ' '.join(format(ord(x), 'b') for x in input)
Alevsk/stringTransformer
representations/binary.py
Python
mit
131
from setuptools import setup setup( name="slackerr", version="0.0.0", url="https://github.com/olanmatt/slackerr", author="Matt Olan", author_email="hello@olanmatt.com", description="Pipe directly to Slack from your shell", long_description=open('README.md').read(), py_modules=['slackerr...
olanmatt/slackerr
setup.py
Python
mit
449
import os import sys import re import os.path from setuptools import setup, find_packages, Extension from distutils.errors import CCompilerError, DistutilsExecError, DistutilsPlatformError # a define the version string inside the package, see: # https://stackoverflow.com/questions/458550/standard-way-to-embed-version-...
PyAbel/PyAbel
setup.py
Python
mit
5,505
balance = float(raw_input("Enter the outstanding balance on your credit card:")) annual_interest_rate = float(raw_input("Enter the annual credit card interest rate as a decimal:")) minimum_monthly_pmt = float(raw_input("Enter the minimum monthly payment as a decimal"))
royshouvik/6.00SC
Unit 1/ps3/ps1a.py
Python
mit
269
#!/usr/bin/env python # -*- coding:utf-8 mode:python; tab-width:4; indent-tabs-mode:nil; py-indent-offset:4 -*- ## """ test_local ~~~~~~~~~~~~~~ Test data export functions """ import sys import unittest from src.EMSL_local import EMSL_local class LocalTestCase(unittest.TestCase): def setUp(self): ...
mattbernst/ebsel
tests/test_local.py
Python
mit
9,944
""" Define forms for Polls application. """ from django import forms from .models import Poll, PollAnswer __author__ = "pesusieni999" __copyright__ = "Copyright 2017, MtG website Project" __credits__ = ["pesusieni999"] __license__ = "MIT" __version__ = "0.0.1" __maintainer__ = "pesusieni999" __email__ = "pesusieni9...
pesusieni999/mtgwebsite
pollapp/forms.py
Python
mit
1,986
from unittest import TestCase from unittest.mock import MagicMock from project_checker.checker.buildservice import Target class ServiceStub: pass class TargetTest(TestCase): def test_branches_creation_no_branches(self): service = MagicMock() target = Target('name', service) target.re...
micwypych/github-cmake-project-checker
project_checker/tests/targettest.py
Python
mit
381
# 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 ...
lmazuel/azure-sdk-for-python
azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/packet_capture_result_py3.py
Python
mit
3,946
#! /usr/bin/python #Change the value with your raster filename here raster_file = 'aspect15m.tif' output_file = 'classified.tiff' classification_values = [67.5,292.5,360] #The interval values to classify classification_output_values = [1,0,1] #The value assigned to each interval from osgeo import gdal ...
andy3092/Miscellaneous-Scripts
reclassify/reclassify.py
Python
mit
1,788
from proteus import Context # TODO - add weak/strong and direct/indirect solver options ########################################################## # The default options for the context are set below. # nLevels - this must be an iteger value >=1 # name - this must be a string # numeric_scheme: currently implemented -...
erdc/proteus
proteus/tests/solver_tests/import_modules/nseDrivenCavity_2d.py
Python
mit
1,561
""" Read the CSV file and get a distinct count of records for each value in the parameter_name field, show the results on the console and save them to a single csv file. Expected output: +--------------------+------+ | parameter_name| count| +--------------------+------+ | Benzene|469375| |Chromium ...
rdempsey/pyspark-for-data-processing
scripts/csv_group_by_count_distinct.py
Python
mit
1,607
import sys import os import fudge import textwrap from fudge.patcher import patch_object from mock import patch, ANY from nose.plugins.attrib import attr from tests import fixture_path from virtstrap import constants from virtstrap.testing import * from virtstrap.locker import site_packages_dir from virtstrap_local.com...
ravenac95/virtstrap
virtstrap-local/tests/test_install_command.py
Python
mit
9,478
""" __graph_MT_post__SwcToEcuMapping.py___________________________________________________________ Automatically generated graphical appearance ---> MODIFY DIRECTLY WITH CAUTION _____________________________________________________________________________________ """ import tkFont from graphEntity import * from G...
levilucio/SyVOLT
GM2AUTOSAR_MM/graph_MT_post__SwcToEcuMapping.py
Python
mit
2,655
from django.template.defaultfilters import stringfilter from django import template register = template.Library() @register.filter(name='replace') @stringfilter def replace(value, arg): return value.replace(arg, '')
leandromaia/fleet_control
resources/templatetags/resources_extras.py
Python
mit
222
import sys from openmc import Filter, Nuclide from openmc.filter import _FILTER_TYPES import openmc.checkvalue as cv if sys.version_info[0] >= 3: basestring = str # Acceptable tally arithmetic binary operations _TALLY_ARITHMETIC_OPS = ['+', '-', '*', '/', '^'] class CrossScore(object): """A special-purpos...
kellyrowland/openmc
openmc/cross.py
Python
mit
15,897
import json import socket import struct import time from threading import Thread, Lock, Event from Queue import Queue, Empty as EmptyQueue # python struct pack format # c char string of length 1 1 # B unsigned char integer 1 # H unsigned short integer 2 # I unsigned long integer 4 # ...
yzygitzh/ReDroid
dsm_patcher/scripts/jdwp.py
Python
mit
17,910
#!/bin/env python # -*- coding: utf-8 -*- 'Django package for modernizr:' \ ' JavaScript library that detects HTML5' \ ' and CSS3 features in the user`s browser' from setuptools import setup setup( name='django-modernizr', version='2.8.3', url='http://modernizr.com', descript...
ITrex/django-modernizr
setup.py
Python
mit
1,043
from django.core.urlresolvers import reverse from rest_framework import status from rest_framework.test import APITestCase from django.contrib.auth.models import User from tracking.models import Organization, Clinic, ClinicUser, \ ReferringEntity, ReferringReportSetting, ClinicReportSetting class LoginBaseTest(A...
Heteroskedastic/Dr-referral-tracker
tracking/tests/test_rest_api.py
Python
mit
10,291
#!/usr/bin/env python from __future__ import print_function import subprocess import shlex import os import sys from setuptools import setup, Command pypy = False if 'pypy' in sys.version.lower(): pypy = True about = {} with open('__about__.py') as f: exec(f.read(), about) class Test(Command): ''' Tes...
xsleonard/wsgisubdomain
setup.py
Python
mit
5,133
import os from setuptools import setup, find_packages f = open(os.path.join(os.path.dirname(__file__), 'README.md')) readme = f.read() f.close() test_requires = [] name='ENML2HTML' setup( name=name, version='0.0.1', description='This is a python library for converting ENML (Evernote Markup Language, htt...
CarlLee/ENML_PY
setup.py
Python
mit
842
""" Created on 2012-12-28 @author: Administrator """ import urllib.request req = urllib.request.Request('http://www.python.org/fish.html') try: urllib.request.urlopen(req) except urllib.error.HTTPError as e: print(e.code) print(e.read()) response = urllib.request.urlopen('http://python.org/') html = res...
quchunguang/test
testpy3/testurllib.py
Python
mit
333
import json import tensorflow as tf from data import datasets from patchy import PatchySan FLAGS = tf.app.flags.FLAGS tf.app.flags.DEFINE_string('config', None, """Path to the configuration json file of the dataset.""") def dataset(config): """Reads and i...
rusty1s/graph-based-image-classification
dataset.py
Python
mit
995
from sys import argv script, user_name = argv prompt = '> ' print ("Hi %s, I'm the %s script." % (user_name, script)) print ("I'd like to ask you a few questions.") print ("Do you like me %s?" % user_name) likes = input(prompt) print ("Where do you live %s?" % user_name) lives = input(prompt) print ("What kind of c...
Paul-Haley/LPTHW_python3
ex14.py
Python
mit
527
import abc class Writer(object): """ Common interface for all the writer operators. """ __metaclass__ = abc.ABCMeta @abc.abstractmethod def write_iterable(self, events_iterable): """ Consumes the members of the iterable, writing them one by one. """ raise NotI...
GMadorell/panoptes
src/operators/writers/writer.py
Python
mit
694
#coding:utf-8 import os pyList = ["excel_to_csv.py", "csv_to_csharp.py" ] for py in pyList: os.system(py) print("all_do ok.") input()
tjandy/work
excelToCode/all_do.py
Python
mit
163
import unittest import json import os import shutil import mock from sqlalchemy import * from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker from latte.TimeTracker import TimeTracker from latte.Config import Config from latte.Log import Log from latte.Base import Base class...
Vesuvium/Latte
tests/timetracker_test.py
Python
mit
3,131
# -*- coding: utf-8 -*- """ SQLpie License (MIT License) Copyright (c) 2011-2016 André Lessa, http://sqlpie.com See LICENSE file. """ from flask import g import sqlpie class Model(object): __tablename = "models" class record(object): def __init__(self, p): self.id, self.model, self.subj...
lessaworld/SQLpie
sqlpie/models/model.py
Python
mit
2,049
#!/usr/bin/python3 # -*- coding: utf-8 -*- ##===-----------------------------------------------------------------------------*- Python -*-===## ## _____ _ ## / ____| (_) ## | (___ ___ __ _ _ _ ___ _ ...
thfabian/sequoia
scripts/update-header.py
Python
mit
3,935
"""AoC Day 5 Usage: day5.py <input> day5.py (-h | --help) day5.py --version Options: -h --help Show this screen. --version Show version. """ from docopt import docopt import hashlib def find_8ch_ordered_pw(input): pw = "" count = 0 while len(pw) < 8: m = hashlib.md5() m...
arink/advent-of-code
2016/day5/day5.py
Python
mit
1,100
# -*- coding: utf-8 -*- # Generated by Django 1.9.6 on 2016-07-21 13:40 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('loans', '0005_auto_20160721_1629'), ] operations = [ migrations.AlterField( ...
lubegamark/senkumba
loans/migrations/0006_auto_20160721_1640.py
Python
mit
511
# Copyright 2000-2010 Michael Hudson-Doyle <micahel@gmail.com> # Antonio Cuni # # All Rights Reserved # # # Permission to use, copy, modify, and distribute this software and # its documentation for any purpose is hereby granted without fee, # provided that the above copyri...
timm/timmnix
pypy3-v5.5.0-linux64/lib_pypy/pyrepl/completing_reader.py
Python
mit
9,446
""" __graph_MT_pre__Null.py___________________________________________________________ Automatically generated graphical appearance ---> MODIFY DIRECTLY WITH CAUTION __________________________________________________________________________ """ import tkFont from graphEntity import * from GraphicalForm import *...
levilucio/SyVOLT
UMLRT2Kiltera_MM/graph_MT_pre__Null.py
Python
mit
2,595
""" Name : xmltoJson.py Author : Jerry M. Reghunadh Version : 1.0 Comment : XML to Badgerfish JSON converter Badgerfish convention -> http://badgerfish.ning.com/ """ import xml.sax import json "Class for SAX ContentHandle" class XMLSAXContentHandler (xml.sax.ContentHandler): _key = [] data = {} _currData...
jerrymannel/xml_json_converter
xmlToJson.py
Python
mit
2,608
#!/usr/bin/python import re import csv names = { "<" : "gal", ")" : "per", "|" : "bar", ">" : "gar", "[" : "sel", "\\" : "bas", "#" : "hax", ";" : "sem", "$" : "buc", "-" : "hep", "]" : "ser", "_" : ...
philipcmonk/hoonrunedocs
runegen.py
Python
mit
2,718
# -*- coding: utf-8 -*- from django.contrib import admin from . import models class UserAdmin(admin.ModelAdmin): search_fields = ['username', 'email'] list_display = ['username', 'email'] admin.site.register(models.User, UserAdmin)
scailer/picarchive
apps/account/admin.py
Python
mit
244
# This code is supporting material for the book # Building Machine Learning Systems with Python # by Willi Richert and Luis Pedro Coelho # published by PACKT Publishing # # It is made available under the MIT License import os import sys from matplotlib import pylab import numpy as np DATA_DIR = os.path.join( os....
krahman/BuildingMachineLearningSystemsWithPython
ch09/utils.py
Python
mit
5,569
from django.conf.urls import url from . import views app_name='blog' urlpatterns=[ url(r'^$',views.index,name='index'), url(r'^post/(?P<post_id>[0-9]+)/$', views.view_post, name='view_post'), ]
sahilrider/DjangoApps
blog/urls.py
Python
mit
207
""" File: beam.py Purpose: Defines the Beam note construct. """ from structure.abstract_note_collective import AbstractNoteCollective from structure.note import Note from structure.tuplet import Tuplet from fractions import Fraction from timemodel.duration import Duration class Beam(AbstractNoteCollective): "...
dpazel/music_rep
structure/beam.py
Python
mit
4,873
import unittest from biokbase.narrative.widgetmanager import WidgetManager import IPython import mock import os from .util import ConfigTests from .narrative_mock.mockclients import get_mock_client """ Tests for the WidgetManager class """ __author__ = "Bill Riehl <wjriehl@lbl.gov>" class WidgetManagerTestCase(unitt...
kbase/narrative
src/biokbase/narrative/tests/test_widgetmanager.py
Python
mit
9,378
import math import unittest def get_order_price(sub_total): return math.ceil(sub_total * 1.16 * 100)/100 class GetOrderPriceTest(unittest.TestCase): def test_applies_16percent_vat_for_1(self): order_price = get_order_price(1.00) self.assertEqual(1.16, order_price) def test_applies_16pe...
mamachanko/tdd-talk
order_price.py
Python
mit
622
from evennia import Command as BaseCommand from evennia import utils from evennia.commands.default.muxcommand import MuxCommand from world import rules from world import english_utils import time class Command(BaseCommand): """ Inherit from this if you want to create your own command styles from ...
whitehorse-io/encarnia
Encarnia/commands/business.py
Python
mit
8,790
""" gspread.exceptions ~~~~~~~~~~~~~~~~~~ Exceptions used in gspread. """ class GSpreadException(Exception): """A base class for gspread's exceptions.""" class SpreadsheetNotFound(GSpreadException): """Trying to open non-existent or inaccessible spreadsheet.""" class WorksheetNotFound(GSpreadException):...
burnash/gspread
gspread/exceptions.py
Python
mit
1,099
# coding: utf-8 import os from flask import Flask from flask_sqlalchemy import SQLAlchemy from flask_login import LoginManager from flask_bootstrap import Bootstrap from flask_pagedown import PageDown from wechat_sdk import WechatConf, WechatBasic from wechat_sdk.exceptions import OfficialAPIError # 应用初始化 app = Flask...
guan080/personal_website
app/__init__.py
Python
mit
1,335
# from https://ruby-doc.com/docs/ProgrammingRuby/html/tut_modules.html from inherits_import import MajorScales, PentatonicScales def majorNum(): pass def pentaNum(): pass class FakePentatonicScales(): def pentaNum(self): if self.numNotes is None: self.numNotes = 5 return s...
scottrogowski/code2flow
tests/test_code/py/inherits/inherits.py
Python
mit
688
from collections.abc import Mapping from pathlib import Path import attr from configparser import ConfigParser from .hand import Range from .constants import Position @attr.s(slots=True) class _Situation: utg = attr.ib() utg1 = attr.ib() utg2 = attr.ib() utg3 = attr.ib() utg4 = attr.ib() co = ...
pokerregion/poker
poker/strategy.py
Python
mit
3,076
# Copyright (c) 2017 Elias Riedel Gårding # Licensed under the MIT License import numpy as np import itertools as it class Node: """A class of nodes for use in decoding algorithms. The root of the tree is a node Node(code). The children of a node are created by node.extend(). Instance variables: ∙...
eliasrg/SURF2017
code/separate/coding/convolutional/node.py
Python
mit
3,065
import logging import os import shutil import click from livereload import Server from .server import app logging.basicConfig(format='[%(levelname)s]:%(message)s', level=logging.INFO) config_text = 'site_name: My Docs\n' todo_text = """name: todos description: 待办项 model: id: verbose: id type: in...
gaojiuli/XDocs
xdocs/__main__.py
Python
mit
3,052
# -*- coding: utf-8 -*- import os from flask import Flask from .db import db from .schema_validator import jsonschema from .sessions import ItsdangerousSessionInterface class SubdomainDispatcher(object): """Dispatch requests to a specific app based on the subdomain. """ def __init__(self, domain, config...
masom/doorbot-api-python
doorbot/factory.py
Python
mit
3,919
""" GLM connected by a sparse network and Gaussian weights. """ import numpy as np SbmWeightedModel = \ { # Number of neurons (parametric model!) 'N' : 1, # Parameters of the nonlinearity 'nonlinearity' : { 'type' : 'explinear' }, # Parameters of the bias ...
slinderman/theano_pyglm
pyglm/models/sbm_weighted_model.py
Python
mit
2,306
from .custom_generator import CustomGenerator __all__ = ['CustomGenerator']
maxalbert/tohu
tohu/v6/custom_generator/__init__.py
Python
mit
76
# -*- coding:utf-8 -*- # filename:setup __author__ = 'yibai' from setuptools import setup, find_packages setup( name='yibai-sms-python-sdk', version='1.0.0', keywords=('yibai', 'sms', 'sdk'), description='yibai python sdk', license='MIT', install_requires=['requests>=2.9.1'], ...
100sms/yibai-python-sdk
yibai-sms-python-sdk-1.0.0/setup.py
Python
mit
433
# Python 2 Fix from __future__ import division import sys import json import os.path import datetime import storjcore from flask import make_response, jsonify, request sys.path.append(os.path.join(os.path.dirname(__file__), '..')) from sqlalchemy import desc from dataserv.run import app, db, cache, manager from data...
littleskunk/dataserv
dataserv/app.py
Python
mit
6,697
import os import sys import datetime as dt sys.path.insert(0, os.path.abspath("..")) extensions = [ 'sphinx.ext.autodoc', 'sphinx.ext.intersphinx', 'sphinx.ext.viewcode', 'sphinx.ext.autosectionlabel', 'sphinx_rtd_theme', ] source_suffix = '.rst' master_doc = 'index' project = u'Confuse' copyrig...
sampsyo/confit
docs/conf.py
Python
mit
641
# -*- coding: UTF-8 -*- from django.contrib.auth.models import User, Group from patient.models import Patient import random import os import django import codecs from django.utils import timezone from datetime import timedelta from measurement.models import Measurement from threshold_value.models import ThresholdValue ...
sigurdsa/angelika-api
create_alarm_test_data.py
Python
mit
2,056
from threading import Thread import time def test(): print('----test----') time.sleep(1) for i in range(5): t = Thread(target=test) # 创建线程 t.start()
kaideyi/KDYSample
kYPython/FluentPython/BasicLearn/MultiProcess/Thread.py
Python
mit
176
#!/usr/bin/env python #------------------------------------------------------------------------------ # # sensor metadata-extraction profiles - QuickBird products # # Project: EO Metadata Handling # Authors: Martin Paces <martin.paces@eox.at> # #-------------------------------------------------------------------------...
DREAM-ODA-OS/tools
metadata/profiles/quickbird.py
Python
mit
9,730
from datetime import date import os import tempfile from unittest import mock from PIL import Image from django.core.files import File from django.core.files.uploadedfile import SimpleUploadedFile from django.test import TestCase from django.utils.timezone import now from events.models import Event, Attachment cla...
Strassengezwitscher/Strassengezwitscher
crowdgezwitscher/events/tests/test_models.py
Python
mit
5,459
# -*- coding: utf-8 -*- import os import csv import unittest import pytest from sqlalchemy.orm import Session, session from skosprovider_sqlalchemy.models import Base, Initialiser from skosprovider_sqlalchemy.utils import ( import_provider, VisitationCalculator ) from tests import DBTestCase def _get_men...
koenedaele/skosprovider_sqlalchemy
tests/test_utils.py
Python
mit
18,760
#!/usr/bin/env python # Light each LED in sequence, and repeat. import opc, time from ledlib.colordefs import * numLEDs =512 numChase = 4 chase_size = 4 gap_size = 3 frame_delay = 0.04 # strip0 = pixels 0-63 # strip1 = 64-127 # strip2 = 128-191 # etc. StripSize = 30 Bases = [ 0, 64, 128, 192, 256, 320, 384, 448...
bbulkow/MagnusFlora
led/colorsample.py
Python
mit
687
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ .. Licence MIT .. codeauthor:: Jan Lipovský <janlipovsky@gmail.com>, janlipovsky.cz """ import pytest @pytest.mark.parametrize("text, expected", [ ("xx[http://httpbin.org/status/200](http://httpbin.org/status/210)trololo", ['http://httpbin.org/status/200', ...
lipoja/URLFinder
tests/unit/test_markdown.py
Python
mit
1,039
import asyncio import sys import time import unittest from unittest import mock import pytest from engineio import asyncio_socket from engineio import exceptions from engineio import packet from engineio import payload def AsyncMock(*args, **kwargs): """Return a mock asynchronous function.""" m = mock.Magic...
miguelgrinberg/python-engineio
tests/asyncio/test_asyncio_socket.py
Python
mit
19,848
from __future__ import division import unittest import numpy as np from ..features.f0_contour_features import ContourFeatures __author__ = 'Jakob Abesser' class TestFeatures(unittest.TestCase): """ Unit tests for ContourFeatures class """ def setUp(self, show_plot=False): """ Generate test vib...
jakobabesser/pymus
pymus/test/test_features.py
Python
mit
1,992
"""Export Value and Reward Map. Get a model and export all the path and score for grid 28x28 Author: Yuhuang Hu Email : duguyue100@gmail.com """ from __future__ import print_function import os import cPickle as pickle import numpy as np import keras.backend as K import matplotlib.pyplot as plt import rlvision from ...
ToniRV/Learning-to-navigate-without-a-map
rlvision/tests/vin_po_export_value_reward_28.py
Python
mit
3,042
from mojo.events import addObserver from mojo.drawingTools import * class PointCount(object): def __init__(self): addObserver(self, "drawPointCount", "draw") def drawPointCount(self, info): glyph = info["glyph"] if glyph is None: return scale = info["scale"...
typemytype/RoboFontExamples
pointCounter/pointCounter.py
Python
mit
702
import os, sys, numpy as np, tensorflow as tf from pathlib import Path import time sys.path.append(str(Path(__file__).resolve().parents[1])) import convnet_10_hidden __package__ = 'convnet_10_hidden' from . import network from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets(...
kinshuk4/MoocX
misc/deep_learning_notes/Proj_Centroid_Loss_LeNet/convnet_10_hidden/MNIST_eval.py
Python
mit
2,180
from __future__ import print_function import sys from datetime import datetime, timedelta from time import time, sleep from redis import Redis import requests redis = Redis() URLS = ( "www.spokesman.com", "www.google.com", "www.yahoo.com", "www.example.com", "www.gibberish.com"...
dangayle/sharecounts
sharecounts/sharecounts.py
Python
mit
2,316
import time from app.validation.abstract_validator import AbstractValidator from app.validation.validation_result import ValidationResult class DateTypeCheck(AbstractValidator): def validate(self, user_answer): """ Validate that the users answer is a valid date :param user_answer: The an...
qateam123/eq
app/validation/date_type_check.py
Python
mit
811