code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
import EoN
import networkx as nx
import matplotlib.pyplot as plt
import scipy
import random
print(r"Warning, book says \tau=2\gamma/<K>, but it's really 1.5\gamma/<K>")
print(r"Warning - for the power law graph the text says k_{max}=110, but I believe it is 118.")
N=1000
gamma = 1.
iterations = 200
rho = 0.05
tmax = ... | springer-math/Mathematics-of-Epidemics-on-Networks | docs/examples/fig4p11.py | Python | mit | 2,565 |
"""
word_counter
Provides helper functions for word counts.
"""
import os
import re
from collections import Counter
STOPWORDS_FILE = os.path.join(os.path.dirname(__file__), "STOPWORDS")
# Get the frequencies of each word as a dictionary.
# strings = a list of strings, can be strings of any length/number of wo... | mjmeli/facebook-chat-word-cloud | facebook_wordcloud/word_counter.py | Python | mit | 2,049 |
# -*- coding: utf-8 -*-
"""
Copyright 2003-2010 Cort Stratton. All rights reserved.
Copyright 2015, 2016 Hanson Robotics
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
1. Redistributions of source code must retain the abov... | hansonrobotics/chatbot | src/chatbot/aiml/Kernel.py | Python | mit | 50,732 |
"""Utilities for multiprocess tests running."""
# pylint: disable=invalid-name,super-init-not-called
from __future__ import absolute_import
import os
import psutil
from rotest.common import core_log
PROCESS_TERMINATION_TIMEOUT = 10
class WrappedException(Exception):
"""Used to wrapping exceptions so they coul... | gregoil/rotest | src/rotest/core/runners/multiprocess/common.py | Python | mit | 2,971 |
from troposphere_sugar.skel import Skel
from troposphere_sugar.command import Command
from troposphere_sugar.decorators import *
| enriclluelles/troposphere_sugar | troposphere_sugar/__init__.py | Python | mit | 129 |
import threading
import queue
from . import BaseEventHandler, BaseEventQueue
class ThreadedEventHandler(BaseEventHandler):
"""
A threaded implementation of :class:`.BaseEventHandler`.
"""
def __init__(self):
self._handlers = {}
self._handle_map = {}
self._counter = 0
s... | TallonRain/horsefaxbot | horsefax/telegram/events/threaded.py | Python | mit | 2,365 |
#! /usr/env/bin python3
def scrape_rates(filename):
dict_rate = {}
with open(filename) as f:
for line in f.readlines():
line = line.split("\t")
line[1] = line[1].replace("\n", "")
line[1] = line[1].replace(",", ".")
dict_rate[line[0]] = line[1]
ret... | diblaze/TDP002 | Old Exams/201510/Uppgift3.py | Python | mit | 1,026 |
from tgbot import plugintest
from plugin_examples.guess import GuessPlugin
class GuessPluginTest(plugintest.PluginTestCase):
def setUp(self):
self.plugin = GuessPlugin()
self.bot = self.fake_bot('', plugins=[self.plugin])
def test_play(self):
self.receive_message('/guess_start')
... | fopina/tgbotplug | tests/examples/test_guess.py | Python | mit | 1,935 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2019-04-10 03:58
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('netdevice', '0006_auto_20190409_0325'),
]
operations = [
migrations.RenameField(
... | lkmhaqer/gtools-python | netdevice/migrations/0007_auto_20190410_0358.py | Python | mit | 567 |
from django.conf.urls import url
from provider import views
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^new/$', views.new, name='new'),
url(r'^(?P<provider_id>\d+)/$', views.view, name='view'),
url(r'^(?P<provider_id>\d+)/edit/$', views.edit, name='edit'),
url(r'^(?P<provider_id>... | zyphrus/fetch-django | provider/urls.py | Python | mit | 537 |
#!/usr/bin/env python
from argparse import ArgumentParser
from passgen import generate
# TODO: add help text
def main():
parser = ArgumentParser()
parser.add_argument('--length', '-l', type=int, default=8)
parser.add_argument('--uppercase', '-u', action='store_true')
parser.add_argument('--digits', '... | genderquery/passgen | passgen/__main__.py | Python | mit | 779 |
#global declaration
global index0
global index1
global index2
global index3
global index4
global index5
global index6
global index7
global index8
global index9
global index10
global index11
global index12
global index13
global index14
global index15
global index16
global index17
global index18
globa... | ChyauAng/DNN-Composer | src/Preprocess/globalConstant.py | Python | mit | 1,770 |
__author__ = 'shenojia'
import sys
sys.path.insert(0, '.')
sys.path.insert(0, '..')
from R12_36xxx.HighLayer import *
from R12_36211.REG import REG
from math import floor
from matplotlib.path import Path
from matplotlib.patches import PathPatch
from xlsxwriter.worksheet import Worksheet
class PRB:
"""
Resource ... | shennjia/weblte | R12_36211/PRB.py | Python | mit | 4,004 |
from django.shortcuts import render, render_to_response
from django.http import HttpResponse
from django.views.generic.list import ListView
from django.views.generic.detail import DetailView
from .models import Item
# Create your views here.
def index(request):
return render_to_response('index.html')
class Train... | Atilla-Learn/django-2015 | atillaLearn/web/views.py | Python | mit | 862 |
import datetime
import logging
import textwrap
import time
import click
import hatarake
import hatarake.net as requests
from hatarake.config import Config
logger = logging.getLogger(__name__)
@click.group()
@click.option('-v', '--verbosity', count=True)
def main(verbosity):
logging.basicConfig(level=logging.WA... | kfdm/hatarake | hatarake/cli.py | Python | mit | 4,255 |
from PIL import ImageFile, Image
class CSGOInventoryCacheFile(ImageFile.ImageFile):
format = "IIC"
format_description = "CS:GO Inventory Image Cache"
def _open(self):
self.mode = "RGBA"
self.size = 512, 384
self.tile = [
("raw", (0, 0) + self.size, 0, ("BGRA", 0, 1))
... | nelsonw2014/CSGOInvCacheConverter | cicc/image.py | Python | mit | 729 |
#!/usr/bin/env python
from __future__ import division
import numpy as np
import matplotlib.pyplot as plt
import scipy.io.netcdf as netcdf
import spoisson
import def_radius
from scipy import interpolate
from scipy.interpolate import interp1d
import glob
#plt.ion()
binprec = '>f4'
flag_conf = 2 # 0: samelson, 1: gr... | bderembl/mitgcm_configs | test_pg_hr/input/mygendata.py | Python | mit | 8,360 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
'''
Developer Navdeep Ghai
Email navdeep@korecent.com
License Korecent Solution Pvt. Ltd.
'''
import frappe
from frappe import _, msgprint, throw
from bcommerce.utils.api import get_connection, is_exists
from erpnext.controllers.item_variant import cr... | navdeepghai/bcommerce | bcommerce/utils/products.py | Python | mit | 13,513 |
'''
Wireshark Analyzer(s)
@author: Michael Eddington
@version: $Id$
'''
#
# Copyright (c) Michael Eddington
#
# 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... | thecrackofdawn/Peach2.3 | Peach/Analyzers/shark.py | Python | mit | 32,258 |
"""
This module provides classes to run and analyze boltztrap on pymatgen band
structure objects. Boltztrap is a software interpolating band structures and
computing materials properties from this band structure using Boltzmann
semi-classical transport theory.
Boltztrap has been developed by Georg Madsen.
http://www.... | vorwerkc/pymatgen | pymatgen/electronic_structure/boltztrap.py | Python | mit | 103,362 |
#!/usr/bin/env python
"""
Process meme.txt files to
generate conservation plots
"""
import argparse
import csv
import sys
import seaborn as sns
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats.stats import pearsonr
from Bio import motifs
def plot_meme_against_phylo(meme_record, phylo):
sns.set(s... | saketkc/bio-tricks | meme_parser/meme_processory.py | Python | mit | 2,759 |
#!/usr/bin/env python
# -*- utf-8 -*-
import re
import copy
import time
# This is const data
direct = ['u', 'r', 'd', 'l']
direct_vector = [{'x' : -1, 'y' : 0},
{'x' : 0, 'y' : 1},
{'x' : 1, 'y' : 0},
{'x' : 0, 'y' : -1}]
def calculateNum(i, f, y):
return i * y + f
def is_empty_not_chang... | townboy/coil | solver.py | Python | mit | 9,646 |
"""
This Test will run through benchbuild's execution pipeline.
"""
import os
import unittest
from contextlib import contextmanager
from benchbuild.utils import cmd
def shadow_commands(command):
def shadow_command_fun(func):
def shadow_command_wrapped_fun(self, *args, **kwargs):
cmd.__override... | simbuerg/benchbuild | benchbuild/tests/test_run.py | Python | mit | 2,638 |
#-*- encoding:UTF-8 -*-
__author__ = 'gzs2478'
from netstream import *
import json
import time
if __name__ == '__main__':
try:
client = netstream(8)
client.connect('127.0.0.1',12345)
if client.state != NET_STATE_ESTABLISHED:
print "connect failed!"
print "First Statu... | kelvict/Online-GoBang-Center | Server/TestClient.py | Python | mit | 875 |
from core.himesis import Himesis
import uuid
class HCompositeState2ProcDef(Himesis):
def __init__(self):
"""
Creates the himesis graph representing the DSLTrans rule CompositeState2ProcDef.
"""
# Flag this instance as compiled now
self.is_compiled = True
... | levilucio/SyVOLT | UMLRT2Kiltera_MM/transformation/handbuilt/HCompositeState2ProcDef.py | Python | mit | 14,159 |
#!/usr/bin/env python
"""
Measure the performance of STM based spike prediction by repeatedly
using all but one cell for training and the remaining cell for testing.
"""
import os
import sys
from argparse import ArgumentParser
from pickle import dump
from scipy.io import savemat
from numpy import mean, std, corrcoef... | lucastheis/c2s | scripts/c2s-leave-one-out.py | Python | mit | 3,513 |
#!/usr/bin/env python
CDF_TABLE = {
-4.0: 3.1671241833119863e-05,
-3.999: 3.1805340054201978e-05,
-3.998: 3.1939975607705564e-05,
-3.997: 3.2075150511550028e-05,
-3.996: 3.2210866790657701e-05,
-3.995: 3.2347126476975879e-05,
-3.994: 3.2483931609498828e-05,
-3.993: 3.2621284234289769e-0... | mtambos/online-anomaly-detection | src/mgng/cdf_table.py | Python | mit | 263,594 |
import numpy as np
import uncertainties.unumpy as unp
from uncertainties.unumpy import (nominal_values as noms, std_devs as stds)
import matplotlib.pyplot as plt
import matplotlib as mpl
from scipy.optimize import curve_fit
plt.rcParams['figure.figsize'] = (12, 8)
plt.rcParams['font.size'] = 13
plt.rcParams['lines.line... | pascalgutjahr/Praktikum-1 | Schwingung/phaselog.py | Python | mit | 888 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import theano
import theano.tensor as T
import numpy as np
from .. import activations, initializations
from ..utils.theano_utils import shared_zeros, alloc_zeros_matrix
from ..layers.core import Layer
from .. import regularizers
from six.moves import rang... | cesc-park/CRCN | keras/keras/layers/recurrent.py | Python | mit | 11,523 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Created by yaochao on 2016/8/29
| yaochao/NetEaseMusicCrawler | NetEaseMusicCrawler/misc/__init__.py | Python | mit | 81 |
#!/usr/bin/env python
# Copyright (C) 2008 Robey Pointer <robeypointer@gmail.com>
#
# This file is part of paramiko.
#
# Paramiko is free software; you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free
# Software Foundation; either version 2.1 of ... | benhunter/py-stuff | bhp/rforward.py | Python | mit | 6,044 |
"""
WSGI config for project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODUL... | djangomini/djangomini | test_project/wsgi.py | Python | mit | 373 |
class Solution():
def kClosestNumbers(A, target, k):
if A is None or len(A) == 0 or target is None or k is None or k == 0:
return []
start, end = 0, len(A) - 1
closest = 0
while (start + 1 < end):
mid = start + (end - start)//2
if target == A[mid]... | euccas/CodingPuzzles-Python | leet/source/binarysearch/find_k_closest_elements.py | Python | mit | 4,030 |
# -*- coding: utf-8 -*-
from .version import __version__ # noqa: F401
from .tts import gTTS, gTTSError
__all__ = ['gTTS', 'gTTSError']
| pndurette/gTTS | gtts/__init__.py | Python | mit | 137 |
from math import sqrt, pow
def linepoint(t, x0, y0, x1, y1):
"""Returns coordinates for point at t on the line.
Calculates the coordinates of x and y for a point
at t on a straight line.
The t parameter is a number between 0.0 and 1.0,
x0 and y0 define the starting point of the line,
x1 and ... | karstenw/nodebox-pyobjc | libs/pathmatics/pathmatics.py | Python | mit | 2,790 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime
from django.urls import reverse
from django.test import TestCase
from django.utils import timezone
import copy
from django.contrib.auth.models import User, Group
from .models import Restaurant, Type, Cuisine, Food, Booking
from .views ... | srijanss/rhub | webapp/tests.py | Python | mit | 28,803 |
import unittest
from flask import Flask
from flask_secure_headers.core import Secure_Headers
from flask_secure_headers.headers import CSP
class TestCSPHeaderCreation(unittest.TestCase):
def test_CSP_pass(self):
sh = Secure_Headers()
defaultCSP = sh.defaultPolicies['CSP']
""" test CSP policy update """
h = CS... | twaldear/flask-secure-headers | flask_secure_headers/tests/core_test.py | Python | mit | 5,918 |
from SimPEG import Mesh, Regularization, Maps, Utils, EM
from SimPEG.EM.Static import DC
import numpy as np
import matplotlib.pyplot as plt
#%matplotlib inline
import copy
#import pandas as pd
#from scipy.sparse import csr_matrix, spdiags, dia_matrix,diags
#from scipy.sparse.linalg import spsolve
from scipy.stats imp... | thast/EOSC513 | DC/SimultaneousSources/Update_W_each_3it_5s_rademacher/Update_W_each_3it_5s_rademacher.py | Python | mit | 8,698 |
#Copyright (c) 2011-2012 Litle & Co.
#
#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, distri... | Rediker-Software/litle-sdk-for-python | litleSdkPythonTest/functional/TestAuth.py | Python | mit | 7,012 |
try:
from IBMQuantumExperience import IBMQuantumExperience
from pprint import pprint
def quant_exp(args):
with open('etc/IBMtoken', 'r') as infile:
token = infile.read().replace('\n', '')
config = {
"url": 'https://quantumexperience.ng.bluemix.net/api'
}
... | LSaldyt/qnp | scripts/quant_exp.py | Python | mit | 901 |
N, K = map(int, input().split())
R = sorted(map(int, input().split()))
ans = 0
for r in R[len(R)-K:]:
ans = (ans + r) / 2
print(ans)
| knuu/competitive-programming | atcoder/abc/abc003_c.py | Python | mit | 137 |
#!/usr/bin/env python
import rethinkdb as r
from optparse import OptionParser
def run(rql):
try:
return rql.run()
except r.RqlRuntimeError:
return None
def main(port, include_deleted):
conn = r.connect('localhost', port, db='materialscommons')
cursor = r.table('project2datadir') \
... | materials-commons/materialscommons.org | backend/scripts/admin/check_for_top_dir.py | Python | mit | 1,695 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import modelcluster.fields
class Migration(migrations.Migration):
dependencies = [
('wagtailcore', '0023_alter_page_revision_on_delete_behaviour'),
]
operations = [
migrations.Create... | frague59/wagtailmenus | wagtailmenus/migrations/0001_initial.py | Python | mit | 4,600 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 18 09:23:01 2017
@author: zhouhang
"""
import numpy as np
from matplotlib import pyplot as plt
X = np.arange(-5.,9.,0.1)
print X
X=np.random.permutation(X)
print X
b=5.
y=0.5 * X ** 2.0 +3. * X + b + np.random.random(X.shape)* 10.
#plt.scatter(... | artzers/MachineLearning | LinearRegression/SimpleLinearReg.py | Python | mit | 588 |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: pogoprotos/networking/responses/add_fort_modifier_response.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _messa... | bellowsj/aiopogo | aiopogo/pogoprotos/networking/responses/add_fort_modifier_response_pb2.py | Python | mit | 4,943 |
from distutils.core import setup
setup(
name='alertme',
description='Python command line tool that sends email when your script finishes running or has an error',
version='0.1.0',
url='http://github.com/ChandranshuRao14/AlertMe/',
packages=['alertme'],
scripts=['bin/alertme'],
author='Chandranshu Rao',
author_... | ChandranshuRao14/AlertMe | setup.py | Python | mit | 444 |
"""
* Copyright 2015, Roberto Prevato roberto.prevato@gmail.com
* https://github.com/RobertoPrevato/Flask-three-template
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/MIT
"""
from bll.membership.membershipprovider import MembershipProvider
def register_membership(app):
"""
Initializ... | RobertoPrevato/flask-three-template | bll/membership/__init__.py | Python | mit | 1,482 |
from django.conf import settings
CLIENT_ID = getattr(settings, 'EXACT_TARGET_CLIENT_ID', '')
CLIENT_SECRET = getattr(settings, 'EXACT_TARGET_CLIENT_SECRET', '')
WSDL_URL = getattr(settings, 'EXACT_TARGET_WSDL_URL', '')
| roverdotcom/django-fuelsdk | django_fuelsdk/constants.py | Python | mit | 221 |
# ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
from __future__ import absolute_import
import json
import re
import copy
import os
from svtplay_dl.service import Service, OpenGraphThumbMixin
from svtplay_dl.utils import get_http_data, check_redirect, filenamify
from svtplay_dl... | OakNinja/svtplay-dl | lib/svtplay_dl/service/disney.py | Python | mit | 4,847 |
import logging
import struct
_LOGGER = logging.getLogger(__name__)
typical_types = {
0x11: {
"desc": "T11: ON/OFF Digital Output with Timer Option", "size": 1,
"name": "Switch Timer",
"state_desc": { 0x00: "off",
0x01: "on"}
},
... | maoterodapena/pysouliss | souliss/Typicals.py | Python | mit | 9,295 |
from django.shortcuts import render
from datetime import date, datetime, timedelta
from .models import Event, SponsoredContent
from pytz import timezone
def index(request):
now = datetime.now(timezone('Australia/Sydney')).date()
if now.isoweekday() in [5, 6, 7]:
weekend_s... | coreymcdermott/artbot | artbot_website/views.py | Python | mit | 793 |
__all__ = ['savedialog.SaveDialog','opendialog.OpenDialog']
| Errantgod/azaharTEA | menubar/menus/filechoosers/__init__.py | Python | mit | 60 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('common', '0002_job'),
migrations.swappable_dependency(settings.AUTH_USE... | liyocee/job_hunt | backend/employee/migrations/0001_initial.py | Python | mit | 1,960 |
import logging
import urllib2
import socket
import time
import re
import lighter.util as util
class Graphite(object):
def __init__(self, address, url, tags=[]):
"""
@param address hostname:port where the Graphite listens for the plaintext protocol, usually port 2003
@param url ... | meltwater/lighter | src/lighter/graphite.py | Python | mit | 2,361 |
#!/usr/bin/env python
import subprocess, os, sys, argparse
parser = argparse.ArgumentParser()
parser.add_argument("directory", help="First target directory for evaluation")
parser.add_argument("directories", nargs='+', help="All other directories to be evaluated")
parser.add_argument("-o", "--output", help="Output des... | nrebhun/FileSponge | src/filesponge.py | Python | mit | 2,647 |
#!/usr/bin/env python
'FontForge: List all the data in a glyph object in key, value pairs'
__url__ = 'http://github.com/silnrsi/pysilfont'
__copyright__ = 'Copyright (c) 2015, SIL International (http://www.sil.org)'
__license__ = 'Released under the MIT License (http://opensource.org/licenses/MIT)'
__author__ = 'David... | bitforks/pysilfont | scripts/FFlistGlyphinfo.py | Python | mit | 2,000 |
import win32event
import pythoncom
TIMEOUT = 200 # ms
StopEvent = win32event.CreateEvent(None, 0, 0, None)
OtherEvent = win32event.CreateEvent(None, 0, 0, None)
class myCoolApp:
def OnQuit(self):
win32event.SetEvent(StopEvent) # exit msg pump
def _MessagePump():
while 1:
rc = win32event.MsgWaitFor... | ActiveState/code | recipes/Python/82236_Flexible_Win32_message_pump_using/recipe-82236.py | Python | mit | 1,611 |
import project
import csv
def to_csv(trello_json_path, project_csv_path):
table = project.get_project(trello_json_path).to_table()
with open(project_csv_path, 'wb') as project_csv:
writer = csv.writer(project_csv)
for row in table:
writer.writerow(row)
if __name__ == '__main__':
import argparse
... | New-York-Falcons/trello-project-tracking | src/main/py/trelloprojecttracking/__init__.py | Python | mit | 623 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
from setuptools.command.test import test
REQUIREMENTS = (
"six",
)
with open("README.rst", "r") as resource:
LONG_DESCRIPTION = resource.read()
# copypasted from http://pytest.org/latest/goodpractises.html
class Py... | 9seconds/isitbullshit | setup.py | Python | mit | 2,097 |
'''
Created on Jun 19, 2014
@author: lwoydziak
'''
from dynamic_machine.cli_process_json import CliProcessingJson
from mockito.mocking import mock
from mockito.matchers import any
from mockito.mockito import when, verifyNoMoreInteractions, verify
from _pytest.runner import fail
from dynamic_machine.cli_commands import... | Pipe-s/dynamic_machine | dynamic_machine/cli_process_json_test.py | Python | mit | 4,232 |
import os
def ruta_abs(x):
return os.path.join(os.path.abspath(os.path.dirname(__file__)), x)
# Django settings for introDjango project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db... | txtbits/daw-python | intro_django/intro_django/intro_django/settings.py | Python | mit | 5,592 |
import os
import re
from nose.tools import raises
import seqpoet
class TestSequence:
def setup(self):
self.seq1 = 'ACATacacagaATAgagaCacata'
self.illegal = 'agagcatgcacthisisnotcorrect'
def test_sequence_length(self):
s = seqpoet.Sequence(self.seq1)
assert len(s) == len(self... | maehler/seqpoet | seqpoet/tests/test_sequence.py | Python | mit | 1,544 |
clock = [
" __ __________",
"/ \\____/ __ / /\\______",
"-==- -/ /=/`/ / / .\\- -/\\",
"=- -=-/ _` ` / /## .\\=-/\\\\",
"-- =-/ /_/`/ / / ### /_///\\",
" -= / /_/`/ / /## ##/ /\\/\\",
"___/ /_/`/ / / ### /=/// \\",
"==/ /_/`/ / /##'##/ /\\/",
"_/ _`_`_ / / ###'/-/// ",
... | killerbat00/pyclock | vars.py | Python | mit | 809 |
"""
Written by Harry Liu (yliu17) and Tyler Nickerson (tjnickerson)
"""
import sys
import os.path
import pprint
from classes.bag import Bag
from classes.item import Item
from classes.constraint import Constraint
from classes.csp import CSP
from classes.solver import Solver
def main():
# Read command line argument... | WPI-CS4341/CSP | main.py | Python | mit | 5,541 |
'''
Created on Dec 23, 2013
@author: Chris
'''
import sys
import wx
from gooey.gui.lang import i18n
from gooey.gui.message_event import EVT_MSG
class MessagePump(object):
def __init__(self):
# self.queue = queue
self.stdout = sys.stdout
# Overrides stdout's write method
def write(self, text):
... | lrq3000/pyFileFixity | pyFileFixity/lib/gooey/gui/windows/runtime_display_panel.py | Python | mit | 1,831 |
# Build out a means of storing this data into a DB and preserving it for archival and analysis
client_id = "crmdatagettest"
client_secret = "I88RXVb9y1Am0AXauUSdOr8Pux9zAwNHDRSLX0UKmI6SbtTI0u4inxGa8i6cwVqi"
username = "camjcollins@gmail.com"
password = "Padthai123*"
from pypodio2 import api
import pygsheets
impor... | CamFlawless/python_projects | crm/src/podio_2.py | Python | mit | 18,252 |
#!/usr/bin/env python3
import argparse
import requests
import time
import datetime
import random
# import pymysql
from connections import hostname, username, password, portnumber, database
class MarketKuCoin(object):
# Set variables for API String.
domain = "https://api.kucoin.com"
url = ""
uri = ""
... | infectiious/Pharaoh_script | Markets/KuCoin/kucoin_api.py | Python | mit | 1,648 |
import time
import RPi.GPIO as GPIO
# Constants
PULSE_LEN = 0.03 # length of clock motor pulse
A_PIN = 18 # one motor drive pin
B_PIN = 23 # second motor drive pin
# Configure the GPIO pins
GPIO.setmode(GPIO.BCM)
GPIO.setup(A_PIN, GPIO.OUT)
GPIO.setup(B_PIN, GPIO.OUT)
# Glogal variables
positive_polarity... | simonmonk/pi_magazine | 04_analog_clock/analog_clock_24.py | Python | mit | 1,066 |
##########
import web
import hmac
from time import strftime
from datetime import datetime
from hashlib import sha256
from lib.utils import db
from lib.utils import render
from lib.utils import etherpad
from lib.validate import valid_user, valid_pw, make_salt
##########
class FrontPage:
def GET(self):
r... | lauhuiyik/same-page | src/handlers/front.py | Python | mit | 1,011 |
# problem 48
# Project Euler
__author__ = 'Libao Jin'
__date__ = 'July 18, 2015'
def lastTenDigits(number):
string = str(number)
lastTen = int(string[-10:])
return lastTen
def amazingSum(n):
s = 0
while n >= 1:
s += n ** n
n -= 1
return s
def selfPowers(n):
s = amazingSum(n)
l = lastTenDigits(s)
return... | imthomasking/MATLAB-files | Python/Project.Euler/Answers.Python/48.py | Python | mit | 391 |
"""Per-prefix data, mapping each prefix to a dict of locale:name.
Auto-generated file, do not edit by hand.
"""
from ..util import u
# Copyright (C) 2011-2017 The Libphonenumber Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Licens... | samdowd/drumm-farm | drumm_env/lib/python2.7/site-packages/phonenumbers/geodata/data20.py | Python | mit | 919,262 |
def xmerge(*ln):
""" Iterator version of merge.
Assuming l1, l2, l3...ln sorted sequences, return an iterator that
yield all the items of l1, l2, l3...ln in ascending order.
Input values doesn't need to be lists: any iterable sequence can be used.
"""
pqueue = []
for i in map(iter, ... | ActiveState/code | recipes/Python/141934_Merging_sorted_sequences/recipe-141934.py | Python | mit | 1,380 |
"""
Configuration tasks
This module provides tools to load yaml configuration files.
"""
import os
from fabric.api import *
from fabric.contrib.console import confirm
from fabric.colors import red, green
try:
import yaml
except ImportError:
print(red('pyYaml module not installed. Run the following commands t... | hglattergotz/sfdeploy | bin/config.py | Python | mit | 2,796 |
from django.apps import AppConfig
class TreeTraversalConfig(AppConfig):
name = 'tree_traversal'
| JacekKarnasiewicz/HomePage | apps/tree_traversal/apps.py | Python | mit | 102 |
# coding: utf-8
from __future__ import absolute_import
from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from app.openapi_server.models.base_model_ import Model
from openapi_server import util
class GithubRepositorypermissions(Model):
"""NOTE: This class is auto gene... | cliffano/swaggy-jenkins | clients/python-blueplanet/generated/app/openapi_server/models/github_repositorypermissions.py | Python | mit | 3,754 |
from django.test import TestCase, Client
from django.conf import settings
from django.core import mail
from .models import *
class Reactions(TestCase):
def setUp(self):
self.client = Client()
self.u = User.objects.create(username="test")
ne = NotificationEmail.objects.create(user=self.u,... | bebosudo/sest | web/sest/tests_reactions.py | Python | mit | 3,797 |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | Azure/azure-sdk-for-python | sdk/eventhub/azure-eventhub/azure/eventhub/aio/_eventprocessor/event_processor.py | Python | mit | 18,174 |
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTW... | basp/neko | spikes/main.py | Python | mit | 2,241 |
"""Integration tests for Transip"""
import re
from unittest import TestCase
import pytest
from lexicon.tests.providers.integration_tests import (
IntegrationTestsV2,
vcr_integration_test,
)
FAKE_KEY = """
-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEAxV08IlJRwNq9WyyGO2xRyT0F6XIBD2R5CrwJoP7gIHVU/Mhk
KeK8//+... | AnalogJ/lexicon | lexicon/tests/providers/test_transip.py | Python | mit | 3,773 |
from ..base import model
from gradient_descent import stochastic_gradient_descent
from ..util import loss_functions
import numpy
from ..util.preprocessing import as_matrix
class SGD_regressor(model):
def __init__(self,
function=loss_functions.linear,
dfunction=loss_functions.dli... | arider/riderml | riderml/regression/SGD_regressor.py | Python | mit | 1,474 |
"""
Copyright (c) 2016 Genome Research Ltd.
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, distr... | jeremymcrae/mupit | mupit/mutation_rates.py | Python | mit | 8,652 |
import _plotly_utils.basevalidators
class NameValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(
self,
plotly_name="name",
parent_name="layout.ternary.baxis.tickformatstop",
**kwargs
):
super(NameValidator, self).__init__(
plotly_name=plo... | plotly/plotly.py | packages/python/plotly/plotly/validators/layout/ternary/baxis/tickformatstop/_name.py | Python | mit | 453 |
"""Abstract base model."""
from datetime import datetime
from pma_api.config import IGNORE_FIELD_PREFIX
from pma_api.models import db
from pma_api.models.string import EnglishString
def prune_ignored_fields(kwargs):
"""Prune ignored fields.
Args:
kwargs (dict): Keyword arguments.
"""
to_pop ... | joeflack4/pma-api | pma_api/models/api_base.py | Python | mit | 5,645 |
import numpy as np
import pdb
from scipy import linalg as splinalg
# A = np.array([
# [1, 1, -2, 1, 3, -1],
# [2, -1, 1, 2, 1, -3],
# [1, 3, -3, -1, 2, 1],
# [5, 2, -1, -1, 2, 1],
# [-3, -1, 2, 3, 1, 3],
# [4, 3, 1, -6, -3, -2]
# ], dtype=float)
# b = np.array([4, 20, -15, -3, 16, -27], dtype=fl... | Seek/LaTechNumeric | linearalg/linalg.py | Python | mit | 8,666 |
import operator
import numpy as np
import sys
'''
Description:
Author: Mikko Auvinen
mikko.auvinen@fmi.fi
Finnish Meteorological Institute
'''
# =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
def readAsciiGridHeader( filename, nHeaderEntries, idx=0 ):
fl = open( filename , 'r')
name = file... | mjsauvinen/P4UL | pyLib/mapTools.py | Python | mit | 23,790 |
"""
This simple Python script embodies its namesake by acting as a
basic calculator. Currently, It can perform addition, subtraction,
division, multiplication, exponentiation, and square roots. More
functions may be added at a later date, or you could add your own!
"""
from __future__ import division # Importing the p... | Carpe-Noctem/Small-Projects | Basic_Calculator.py | Python | mit | 2,337 |
# -*- coding: utf-8 -*-
# 14-8-19
# create by: snower
import time
import logging
from collections import deque
from tornado.ioloop import IOLoop
from tornado.gen import Future
from tornado.iostream import StreamClosedError
from thrift.transport.TTransport import TTransportException
from .transport.stream import TStrea... | snower/TorThrift | torthrift/pool.py | Python | mit | 5,311 |
# coding: utf-8
import time
import sublime
from sublime_plugin import WindowCommand
from .util import noop
from .cmd import GitCmd
from .helpers import GitStashHelper, GitStatusHelper, GitErrorHelper
class GitStashWindowCmd(GitCmd, GitStashHelper, GitErrorHelper):
def pop_or_apply_from_panel(self, action):
... | SublimeGit/SublimeGit | sgit/stash.py | Python | mit | 3,127 |
# -*- coding: utf-8 -*-
import unittest
import os # noqa: F401
import json # noqa: F401
import time
import requests
from os import environ
try:
from ConfigParser import ConfigParser # py2
except:
from configparser import ConfigParser # py3
from pprint import pprint # noqa: F401
from biokbase.workspace.c... | eapearson/eapearson_TestRichReports | test/eapearson_TestRichReports_server_test.py | Python | mit | 5,023 |
from json import loads as json_loads
import collections
from .text_item import AbstractTextItem
from .tree_item import AbstractTreeItem
from .. import register
@register
class JsonItem(AbstractTextItem, AbstractTreeItem):
extensions = ("json",)
mime_type = "text/x-json"
new_item_order_preference = 1.62... | janpipek/hlava | hlava/items/formats/json_item.py | Python | mit | 860 |
import unittest
import bmt_parser.collaborators as collabs
import bmt_parser.name_corrections as corr
import pandas as pd
class Test_collabs(unittest.TestCase):
def test_repeat_collab(self):
testdata = {
'issue_id': [1, 1, 1, 2, 2],
'authors': ['a', 'b', 'c', 'a', 'b']
}
... | mbokulic/bmt_parser | tests/unit_tests.py | Python | mit | 9,581 |
from __future__ import print_function
import Pyro4
@Pyro4.expose
class Aggregator(object):
def __init__(self):
self.viewers = {}
self.symbols = []
def add_symbols(self, symbols):
self.symbols.extend(symbols)
def available_symbols(self):
return self.symbols
def view(s... | irmen/Pyro4 | examples/stockquotes-old/phase3/aggregator.py | Python | mit | 1,432 |
from osgeo import ogr
def addField(shapefile,field):
source = ogr.Open(shapefile, 1)
layer = source.GetLayer()
layer_defn = layer.GetLayerDefn()
new_field = ogr.FieldDefn(field, ogr.OFTInteger)
layer.CreateField(new_field)
source = None
# addField('A_Roads.shp','example') add the 'example' field to A_Roads shapef... | zero-point/hackattack | addField.py | Python | mit | 324 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
from version import __version__
setup(
name='blink',
version=__version__,
description='Create jQuery-like events for your Python app.',
author='Wilhelm Murdoch',
author_email='wilhelm.murdoch@gmail.com',
... | wilhelm-murdoch/blink | setup.py | Python | mit | 479 |
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from django.conf.urls import patterns, url
from .views import session_list_view, sign_out_other_view
urlpatterns = [
url(r"^$", session_list_view, name="session_activity_list"),
... | dryan/django-session-activity | session_activity/urls.py | Python | mit | 397 |
# -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
import scrapy
import os
from scrapy.pipelines.files import FilesPipeline
from urllib import unquote, quote
class DspbooksPipe... | gpalsingh/dspbooksspider | dspbooks/pipelines.py | Python | mit | 1,349 |
import _plotly_utils.basevalidators
class ZerolinewidthValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(
self, plotly_name="zerolinewidth", parent_name="layout.scene.zaxis", **kwargs
):
super(ZerolinewidthValidator, self).__init__(
plotly_name=plotly_name,
... | plotly/python-api | packages/python/plotly/plotly/validators/layout/scene/zaxis/_zerolinewidth.py | Python | mit | 485 |
# The MIT License (MIT)
# Copyright (c) 2011 Derek Ingrouville, Julien Lord, Muthucumaru Maheswaran
# 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 ... | anrl/W12x | server/vxserver.py | Python | mit | 3,668 |
# -*- coding: utf-8 -*
from django.views.generic.edit import CreateView
from person.models import Person
from person.forms import PersonForm
from django.contrib.auth import authenticate, login as auth_login, logout as auth_logout
from django.shortcuts import render_to_response, redirect
from django.template import Req... | ramonsaraiva/sgce | sgce/person/views.py | Python | mit | 1,162 |
"""
Django settings for mysite1 project.
Generated by 'django-admin startproject' using Django 1.10.3.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import os... | JuneDeng2014/working_notes | learn-django-by-example/mysite1/mysite1/settings.py | Python | mit | 3,112 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.