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 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding unique constraint on 'Cat', fields ['slug']
db.create_unique('punns_cat', ['slug'])
# Addi... | carquois/blobon | blobon/punns/migrations/0028_auto__add_unique_cat_slug__add_field_punn_publish_on_facebook.py | Python | mit | 8,119 |
import unittest
from GUI.PopUps.RemovePresentationsPopUp import RemovePresentationsPopUp
class TestBindPresentationToSlavePopup(unittest.TestCase):
def setUp(self):
self.presentations = ["Slave1", "Slave2"]
self.remove_popup = RemovePresentationsPopUp(self.presentations, None)
def test_init_... | RemuTeam/Remu | project/tests/GUI/PopUps/test_remove_presentations_pop_up.py | Python | mit | 1,094 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import tarfile
from io import BytesIO
from queue import Queue
from threading import Event, Thread
from xml.etree.ElementTree import Element, ElementTree
import requests
import unicodecsv as csv
class DownloadThread(Thread):
def __init__(self, stock_id, que... | quietcoolwu/python-playground | imooc/python_advanced/8_1_multi_threading.py | Python | mit | 4,077 |
#!/usr/bin/python
'''
Extract _("...") strings for translation and convert to Qt4 stringdefs so that
they can be picked up by Qt linguist.
'''
from subprocess import Popen, PIPE
import glob
import operator
import os
OUT_CPP="src/qt/gamblrstrings.cpp"
EMPTY=['""']
def parse_po(text):
"""
Parse 'po' format prod... | knolza/gamblr | share/qt/extract_strings_qt.py | Python | mit | 2,044 |
#!/bin/python
# This script will upload the data from @mlungren's project, including basic reports and labels
# (see README.md for full instructions). In the long run we want a standard data format for importing.
# AllowedAnnotation objects store a label name and allowed value, and an Annotation combines one of these ... | radinformatics/whatisit | scripts/upload_demo.py | Python | mit | 5,956 |
__license__ = "MIT"
__author__ = "Guangtun Ben Zhu (BGT) @ Johns Hopkins University"
__startdate__ = "2016.01.19"
__name__ = "nnmath"
__module__ = "Network"
__lastdate__ = "2016.01.19"
__version__ = "0.01"
__comments__ = "math utils for neural net work"
import numpy as np
from scipy.special import expit
# some small... | guangtunbenzhu/BGT-Cosmology | DeepLearning/nnmath.py | Python | mit | 5,679 |
#!/usr/bin/env python2
#
# Copyright 2012 Janis Jansons (janis.jansons@janhouse.lv)
#
import gi
# make sure you use gtk+ 3
gi.require_version('Gtk', '3.0')
import sys, os
import struct
from gi.repository import GObject, Polkit, GLib, Notify, GUdev, Gio, Gtk
class UsbGuard:
def __init__(self):
print "Star... | Janhouse/usb-guard | usb-guard.py | Python | mit | 16,696 |
from __future__ import absolute_import
import unittest
import mock
from pydux import create_store, apply_middleware
from .helpers.reducers import reducers
from .helpers.action_creators import add_todo, add_todo_if_empty
from .helpers.middleware import thunk
class TestApplyMiddleware(unittest.TestCase):
def test... | usrlocalben/pydux | test/test_apply_middleware.py | Python | mit | 1,791 |
from astropy import units as u
K_kepler = 0.01720209895 # ua^(3/2) m_{sun} d^(−1)
K = 0.01720209908 * u.au ** (3 / 2) / u.d # ua^(3/2) d^(−1)
UA = 149597870700 * u.m # m
GM1 = 1.32712442099E20 * u.m ** 3 / u.s ** 2 # m^(3) s^(−2)
# m1/m2
Mercury = 6023600
Venus = 408523.719
Earth_Moon = 328900.561400
Mars = 3098... | Camiloasc1/AstronomyUNAL | CelestialMechanics/kepler/constants.py | Python | mit | 503 |
# -*- coding: iso-8859-15 -*-
# =================================================================
#
# Authors: Tom Kralidis <tomkralidis@gmail.com>
#
# Copyright (c) 2011 Tom Kralidis
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files... | PublicaMundi/pycsw | pycsw/log.py | Python | mit | 3,506 |
# 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 ... | Azure/azure-sdk-for-python | sdk/cognitiveservices/azure-cognitiveservices-language-luis/azure/cognitiveservices/language/luis/runtime/models/_models.py | Python | mit | 11,988 |
from i3pystatus import IntervalModule
import yfinance as yf
class Ticker(IntervalModule):
"""
Displays stock ticker information from yahoo finance
Requires: yfinance
"""
settings = (
("symbol", "Stock symbol to track"),
("interval", "Update interval (in seconds)"),
("good_... | enkore/i3pystatus | i3pystatus/ticker.py | Python | mit | 1,604 |
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/stable/config
# -- Path setup ------------------------------------------------------------... | mmaelicke/scikit-gstat | docs/conf.py | Python | mit | 7,252 |
"""
Rbf - Radial basis functions for interpolation/smoothing scattered Nd data. A
radial basis function (RBF) is a real-valued function whose value depends only
on the distance from the origin.
Rbf are typically used to build up function approximations of the form:
$ y(x) = \sum_{i=1}^N w_i \, \phi(||x - x_i||) ... | mfouesneau/faststats | faststats/interpolate/bary.py | Python | mit | 7,536 |
#!/usr/bin/python
import argparse
import random
import os
parser = argparse.ArgumentParser()
parser.add_argument('-p', '--print-names', action='store_true',
dest='printNames', default=False, help='print names to terminal')
parser.add_argument('-d', '--dry-run', action='store_true', dest='dryRun',
defa... | Niklatz/Secret-Santa | SecretSanta.py | Python | mit | 2,355 |
# -*- coding: utf-8 -*-
# Copyright(C) 2012 Romain Bignon
#
# This file is part of a woob module.
#
# This woob module is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, o... | Phyks/Flatisfy | modules/seloger/pages.py | Python | mit | 9,785 |
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
config = {
'description': 'My Project',
'author': 'Wouter Oosterveld',
'url': 'URL to get it at.',
'download_url': 'Where to download it.',
'author_email': 'wouter@fizzyflux.nl',
'version': '0.1',
... | wouteroostervld/snaps | setup.py | Python | mit | 465 |
from django.db import models
from django.utils import timezone
from account.models import UserProfile
from easy_maps.models import Address
from phonenumber_field.modelfields import PhoneNumberField
class SiteText(models.Model):
name = models.CharField(max_length=200, help_text='Name of the item')
value = mod... | Strangemother/coffee | reserved/models.py | Python | mit | 9,390 |
operators = {'+', '-', '*', '/', '^'}
def pre_to_in(expression):
'''
scan right to left
if its a number push to stack
if its a operator pop 2 numbers
top is op1, next is op2
push back op1 operator op2
'''
stack = []
for token in expression.split()[::-1]:
if token in operator... | sayak1711/coding_solutions | coding-practice/Stack/prefix_to_infix.py | Python | mit | 549 |
import random
class Dice(object):
'''
Generates random numbers by rolling two 'dice'.
The reason for this class existing is so that it can be
mocked and replaced with a deterministic version for
testing.
'''
def roll(self):
'''
Returns two value: the rolls of the two dice... | richard-shepherd/monopyly | monopyly/game/dice.py | Python | mit | 436 |
from unittest import TestCase
from django.core.management import call_command
from test_app.models import Place
class BatchGeocodeTestCase(TestCase):
def setUp(self):
self.place = Place()
def test_batch_geocode(self):
self.place.address = "14 Rue de Rivoli, 75004 Paris, France"
self.... | cvng/django-geocoder | tests/test_app/tests/test_commands.py | Python | mit | 460 |
import string
"""
Se inicializa la clase con collecciones a la base de datos MongoDB
"""
class book(object):
#Inicimos la clase y se configura la base de datos con collecciones
def __init__(self, database):
self.db = database
self.mynames = database.mynames
#Esta funcion busca los nombres
def fi... | arauzoliver/uip-iiig2016-prog3 | FinalPC3/book.py | Python | mit | 636 |
from text import TextReader
from xml import XMLReader
| perfidia/screensketch | src/screensketch/screenspec/reader/__init__.py | Python | mit | 54 |
from collections import namedtuple
from foil.formatters import format_repr
from postpy.ddl import (
compile_column, compile_qualified_name, compile_primary_key,
compile_create_table, compile_create_temporary_table
)
__all__ = ('Database', 'Schema', 'Table', 'Column', 'PrimaryKey', 'View')
class Database:
... | portfoliome/postpy | postpy/base.py | Python | mit | 4,942 |
"""
WSGI config for ngs project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` sett... | eco32i/ngs | ngs/wsgi.py | Python | mit | 1,410 |
# encoding: utf-8
# Copyright 2011 Tree.io Limited
# This file is part of Treeio.
# License www.tree.io/license
#!/usr/bin/python
OBJECTS_NUM = 100
# setup environment
import sys, os
sys.path.append('../')
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
from django.core.management import setup_environ
from treeio... | rogeriofalcone/treeio | script/testmodel.py | Python | mit | 810 |
# if stopcomm is called twice on the same handle it
# returns false.
def echo(rip,rport,msg,h):
sock.close()
if callfunc == "initialize":
ip = '127.0.0.1'
waitport = 12345
# the waitfor conn we will connect to
handle = recvmess(ip,waitport,echo)
stopcomm(handle)
stopped = stopcomm(handle)
... | sburnett/seattle | network_semantics_tests/tests/stopcomm/stopcomm_duplicate2.py | Python | mit | 387 |
"""
Created on 4 Mar 2019
@author: Bruno Beloff (bruno.beloff@southcoastscience.com)
AQCSV: ISO country codes
NB: initialisation is performed at the foot of this class
example:
{"numeric": 788, "name": "Tunisia", "iso": "TUN"}
https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3
https://www.airnow.gov/
"""
from scs_c... | south-coast-science/scs_core | src/scs_core/aqcsv/specification/country_iso.py | Python | mit | 1,163 |
print(__name__)
val = 1
def foo():
print("foo")
# This module is supposed to be imported, not run directly. But run-tests
# script will run it, so add dummy __main__() and corresponding .exp file.
def __main__():
print("Shouldn't run")
| pfalcon/micropython | tests/strict/mod.py | Python | mit | 248 |
from django.apps import AppConfig
class ParkingConfig(AppConfig):
name = 'parking'
| Farbod909/parking-app-server | parking/apps.py | Python | mit | 89 |
#!/usr/bin/python
##############################################
###Python template
###Author: Elizabeth Lee
###Date: 8/25/14
###Function: barplot comparing number of "any diagnosis" visits during the 7 week fall baseline (wks 40-6) and 7 week summer baseline (wks 33-39)
###Import data:
###Command Line: python Supp... | eclee25/flu-SDI-exploratory-age | scripts/create_fluseverity_figs/Supp_fall_summer_baselinebars.py | Python | mit | 1,857 |
import os
import json
from ...resources.base import SurvoxAPIBase
from ...resources.exception import SurvoxAPIRuntime, SurvoxAPINotFound
from ...resources.valid import valid_url_field
class SurvoxAPIDncList(SurvoxAPIBase):
"""
Class to manage DNC lists.
"""
def __init__(self, base_url=None, headers=... | cbeauvais/zAWygzxkeSjUBGGVsgMGTF56xvR | survox_api/resources/library/sample_dnc.py | Python | mit | 5,130 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2016-2019 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Invenio-Records-REST configuration."""
from __future__ import absolute_import, pr... | inveniosoftware/invenio-records-rest | invenio_records_rest/config.py | Python | mit | 13,214 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-06-20 13:13
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('distributor_api', '0010_remove_sensor_id_distrib... | nicogid/Projet4Moc1 | api/projet-old/distributor_api/migrations/0011_sensor_id_distributor.py | Python | mit | 605 |
"""
This creates an HTTPClientRequest object. The constructor receives the JSON
file which contains the request. Then it creates the object with the data
specified from the JSON, builds the appropriate GET/POST URL. When Execute
method is called, the request is sent to server
"""
import urllib2
import sys
import os... | avinassh/simple-web-server | HTTPClientRequest.py | Python | mit | 1,686 |
import os.path
import subprocess
import shutil
class GitImpl(object):
def __init__(self):
from svn import SvnImpl
svn_impl = SvnImpl(suffix='-git')
shutil.rmtree(svn_impl.client_path)
self.temp_path = svn_impl.temp_path
self.server_path = svn_impl.server_path
self.client_path = os.path.join(self.temp_p... | erdavila/git-svn-diff | tests/impl/git.py | Python | mit | 1,477 |
import random
from .exceptions import ClientError
def catch_client_error(func):
"""
Decorator to catch the ClientError exception and translate it into a reply.
"""
def inner(message):
try:
return func(message)
except ClientError as e:
# If we catch a client er... | amureki/lunch-with-channels | core/utils.py | Python | mit | 2,997 |
"""
WSGI config for pventa 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_SETTIN... | vpadillar/pventa | pventa/wsgi.py | Python | mit | 389 |
# Copyright (c) 2012 Patrick Dunnigan
# 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 without limitation the rights to use,
# copy, modify, merge, publish, ... | pdunnigan/namefileparse | namefileparse/__init__.py | Python | mit | 1,123 |
# -*- encoding: utf-8 -*-
from hypothesis import given
from hypothesis.strategies import integers, lists
import pytest
from taskpaper import TaskPaperItem, TaskPaperError
from utils import taskpaper_item_strategy
@given(integers())
def test_setting_tab_size(tab_size):
"""We can set the tab size on TaskPaperIte... | alexwlchan/python-taskpaper | test/test_item.py | Python | mit | 3,541 |
#! /usr/bin/python
# Joe Deller 2014
# Finding out where we are in minecraft
# Level : Beginner
# Uses : Libraries, variables, functions
# Minecraft worlds on the Raspberry Pi are smaller than
# other minecraft worlds, but are still pretty big
# So one of the first things we need to learn to do
# is find out where w... | joedeller/pymine | whereamiV2.py | Python | mit | 3,643 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('books', '0012_auto_20150414_1231'),
]
operations = [
migrations.AlterField(
mod... | zearom32/SmartBooks | books/migrations/0013_auto_20150418_1551.py | Python | mit | 658 |
import _plotly_utils.basevalidators
class FontValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(self, plotly_name="font", parent_name="icicle.hoverlabel", **kwargs):
super(FontValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/plotly.py | packages/python/plotly/plotly/validators/icicle/hoverlabel/_font.py | Python | mit | 1,858 |
from base import *
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
}
}
| dev-coop/meancoach | meancoach_project/settings/test.py | Python | mit | 136 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
#----------------------------------------------------
# MIT License
#
# Copyright (c) 2017 Rishi Rai
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and ass... | davidsandberg/facenet | contributed/predict.py | Python | mit | 6,182 |
import subprocess
reldelta = ['minWii', 'avgWii', 'maxWii']
kinem = ['RG', 'PR']
cases = ['A', 'B', 'C']
X_label = ['delta', 'delta', 'delta']
Y_label = ['epsilon', 'm', '(m, eps)']
X_index = [6, 6, 6]
Y_index = [8, 9, (8, 9)]
print 'Decompressing data files...'
process = subprocess.Popen('unzip -o data.zip', shell=T... | parmes/parmes | trs/tr2/shortest-runtime-reldelta.py | Python | mit | 2,349 |
#!/usr/bin/env python
#python 2.7.5 requires biopython
#fastsub
#Version 1.0.0 Adam Taranto, Sep 2017
#Contact, Adam Taranto, adam.taranto@anu.edu.au
#################################################################################################
# Takes a multi-fasta file and a list of sequence names, prints named s... | Adamtaranto/subset-fasta-by-name | fastsub/cmd_line.py | Python | mit | 2,575 |
# Let's import our ParseMyAddresses function from payday_parser.py
from payday_parser_done import ParseMyAddresses
# Run the function on the consumer_installment HTML file.
ParseMyAddresses('consumer_installment.html')
| ireapps/coding-for-journalists | 4_make_function/completed/call_function_done.py | Python | mit | 220 |
#!/usr/bin/env python
'''
Usage: python lemmatiser.pl lemmaFile < input > output
The input should have two colums
<html>
word1 tag1
word2 tag2
.
'''
import sys
import re
lemmaDict= {} # word : { pos : lemma}
def loadLemmatiser(file):
for line in open(file):
line=line.strip()
word= line.split('\t... | griimick/feature-mlsite | app/static/hindi-dependency-parser-2.0/hindi-pos-tagger/bin/lemmatiser.py | Python | mit | 1,258 |
from django.apps import AppConfig as BaseAppConfig
from django.utils.translation import ugettext_lazy as _
class AppConfig(BaseAppConfig):
name = "pinax.referrals"
verbose_name = _("Pinax Referrals")
| pinax/pinax-referrals | pinax/referrals/apps.py | Python | mit | 211 |
from pyscipopt import Model, Branchrule, SCIP_RESULT, quicksum
class MyBranching(Branchrule):
def __init__(self, model, cont):
self.model = model
self.cont = cont
self.count = 0
self.was_called_val = False
self.was_called_int = False
def branchexeclp(self, allowaddcon... | mattmilten/PySCIPOpt | tests/test_branch_probing_lp.py | Python | mit | 2,957 |
# -*- coding: utf-8 -*-
"""
The MIT License (MIT)
Copyright (c) 2017 SML
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 without limitation
the rights to use, copy... | smlbiobot/SML-Cogs | fake/fake.py | Python | mit | 3,596 |
# import urllib2
# fin = open('rawcsv/stockdata/stockdata.csv')
# fin.read()
#clean and merge data in one csv
from os import listdir
from os.path import isfile, join
mypath = './USstockHistory167Mb/'
onlyfiles = [ f for f in listdir(mypath) if isfile(join(mypath,f)) and f[-3:] == 'csv' ]
print onlyfiles
ticker = '... | shanshanzhu/Data-Scrappers | USstock/stockcleanerOneFile.py | Python | mit | 1,444 |
import sys
import json
import os
from matplotlib import use
use("Agg")
import matplotlib.pyplot as plt
from collections import defaultdict
import datetime
from matplotlib import dates, use
def dump_conversation(results,args):
# the name of the analysis
uid = results["audience_id_string"]
data_loc = "/... | compston/TAP-Workshop | utilities/Gnip-Analysis-Pipeline/insights/output.py | Python | mit | 8,810 |
from rest_framework.response import Response
from rest_framework import status
from rest_framework import viewsets, mixins
from rest_framework.permissions import IsAuthenticated, IsAdminUser
from rest_framework.decorators import api_view, permission_classes
from apps.payments.models import Installment, RentalPaymentIn... | we-inc/mms-snow-white-and-the-seven-pandas | webserver/apps/payments/views.py | Python | mit | 3,518 |
import _plotly_utils.basevalidators
class SideValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(
self,
plotly_name="side",
parent_name="scattergeo.marker.colorbar.title",
**kwargs
):
super(SideValidator, self).__init__(
plotly_name=pl... | plotly/python-api | packages/python/plotly/plotly/validators/scattergeo/marker/colorbar/title/_side.py | Python | mit | 569 |
from . import config_params
from . import thermometer
from . import util
import subprocess
import shlex
import os
import collections
import logging
logger = logging.getLogger(__name__)
def _iterate_command_output(self, command):
process = subprocess.Popen(command,
stdout=subprocess... | bluecube/pysystemfan | pysystemfan/harddrive.py | Python | mit | 5,952 |
"""
Python Interchangeable Virtual Instrument Library
Copyright (c) 2017 Alex Forencich
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 without limitation the righ... | alexforencich/python-ivi | ivi/rigol/rigolDS1000Z.py | Python | mit | 2,014 |
from django.db import models
from django.contrib.auth.models import User
import time
from sorl.thumbnail import ImageField, get_thumbnail
# Create your models here.
class Category(models.Model):
name = models.CharField(max_length=128)
related_categories = models.ManyToManyField('self')
class Account(models.Model):
... | kwantopia/shoppley-migrate | shoppley.com/shoppley/apps/buxfer/models.py | Python | mit | 14,855 |
"""
Tests for botogram/utils.py
Copyright (c) 2015 Pietro Albini <pietro@pietroalbini.io>
Released under the MIT license
"""
import botogram.decorators
def test_help_message_for(bot):
@bot.command("test")
def func():
"""docstring"""
pass
cmd = {cmd.name: cmd for cmd in bot.... | thesharp/botogram | tests/test_decorators.py | Python | mit | 535 |
import wx
import win32api
import win32con #for the VK keycodes
from threading import *
import time
EVT_RESULT_ID = wx.NewId()
def mouseClick(timer):
print "Click!"
x,y = win32api.GetCursorPos()
win32api.SetCursorPos((x, y))
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,x,y,0,0)
time.sleep(tim... | knightzero/AutoClicker | autoclicker.py | Python | mit | 2,779 |
#!/usr/bin/env python
import os
import re
import xively
import subprocess
import time
import datetime
import requests
import sys
temperature = 0
humidity = 0
# extract feed_id and api_key from environment variables
FEED_ID = "YOUR_FEED_ID" #CHANGE IT
API_KEY = "YOUR_KEY" #CHANGE IT
DEBUG = False
# initialize api cl... | williambout/Aira | wind/air.py | Python | mit | 2,815 |
alist = ['Micheal', 'Franklin', 'Trevor']
for i in alist:
print "Happy birthday, " + i
| BedrockDev/Sunrin2017 | Software/Web Programming/Project07/exam_03.py | Python | mit | 91 |
import os, sys, numpy as np, tensorflow as tf
from pathlib import Path
from termcolor import colored as c, cprint
sys.path.append(str(Path(__file__).resolve().parents[1]))
import LeNet_plus
__package__ = 'LeNet_plus'
from . import network
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data... | kinshuk4/MoocX | misc/deep_learning_notes/Proj_Centroid_Loss_LeNet/LeNet_plus/checkpoints/90_pc_trial_001/MNIST_train.py | Python | mit | 4,056 |
#!/usr/bin/env python3
import threading
class StabilityOracle(object):
def __init__(self, ttl):
self.lock = threading.Lock()
self.logical_clock = 0
self.ttl = ttl
def is_deliverable(self, event):
return event.ttl > self.ttl
def get_clock(self):
with self.lock:
... | robzenn92/EpTODocker | epto_project/api/stabilityOracle.py | Python | mit | 530 |
from __future__ import division
import numpy as np
from . import common_args
from ..util import scale_samples, read_param_file
def sample(problem, N, seed=None):
"""Generate model inputs using Latin hypercube sampling (LHS).
Returns a NumPy matrix containing the model inputs generated by Latin
... | willu47/SALib | src/SALib/sample/latin.py | Python | mit | 1,859 |
#!/usr/bin/env python
from PyMiniQbt import getVersion, getName, QasmAsyncInterpreter
import sys
def main(arguments):
if(not len(arguments) == 2):
print("which file?")
sys.exit(-1)
print("Using", getName(), "version:", getVersion())
with open(arguments[1]) as dat:
src = dat.read(... | valvy/miniqubit | examples/python/executefile/main.py | Python | mit | 714 |
# -*- coding: utf-8 -*-
from GestureAgentsTUIO.Tuio import TuioCursorEvents
from GestureAgentsDemo.Geometry import Ring, Circle
from GestureAgentsDemo.Render import drawBatch
from GestureAgents.Recognizer import Recognizer
import pyglet.clock
from pyglet.sprite import Sprite
from pyglet.resource import Loader
from Ges... | chaosct/GestureAgents | Apps/DemoApp/apps/Shadows/__init__.py | Python | mit | 5,202 |
import unittest
from katas.kyu_7.bug_fixing_unfinished_loop import create_array
class CreateArrayTestCase(unittest.TestCase):
def test_equals(self):
self.assertEqual(create_array(1), [1])
def test_equals_2(self):
self.assertEqual(create_array(2), [1, 2])
def test_equals_3(self):
... | the-zebulan/CodeWars | tests/kyu_7_tests/test_bug_fixing_unfinished_loop.py | Python | mit | 541 |
#!/usr/bin/env python
# encoding: utf-8
"""A template for generating new clients.
This is used to test autoloading from `CliConfig` (see `test/test_main.py`).
"""
from hdfs import Client
class $class_name(Client):
one = 1
def __init__(self, url):
super($class_name, self).__init__(url)
| mtth/hdfs | test/dat/client_template.py | Python | mit | 302 |
from unittest import TestCase
from teafacto.core.base import Val, tensorops as T
import numpy as np
class TestTensorWrapped(TestCase):
def test_dimswap(self):
xval = np.random.randint(0, 5, (2, 3, 4))
x = Val(xval)
y = x.dimswap(1, 0)
eyval = xval.transpose(1, 0, 2)
self.a... | lukovnikov/teafacto | test/test_tensorWrapped.py | Python | mit | 687 |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
# 1. Copyright
# 2. Lisence
# 3. Author
"""
Documents
"""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
import os
import threading
import subprocess
import re
import ti... | barshow/Stino | stino/pyarduino/arduino_compiler.py | Python | mit | 22,629 |
from __future__ import division # so that a / b == float(a) / b
import fire
from ep.evalplatform import draw_details
from ep.evalplatform.compatibility import plot_comparison_legacy_parse
from ep.evalplatform.parsers import *
from ep.evalplatform.parsers_image import *
from ep.evalplatform.plotting import Plotter
fr... | Fafa87/EP | ep/evalplatform/plot_comparison.py | Python | mit | 27,171 |
import six
from .cypher import Create, Match, Merge, Exists
from .exceptions import DetachedObjectError
from .shared.objects import GraphObject, SetOnceDescriptor
try:
str = unicode
except NameError:
pass
class NodeMeta(type):
def __init__(cls, class_name, bases, attrs):
cls.labels = SetOnceDesc... | TwoBitAlchemist/NeoAlchemy | neoalchemy/primitives.py | Python | mit | 4,384 |
class ParserError(Exception):
pass
class Sentence(object):
def __init__(self, subject, verb, obj):
# We take ('noun','thing') tuples and convert them.
self.subject = subject[1]
self.verb = verb[1]
self.object = obj[1]
def peek(word_list):
if word_list:
word = word_... | afronski/playground-other | python/books/learn-python-the-hard-way/projects/ex48/ex48/parser.py | Python | mit | 1,663 |
from django.test import TestCase
from .models import Clothes
class ClothesModelTests(TestCase):
def setUp(self):
Clothes.objects.create(clothes_type='ladies dress', price=28.50)
Clothes.objects.create(clothes_type='men tie', price=8.50)
def test_number_of_clothes_created(self):
se... | Meerkat007/Clothes-Shop-Website | server/clothes/tests.py | Python | mit | 369 |
# -*- coding: utf-8 -*-
"""
Created on Sun Dec 29 16:34:30 2013
@author: sagar
"""
import cv2
import numpy as np
import itertools
import sys
from os.path import join
MIN_MATCH_COUNT = 10
class TimeLapse:
def find_keypoints(self, img1, img2):
sift = cv2.SIFT()
# find the keypoints and des... | sagarjauhari/time_lapse_pics | Timelapse.py | Python | mit | 2,372 |
from TitanicAttempt import * | brookemosby/titanic | TitanicAttempt/__init__.py | Python | mit | 28 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Initial import script for CABA representatives.
"""
import csv
import json
import logging
import re
import sys
import unicodedata
_SLUG_STRIP = re.compile(r'[^\w\s-]')
_SLUG_HYPHENATE = re.compile(r'[-\s]+')
_PARTIES = {
'BpU': 'Bases para la Unión',
'BApT': 'Buen... | scoffey/elegilegi | 2013/scripts/caba/representatives.py | Python | mit | 1,435 |
from django.db import models
from .tag import Tag
from .articlebody import ArticleBody
class Article(models.Model):
id = models.AutoField(primary_key = True)
key = models.CharField(max_length = 1000)
title = models.CharField(max_length = 1000)
description = models.CharField(max_length = 1000)
tag... | hamtamtots/website | matt_site/blog/models/article.py | Python | mit | 622 |
from mhapi.util import EnumBase
class CapSkill(EnumBase):
NONE = 0
EXPERT = 1
MASTER = 2
GOD = 3
_names = { NONE: "No skills",
EXPERT: "Capture Expert",
MASTER: "Capture Master",
GOD: "Capture God" }
class LuckSkill(EnumBase):
NONE = 0
GOOD ... | bd4/monster-hunter-scripts | mhapi/skills.py | Python | mit | 3,065 |
#!usr/bin/python
###############################
# > Author: Duarte Monteiro
# > Version: 1.0
# > Vendor: www.checkmarx.com
# > Notes: RESTAPI for PyCheckMarx
###############################
# Python Dependencies
from flask import Flask, jsonify, request
app = Flask(__name__)
# Import PyCheckMarx
import PyCheckmarx
... | Etraud123/PyCheckmarx | APICheckmarx.py | Python | mit | 2,559 |
#!/usr/bin/python3
import random
import svgwrite
from svgwrite import rgb
def bkggen_square(name):
# image size
img_draw_sz = "6cm"
img_cell_count = 24
img_cell_sz = 5
img_gutter_sz = 1
colors = [rgb(col, col, col) for col in [246, 248, 250, 252, 255]]
dwg = svgwrite.Drawing(name, (img_draw_sz, img_draw_sz... | gauravmm/gauravmanek.com | generators/bkggen.py | Python | mit | 3,912 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.conf import settings
apipatterns = [
url(r'^', include('cars.api.urls')),
]
urlpatterns = patterns(
'',
url(r'^admin/', include(admin.site.urls)),
url(
r'^manufacturer/',
include('man... | Alexx-G/tastypie-example | src/config/urls.py | Python | mit | 771 |
import serial.tools.list_ports
import fermentrack_django.settings
import os
import pickle
# from . import udev_integration
DEVICE_CACHE_FILENAME = fermentrack_django.settings.ROOT_DIR / 'device.cache'
known_devices = {
'arduino': [
# Those with 'generic': False are virtually guaranteed to be Arduinos
... | thorrak/fermentrack | app/serial_integration.py | Python | mit | 4,779 |
"""
A simple but pretty logging interface for configurable logs across all packages.
To use, simply import the base log and (maybe) tack on a child context:
.. code-block:: python
from peri.logger import log
clog = log.getChild("<child name>") # optional
The possible options are:
clog.{info,debug,war... | peri-source/peri | peri/logger.py | Python | mit | 7,443 |
from __future__ import with_statement
from ofxclient.account import Account
from configparser import ConfigParser
import os
import os.path
try:
import keyring
KEYRING_AVAILABLE = True
except:
KEYRING_AVAILABLE = False
try:
DEFAULT_CONFIG = os.path.expanduser(os.path.join('~', 'ofxclient.ini'))
except:... | jbms/ofxclient | ofxclient/config.py | Python | mit | 9,882 |
# Python3
from solution1 import fixMessage as f
qa = [
("you'll NEVER believe what that 'FrIeNd' of mine did!!1",
"You'll never believe what that 'friend' of mine did!!1"),
('i',
'I'),
('We are so doomed.',
'We are so doomed.'),
("LOL you've GOT to hear this one XDD",
"Lol you've g... | RevansChen/online-judge | Codefights/arcade/python-arcade/level-2/12.Fix-Message/Python/test.py | Python | mit | 819 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from google.appengine.api import users
from gaecookie.decorator import no_csrf
from gaepermission import facade
from gaepermission.decorator import login_not_required
from tekton import router
from config.template_middleware import Templat... | ericMayer/tekton-master | backend/appengine/routes/paginas/home.py | Python | mit | 527 |
# 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/v2019_06_01/aio/operations/_ddos_protection_plans_operations.py | Python | mit | 30,431 |
from parse_rest.connection import register
from parse_rest.datatypes import Object
class GameScore(Object):
pass
register("XEPryFHrd5Tztu45du5Z3kpqxDsweaP1Q0lt8JOb", "PE8FNw0hDdlvcHYYgxEnbUyxPkP9TAsPqKvdB4L0")
myClassName = "GameScore"
myClass = Object.factory(myClassName)
print myClass
gameScore = GameScore... | oukiar/qreader | parsetest.py | Python | mit | 443 |
#!/usr/bin/env python3
import math
from numbers import Number
import torch
from torch.distributions import constraints
from torch.distributions.utils import broadcast_all
from torch.nn import Module as TModule
from .prior import Prior
from .torch_priors import NormalPrior
class SmoothedBoxPrior(Prior):
r"""A s... | jrg365/gpytorch | gpytorch/priors/smoothed_box_prior.py | Python | mit | 2,544 |
from __future__ import unicode_literals, print_function, absolute_import
import unittest
try:
import mock
except ImportError:
from unittest import mock
from ngen.exceptions import ValidationError
from ngen.models import (
BaseOptions,
BooleanField,
CharField,
Field,
FieldError,
FieldO... | anthonyalmarza/ngen | ngen/tests/test_models.py | Python | mit | 18,264 |
#!/usr/bin/env python
#
# This library is free software, distributed under the terms of
# the GNU Lesser General Public License Version 3, or any later version.
# See the COPYING file included in this archive
#
# Thanks to Paul Cannon for IP-address resolution functions (taken from aspn.activestate.com)
import argpar... | DaveA50/lbry | lbrynet/create_network.py | Python | mit | 2,692 |
__author__ = 'davedash'
class WheeljackException(Exception):
pass
class RepoNotFoundException(WheeljackException):
"""Exception thrown when we interact with an undefined Repo."""
pass
class RepoAlreadyInstalledException(WheeljackException):
"""Exception thrown when we try to re-install a repo."""
... | pinterest/wheeljack | wheeljack/exceptions.py | Python | mit | 769 |
from django import template
register = template.Library()
@register.inclusion_tag('user/user_list.html', takes_context=True)
def user_list(context, users, title):
info = {'users': users, 'title': title}
if 'event' in context:
info['object'] = context['event']
return info
@register.inclusion_tag... | internship2016/sovolo | app/user/templatetags/user_tags.py | Python | mit | 902 |
"""
This class is about determine two path homotopy classes using Constraint Satisfication Programming techniques.+
"""
__author__ = 'Yinan Zhang'
__revision__ = '$Revision$'
import pdb
import sys, os, math, time, pygame, time, copy
sys.path.append('../basics/math')
sys.path.append('../basics/algorithm')
from numpy... | Yinan-Zhang/RichCSpace | alphashape/Homotopy.py | Python | mit | 6,570 |
from django.conf import settings
from django.utils.safestring import SafeString
from django import template
register = template.Library()
def dfp(slot):
html = SafeString()
data = settings.DFP_SLOTS
data = data[slot]
html+='<div class="dfp-ads" data-slot="%s" data-account="%s" >' % (data['slot'],data... | divadrei/django-responsive-dfp | dfp/templatetags/dfp.py | Python | mit | 636 |
from __future__ import print_function
import numpy as np
import matplotlib.pyplot as plt
from astropy.io import fits
from astropy.io import ascii
import astropy.coordinates as coord
import astropy.units as u
from astropy.time import Time
from astropy.time import TimeDelta
import os
'''
Read in 1m observation metadata t... | mrawls/APO-1m-phot | imginventory.py | Python | mit | 9,017 |
from django.core.management.base import BaseCommand
from map.models import Marker
from map.signals import send_notification
class Command(BaseCommand):
help = 'Remove all markers'
def handle(self, *args, **options):
Marker.objects.all().delete()
send_notification({
'type': 'clea... | bobvoorneveld/spindlechannels | map/management/commands/clearmarkers.py | Python | mit | 334 |